Commit 6a3603c3 authored by Kevin Bailey's avatar Kevin Bailey Committed by Commit Bot

[omnibox] Set dimensions of tab switch button before measuring

We were measuring the tab switch button size before setting all the
relevant aspects. When we requested a size, it was therefore too big.
This corrects that and, since the size is more appropriate, we don't
need the left justification, which was broken when there wasn't any
text anyways.

Bug: 780835
Change-Id: I72bd6aedc84837864dc6fe764e4ce865f9170cb4
Reviewed-on: https://chromium-review.googlesource.com/1108452Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: Kevin Bailey <krb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569670}
parent ca63f6d9
......@@ -37,7 +37,7 @@ OmniboxTabSwitchButton::OmniboxTabSwitchButton(OmniboxPopupContentsView* model,
gfx::CreateVectorIcon(omnibox::kSwitchIcon,
GetLayoutConstant(LOCATION_BAR_ICON_SIZE),
gfx::kChromeIconGrey));
SetHorizontalAlignment(gfx::ALIGN_LEFT);
SetImageLabelSpacing(8);
if (!calculated_widths_) {
icon_only_width_ = MdTextButton::CalculatePreferredSize().width();
SetText(l10n_util::GetStringUTF16(IDS_OMNIBOX_TAB_SUGGEST_SHORT_HINT));
......@@ -51,7 +51,6 @@ OmniboxTabSwitchButton::OmniboxTabSwitchButton(OmniboxPopupContentsView* model,
set_corner_radius(CalculatePreferredSize().height() / 2.f);
animation_->SetSlideDuration(500);
SetElideBehavior(gfx::FADE_TAIL);
SetImageLabelSpacing(8);
SetInstallFocusRingOnFocus(true);
focus_ring()->SetHasFocusPredicate([](View* view) {
......
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