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

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

Issue 167643003: Support prefix typing in Combobox while menu is open (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: retry upload Created 6 years, 10 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') | 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 4ee0f5d6d9c6ed335f40fa6e3b84f9daf7bdef40..ca2db3583ddb62e1ddaa61aee843ba0f63079d3a 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -1124,7 +1124,7 @@ bool MenuController::OnKeyDown(ui::KeyboardCode key_code) {
break;
case ui::VKEY_F4:
- if (!accept_on_f4_)
+ if (!is_combobox_)
break;
// Fallthrough to accept on F4, so combobox menus match Windows behavior.
case ui::VKEY_RETURN:
@@ -1191,7 +1191,7 @@ MenuController::MenuController(ui::NativeTheme* theme,
menu_config_(theme),
closing_event_time_(base::TimeDelta()),
menu_start_time_(base::TimeTicks()),
- accept_on_f4_(false),
+ is_combobox_(false),
item_selected_by_touch_(false) {
active_instance_ = this;
}
@@ -2116,10 +2116,14 @@ bool MenuController::SelectByChar(base::char16 character) {
if (details.first_match != -1)
return AcceptOrSelect(item, details);
- // If no mnemonics found, look at first character of titles.
- details = FindChildForMnemonic(item, key, &TitleMatchesMnemonic);
- if (details.first_match != -1)
- return AcceptOrSelect(item, details);
+ if (is_combobox_) {
+ item->GetSubmenu()->GetTextInputClient()->InsertChar(character, 0);
+ } else {
+ // If no mnemonics found, look at first character of titles.
+ details = FindChildForMnemonic(item, key, &TitleMatchesMnemonic);
+ if (details.first_match != -1)
+ return AcceptOrSelect(item, details);
+ }
return false;
}
« no previous file with comments | « ui/views/controls/menu/menu_controller.h ('k') | ui/views/controls/menu/menu_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698