Commit ed2ae4a3 authored by Alan Cutter's avatar Alan Cutter Committed by Commit Bot

Fix hosted app menu button anchor point misalignment

This CL fixes the misalignment of the hosted app menu button
anchor point by updating its view bounds.

Overriding CalculatePreferredSize() didn't update the behaviour
of GetHeightForWidth() which caused it to be cropped by the
container's BoxLayout. LabelButton::SetMinSize() exists and
should be used instead.

Before rects:
https://bugs.chromium.org/p/chromium/issues/attachment?aid=335982&signed_aid=hz80AUGwixvyOI7d2jCIYQ==&inline=1

After rects:
https://bugs.chromium.org/p/chromium/issues/attachment?aid=335983&signed_aid=9NLhUbDPYjh_YRMnsVABAw==&inline=1

Bug: 836099
Change-Id: I77ad668816df936bbb3129aa1253330382fe22c5
Reviewed-on: https://chromium-review.googlesource.com/1025592Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553290}
parent 2a9b0160
...@@ -37,6 +37,9 @@ HostedAppMenuButton::HostedAppMenuButton(BrowserView* browser_view) ...@@ -37,6 +37,9 @@ HostedAppMenuButton::HostedAppMenuButton(BrowserView* browser_view)
SetAccessibleName(app_name); SetAccessibleName(app_name);
SetTooltipText( SetTooltipText(
l10n_util::GetStringFUTF16(IDS_HOSTED_APPMENU_TOOLTIP, app_name)); l10n_util::GetStringFUTF16(IDS_HOSTED_APPMENU_TOOLTIP, app_name));
int size = GetLayoutConstant(HOSTED_APP_MENU_BUTTON_SIZE);
SetMinSize(gfx::Size(size, size));
SetHorizontalAlignment(gfx::ALIGN_CENTER);
} }
HostedAppMenuButton::~HostedAppMenuButton() {} HostedAppMenuButton::~HostedAppMenuButton() {}
...@@ -68,11 +71,6 @@ void HostedAppMenuButton::OnMenuButtonClicked(views::MenuButton* source, ...@@ -68,11 +71,6 @@ void HostedAppMenuButton::OnMenuButtonClicked(views::MenuButton* source,
menu()->RunMenu(this); menu()->RunMenu(this);
} }
gfx::Size HostedAppMenuButton::CalculatePreferredSize() const {
int size = GetLayoutConstant(HOSTED_APP_MENU_BUTTON_SIZE);
return gfx::Size(size, size);
}
void HostedAppMenuButton::FadeHighlightOff() { void HostedAppMenuButton::FadeHighlightOff() {
if (!ShouldEnterHoveredState()) { if (!ShouldEnterHoveredState()) {
GetInkDrop()->SetHoverHighlightFadeDurationMs(kMenuHighlightFadeDurationMs); GetInkDrop()->SetHoverHighlightFadeDurationMs(kMenuHighlightFadeDurationMs);
......
...@@ -34,9 +34,6 @@ class HostedAppMenuButton : public AppMenuButton, ...@@ -34,9 +34,6 @@ class HostedAppMenuButton : public AppMenuButton,
const gfx::Point& point, const gfx::Point& point,
const ui::Event* event) override; const ui::Event* event) override;
// AppMenuButton:
gfx::Size CalculatePreferredSize() const override;
private: private:
void FadeHighlightOff(); void FadeHighlightOff();
......
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