Commit 6e373bd3 authored by Alex Newcomer's avatar Alex Newcomer Committed by Commit Bot

cros: anchor touch and mouse menus the same

As per request from ux, anchor touch and mouse menus similarly.

Previously touch menus were anchored based on the app icon,
and mouse menus were anchored on the click point.

Now we will anchor all menus on the app icon.

Bug: 846939
Change-Id: I6d2aea28096701c0109081059be40dca5a9ce93c
Reviewed-on: https://chromium-review.googlesource.com/1077308
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Reviewed-by: default avatarJenny Zhang <jennyz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#564940}
parent 68d36054
......@@ -299,13 +299,11 @@ void AppListItemView::OnContextMenuModelReceived(
views::MenuRunner::FIXED_ANCHOR |
views::MenuRunner::CONTEXT_MENU;
anchor_position = views::MENU_ANCHOR_BUBBLE_TOUCHABLE_LEFT;
if (source_type == ui::MENU_SOURCE_TOUCH) {
anchor_rect = apps_grid_view_->GetIdealBounds(this);
// Anchor the menu to the same rect that is used for selection highlight.
anchor_rect.ClampToCenteredSize(
gfx::Size(kGridSelectedSize, kGridSelectedSize));
views::View::ConvertRectToScreen(apps_grid_view_, &anchor_rect);
}
anchor_rect = apps_grid_view_->GetIdealBounds(this);
// Anchor the menu to the same rect that is used for selection highlight.
anchor_rect.ClampToCenteredSize(
gfx::Size(kGridSelectedSize, kGridSelectedSize));
views::View::ConvertRectToScreen(apps_grid_view_, &anchor_rect);
}
context_menu_ = std::make_unique<AppListMenuModelAdapter>(
......
......@@ -373,12 +373,10 @@ void SearchResultTileItemView::OnGetContextMenuModel(
run_types |= views::MenuRunner::USE_TOUCHABLE_LAYOUT |
views::MenuRunner::CONTEXT_MENU |
views::MenuRunner::FIXED_ANCHOR;
if (source_type == ui::MenuSourceType::MENU_SOURCE_TOUCH) {
anchor_rect = source->GetBoundsInScreen();
// Anchor the menu to the same rect that is used for selection highlight.
anchor_rect.ClampToCenteredSize(
gfx::Size(kGridSelectedSize, kGridSelectedSize));
}
anchor_rect = source->GetBoundsInScreen();
// Anchor the menu to the same rect that is used for selection highlight.
anchor_rect.ClampToCenteredSize(
gfx::Size(kGridSelectedSize, kGridSelectedSize));
}
context_menu_ = std::make_unique<AppListMenuModelAdapter>(
......
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