summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-22 19:52:04 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-22 19:52:04 +0000
commita763b93742b0e753447be079ce5d097f2a7c2d68 (patch)
tree2866f57479cc896723a47ba978d3d0bcd675711e
parent2d02346c5eeeffae79b281dd5e90af0eda3e2e2a (diff)
downloadchromium_src-a763b93742b0e753447be079ce5d097f2a7c2d68.zip
chromium_src-a763b93742b0e753447be079ce5d097f2a7c2d68.tar.gz
chromium_src-a763b93742b0e753447be079ce5d097f2a7c2d68.tar.bz2
[Mac] Don't handle up/down-arrow unless popup is visible.
http://crbug.com/17013 TEST=Browse to www.google.com. Click in the field. Up-arrow should go to beginning of line, down-arrow to end. Review URL: http://codereview.chromium.org/155871 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21310 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_mac.h3
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_mac.mm23
2 files changed, 18 insertions, 8 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
index e564706..854099b 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
@@ -87,6 +87,9 @@ class AutocompleteEditViewMac : public AutocompleteEditView {
// Helper functions for use from AutocompleteEditHelper Objective-C
// class.
+ // Returns true if |popup_view_| is open.
+ bool IsPopupOpen() const;
+
// Trivial wrappers forwarding to |model_| methods.
void OnControlKeyChanged(bool pressed);
void OnEscapeKeyPressed();
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
index 7bbc086..d1f8f31 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
@@ -579,6 +579,10 @@ void AutocompleteEditViewMac::OnPaste() {
OnAfterPossibleChange();
}
+bool AutocompleteEditViewMac::IsPopupOpen() const {
+ return popup_view_->IsOpen();
+}
+
void AutocompleteEditViewMac::OnControlKeyChanged(bool pressed) {
model_->OnControlKeyChanged(pressed);
}
@@ -645,14 +649,17 @@ std::wstring AutocompleteEditViewMac::GetClipboardText(Clipboard* clipboard) {
- (BOOL)control:(NSControl*)control
textView:(NSTextView*)textView doCommandBySelector:(SEL)cmd {
- if (cmd == @selector(moveDown:)) {
- edit_view_->OnUpOrDownKeyPressed(false, false);
- return YES;
- }
-
- if (cmd == @selector(moveUp:)) {
- edit_view_->OnUpOrDownKeyPressed(true, false);
- return YES;
+ // Don't intercept up/down-arrow if the popup isn't open.
+ if (edit_view_->IsPopupOpen()) {
+ if (cmd == @selector(moveDown:)) {
+ edit_view_->OnUpOrDownKeyPressed(false, false);
+ return YES;
+ }
+
+ if (cmd == @selector(moveUp:)) {
+ edit_view_->OnUpOrDownKeyPressed(true, false);
+ return YES;
+ }
}
if (cmd == @selector(scrollPageDown:)) {