Skip to content

Commit

Permalink
Fix hosted app menu button anchor point misalignment
Browse files Browse the repository at this point in the history
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/1025592
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553290}
  • Loading branch information
alancutter authored and Commit Bot committed Apr 24, 2018
1 parent 2a9b016 commit ed2ae4a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 3 additions & 5 deletions chrome/browser/ui/views/frame/hosted_app_menu_button.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ HostedAppMenuButton::HostedAppMenuButton(BrowserView* browser_view)
SetAccessibleName(app_name);
SetTooltipText(
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() {}
Expand Down Expand Up @@ -68,11 +71,6 @@ void HostedAppMenuButton::OnMenuButtonClicked(views::MenuButton* source,
menu()->RunMenu(this);
}

gfx::Size HostedAppMenuButton::CalculatePreferredSize() const {
int size = GetLayoutConstant(HOSTED_APP_MENU_BUTTON_SIZE);
return gfx::Size(size, size);
}

void HostedAppMenuButton::FadeHighlightOff() {
if (!ShouldEnterHoveredState()) {
GetInkDrop()->SetHoverHighlightFadeDurationMs(kMenuHighlightFadeDurationMs);
Expand Down
3 changes: 0 additions & 3 deletions chrome/browser/ui/views/frame/hosted_app_menu_button.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ class HostedAppMenuButton : public AppMenuButton,
const gfx::Point& point,
const ui::Event* event) override;

// AppMenuButton:
gfx::Size CalculatePreferredSize() const override;

private:
void FadeHighlightOff();

Expand Down

0 comments on commit ed2ae4a

Please sign in to comment.