summaryrefslogtreecommitdiffstats
path: root/chrome/views
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 23:38:16 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 23:38:16 +0000
commit05d47875219edd6f25490d8a878021ff2d564170 (patch)
tree88fe8a3aaa158da3dd6acbb20258ab604a93ce56 /chrome/views
parent43101c0334b3297868085e661a2e92f935434a5e (diff)
downloadchromium_src-05d47875219edd6f25490d8a878021ff2d564170.zip
chromium_src-05d47875219edd6f25490d8a878021ff2d564170.tar.gz
chromium_src-05d47875219edd6f25490d8a878021ff2d564170.tar.bz2
When the Find bar has focus it eats keypresses such as PageUp, PageDown and Up and Down arrow keys. It doesn't need to - instead the page should scroll even if focus is on the Find bar.
This patch forwards those selected keypresses to the page for its perusal. Known issues: Just like Firefox, the page doesn't scroll if it has frames. SONG=I like to fixit fixit. I like to fixit fixit. BUG=7079 TEST=Open FindInPage on a webpage that has a vertical scrollbar. Press Down, Up, PageDown and PageUp and the page should scroll accordingly. Make sure no ding is heard while doing so. Also make sure this works if focus is on a textfield/textarea when you press Ctrl+F. Review URL: http://codereview.chromium.org/62129 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13389 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r--chrome/views/controls/text_field.cc16
-rw-r--r--chrome/views/controls/text_field.h6
2 files changed, 15 insertions, 7 deletions
diff --git a/chrome/views/controls/text_field.cc b/chrome/views/controls/text_field.cc
index a83c1c0..5114d83c 100644
--- a/chrome/views/controls/text_field.cc
+++ b/chrome/views/controls/text_field.cc
@@ -805,13 +805,19 @@ void TextField::Edit::HandleKeystroke(UINT message,
UINT repeat_count,
UINT flags) {
ScopedFreeze freeze(this, GetTextObjectModel());
- OnBeforePossibleChange();
- DefWindowProc(message, key, MAKELPARAM(repeat_count, flags));
- OnAfterPossibleChange();
TextField::Controller* controller = parent_->GetController();
- if (controller)
- controller->HandleKeystroke(parent_, message, key, repeat_count, flags);
+ bool handled = false;
+ if (controller) {
+ handled =
+ controller->HandleKeystroke(parent_, message, key, repeat_count, flags);
+ }
+
+ if (!handled) {
+ OnBeforePossibleChange();
+ DefWindowProc(message, key, MAKELPARAM(repeat_count, flags));
+ OnAfterPossibleChange();
+ }
}
void TextField::Edit::OnBeforePossibleChange() {
diff --git a/chrome/views/controls/text_field.h b/chrome/views/controls/text_field.h
index 35abf3f..2447e92 100644
--- a/chrome/views/controls/text_field.h
+++ b/chrome/views/controls/text_field.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -31,7 +31,9 @@ class TextField : public View {
const std::wstring& new_contents) = 0;
// This method is called to get notified about keystrokes in the edit.
- virtual void HandleKeystroke(TextField* sender,
+ // This method returns true if the message was handled and should not be
+ // processed further. If it returns false the processing continues.
+ virtual bool HandleKeystroke(TextField* sender,
UINT message, TCHAR key, UINT repeat_count,
UINT flags) = 0;
};