Commit ab89dd3a authored by Dave Schuyler's avatar Dave Schuyler Committed by Commit Bot

[Omnibox] remove extra Layout call

This Cl cleans up a TODO to remove an extra Layout call in Invalidate.
The extra call was a workaround for shifting text. I've identified some
unnecessary calls to SizeToPreferredSize() that was shifting the text.

This change should not cause any user visual changes.

This change may improve time to paint metrics.

Bug: None
Change-Id: I253b28e32c02d744a1e3d3c58b2522c04eefb323
Reviewed-on: https://chromium-review.googlesource.com/1041151Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Commit-Queue: Dave Schuyler <dschuyler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555819}
parent fae78253
......@@ -239,10 +239,6 @@ void OmniboxResultView::Invalidate() {
keyword_match->description_class);
keyword_view_->description()->Dim();
}
// TODO(dschuyler): without this Layout call the text will shift slightly when
// hovered. Look into removing this call (without the text shifting).
Layout();
}
void OmniboxResultView::OnSelected() {
......
......@@ -27,7 +27,7 @@ namespace {
constexpr int kTextStyle = views::style::STYLE_PRIMARY;
// Indicates to use CONTEXT_OMNIBOX_PRIMARY when picking a font size in legacy
// codepaths.
// code paths.
constexpr int kInherit = INT_MIN;
struct TextStyle {
......@@ -224,13 +224,11 @@ void OmniboxTextView::SetText(const base::string16& text,
const ACMatchClassifications& classifications) {
render_text_.reset();
render_text_ = CreateClassifiedRenderText(text, classifications);
SizeToPreferredSize();
}
void OmniboxTextView::SetText(const base::string16& text) {
render_text_.reset();
render_text_ = CreateRenderText(text);
SizeToPreferredSize();
}
void OmniboxTextView::SetText(const SuggestionAnswer::ImageLine& line) {
......@@ -242,7 +240,6 @@ void OmniboxTextView::SetText(const SuggestionAnswer::ImageLine& line) {
render_text_.reset();
render_text_ = CreateText(line, GetFontForType(line.text_fields()[0].type()));
font_height_ = render_text_->font_list().GetHeight();
SizeToPreferredSize();
}
std::unique_ptr<gfx::RenderText> OmniboxTextView::CreateText(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment