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

Unified Diff: ui/views/controls/combobox/combobox.cc

Issue 2627013002: MacViews: Fix combobox keyboard shortcuts. (Closed)
Patch Set: Add a comment. Created 3 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/combobox/combobox.h ('k') | ui/views/controls/combobox/combobox_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/combobox/combobox.cc
diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc
index 25304929c47b18fba106eae70dfc98664fd1ade5..d50f5543bb85055e1d0ba2d60af11c1fa9c137c4 100644
--- a/ui/views/controls/combobox/combobox.cc
+++ b/ui/views/controls/combobox/combobox.cc
@@ -161,6 +161,7 @@ class TransparentButton : public CustomButton {
DISALLOW_COPY_AND_ASSIGN(TransparentButton);
};
+#if !defined(OS_MACOSX)
// Returns the next or previous valid index (depending on |increment|'s value).
// Skips separator or disabled indices. Returns -1 if there is no valid adjacent
// index.
@@ -175,6 +176,7 @@ int GetAdjacentIndex(ui::ComboboxModel* model, int increment, int index) {
}
return kNoSelection;
}
+#endif
// Returns the image resource ids of an array for the body button.
//
@@ -619,6 +621,16 @@ bool Combobox::OnKeyPressed(const ui::KeyEvent& e) {
bool show_menu = false;
int new_index = kNoSelection;
switch (e.key_code()) {
+#if defined(OS_MACOSX)
+ case ui::VKEY_DOWN:
+ case ui::VKEY_UP:
+ case ui::VKEY_SPACE:
+ case ui::VKEY_HOME:
+ case ui::VKEY_END:
+ // On Mac, navigation keys should always just show the menu first.
+ show_menu = true;
+ break;
+#else
// Show the menu on F4 without modifiers.
case ui::VKEY_F4:
if (e.IsAltDown() || e.IsAltGrDown() || e.IsControlDown())
@@ -667,7 +679,7 @@ bool Combobox::OnKeyPressed(const ui::KeyEvent& e) {
else
show_menu = true;
break;
-
+#endif // OS_MACOSX
default:
return false;
}
@@ -688,7 +700,8 @@ bool Combobox::OnKeyReleased(const ui::KeyEvent& e) {
if (style_ != STYLE_ACTION)
return false; // crbug.com/127520
- if (e.key_code() == ui::VKEY_SPACE && style_ == STYLE_ACTION)
+ if (e.key_code() == ui::VKEY_SPACE && style_ == STYLE_ACTION &&
+ text_button_->state() == Button::STATE_PRESSED)
OnPerformAction();
return false;
« no previous file with comments | « ui/views/controls/combobox/combobox.h ('k') | ui/views/controls/combobox/combobox_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698