Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Unified Diff: ui/views/controls/menu/menu_controller.cc

Issue 10916180: Context menus on view elements should be positioned above the finger when (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc ('k') | ui/views/controls/menu/menu_runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_controller.cc
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index d24124aa2d95a1cfa7e0222469ab3e42bfa47be3..7fbccfb223b8e7d5e2df0610efa01d083c8ee63a 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -50,6 +50,10 @@ static const int kShowDelay = 400;
// Amount of time from when the drop exits the menu and the menu is hidden.
static const int kCloseOnExitTime = 1200;
+// If a context menu is invoked by touch, we shift the menu by this offset so
+// that the finger does not obscure the menu.
+static const int kCenteredContextMenuYOffset = -15;
+
namespace views {
namespace {
@@ -1091,6 +1095,8 @@ void MenuController::UpdateInitialLocation(
// nicely and menus close prematurely.
pending_state_.initial_bounds.Inset(0, 1);
}
+ if (position == MenuItemView::BOTTOMCENTER)
+ pending_state_.initial_bounds.Offset(0, kCenteredContextMenuYOffset);
// Reverse anchor position for RTL languages.
if (base::i18n::IsRTL()) {
« no previous file with comments | « chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc ('k') | ui/views/controls/menu/menu_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698