0

Position bookmark menu same as other menus

Bookmark menu was positioned a couple pixels higher to flush button
border for historical reason. Now bookmark button doesn't have border
any more, we should make the menu position consistent as the other
menus. Screenshots of before and after are in the following links:
https://screenshot.googleplex.com/Tib2cdtRG7P.png  (before)
https://screenshot.googleplex.com/xYOxCeXfbes.png  (after)

BUG=832672
TEST=Pls test bookmark menu drag and drop thoroughly, especially on
Windows, to make sure nothing is broken.

Change-Id: I977719e7ba6cbf7204c33ee5f238b9428ff236bf
Reviewed-on: https://chromium-review.googlesource.com/1033349
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Wei Li <weili@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554952}
This commit is contained in:
Wei Li
2018-05-01 01:16:16 +00:00
committed by Commit Bot
parent 41ce5a7add
commit e4774fc791
2 changed files with 2 additions and 9 deletions
chrome/browser/ui/views/bookmarks
ui/views/controls/menu

@@ -52,9 +52,8 @@ void BookmarkMenuController::RunMenuAt(BookmarkBarView* bookmark_bar) {
bookmark_bar_->GetAnchorPositionForButton(menu_button, &anchor);
gfx::Point screen_loc;
views::View::ConvertPointToScreen(menu_button, &screen_loc);
// Subtract 1 from the height to make the popup flush with the button border.
gfx::Rect bounds(screen_loc.x(), screen_loc.y(), menu_button->width(),
menu_button->height() - 1);
menu_button->height());
menu_delegate_->GetBookmarkModel()->AddObserver(this);
// We only delete ourself after the menu completes, so we can safely ignore
// the return value.

@@ -1445,11 +1445,6 @@ void MenuController::UpdateInitialLocation(const gfx::Rect& bounds,
bool context_menu) {
pending_state_.context_menu = context_menu;
pending_state_.initial_bounds = bounds;
if (bounds.height() > 1) {
// Inset the bounds slightly, otherwise drag coordinates don't line up
// nicely and menus close prematurely.
pending_state_.initial_bounds.Inset(0, 1);
}
// Reverse anchor position for RTL languages.
if (base::i18n::IsRTL() &&
@@ -1562,9 +1557,8 @@ bool MenuController::ShowSiblingMenu(SubmenuView* source,
// It is currently not possible to show a submenu recursively in a bubble.
DCHECK(!MenuItemView::IsBubble(anchor));
// Subtract 1 from the height to make the popup flush with the button border.
UpdateInitialLocation(gfx::Rect(screen_menu_loc.x(), screen_menu_loc.y(),
button->width(), button->height() - 1),
button->width(), button->height()),
anchor, state_.context_menu);
alt_menu->PrepareForRun(
false, has_mnemonics,