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

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

Issue 2778383002: MenuController Do Not SetSelection to Empty Items on Drag (Closed)
Patch Set: Make logic readible Created 3 years, 9 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 | « no previous file | ui/views/controls/menu/menu_controller_unittest.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 6446dbf6b3cd289e6e01071b414f2f280c233b04..166ff527054ed088c87962ee6d355bf318d4c393 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -624,11 +624,16 @@ bool MenuController::OnMouseDragged(SubmenuView* source,
}
MenuItemView* mouse_menu = NULL;
if (part.type == MenuPart::MENU_ITEM) {
- if (!part.menu)
- part.menu = source->GetMenuItem();
- else
- mouse_menu = part.menu;
- SetSelection(part.menu ? part.menu : state_.item, SELECTION_OPEN_SUBMENU);
+ // If there is no menu target, but a submenu target, then we are interacting
+ // with an empty menu item within a submenu. These cannot become selection
+ // targets for mouse interaction, so do not attempt to update selection.
+ if (part.menu || !part.submenu) {
+ if (!part.menu)
+ part.menu = source->GetMenuItem();
+ else
+ mouse_menu = part.menu;
+ SetSelection(part.menu ? part.menu : state_.item, SELECTION_OPEN_SUBMENU);
+ }
} else if (part.type == MenuPart::NONE) {
ShowSiblingMenu(source, event.location());
}
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698