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

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

Issue 11751002: views: Cancel menu selection on tap-cancel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 11 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 | « ui/views/controls/menu/menu_controller.h ('k') | no next file » | 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 bacc1c915bd9801a1b07ceb957de3ba47f442288..0fe8fbb63b51164b3cf9fc373cc6960cf76ef4fc 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -533,7 +533,17 @@ void MenuController::OnGestureEvent(SubmenuView* source,
SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY);
event->StopPropagation();
}
+ } else if (event->type() == ui::ET_GESTURE_TAP_CANCEL &&
+ part.menu &&
+ part.type == MenuPart::MENU_ITEM) {
+ // Move the selection to the parent menu so that the selection in the
+ // current menu is unset. Make sure the submenu remains open by sending the
+ // appropriate SetSelectionTypes flags.
+ SetSelection(part.menu->GetParentMenuItem(),
+ SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY);
+ event->StopPropagation();
}
+
if (event->stopped_propagation())
return;
@@ -743,8 +753,7 @@ void MenuController::SetSelection(MenuItemView* menu_item,
if (menu_item && menu_item->GetDelegate())
menu_item->GetDelegate()->SelectionChanged(menu_item);
- // TODO(sky): convert back to DCHECK when figure out 93471.
- CHECK(menu_item || (selection_types & SELECTION_EXIT) != 0);
+ DCHECK(menu_item || (selection_types & SELECTION_EXIT) != 0);
pending_state_.item = menu_item;
pending_state_.submenu_open = (selection_types & SELECTION_OPEN_SUBMENU) != 0;
@@ -1532,9 +1541,9 @@ void MenuController::BuildMenuItemPath(MenuItemView* item,
}
void MenuController::StartShowTimer() {
- show_timer_.Start(FROM_HERE,
- TimeDelta::FromMilliseconds(menu_config_.show_delay),
- this, &MenuController::CommitPendingSelection);
+ show_timer_.Start(FROM_HERE,
+ TimeDelta::FromMilliseconds(menu_config_.show_delay),
+ this, &MenuController::CommitPendingSelection);
}
void MenuController::StopShowTimer() {
« no previous file with comments | « ui/views/controls/menu/menu_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698