diff options
author | davemoore@google.com <davemoore@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-23 22:30:16 +0000 |
---|---|---|
committer | davemoore@google.com <davemoore@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-23 22:30:16 +0000 |
commit | 42ecb863ac38c351dd79f4b49f501f4bbd667cac (patch) | |
tree | ace8553575fe3fb5507310f55386dab40909db7f /chrome/browser/views | |
parent | 2e7cb7567212d9f54ccc7555a19c6ab8e6b3875f (diff) | |
download | chromium_src-42ecb863ac38c351dd79f4b49f501f4bbd667cac.zip chromium_src-42ecb863ac38c351dd79f4b49f501f4bbd667cac.tar.gz chromium_src-42ecb863ac38c351dd79f4b49f501f4bbd667cac.tar.bz2 |
A refactor broke the find bar...characters like ! and (
became unsearchable
BUG=10509
TEST=Open nytimes.com, search for "new". Then type "!". It should appear in the search box but not be found (unless the the text "new!" is really in the page. Confirm you can search for ( and & as well.
Review URL: http://codereview.chromium.org/220019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27012 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/find_bar_host.cc | 5 | ||||
-rw-r--r-- | chrome/browser/views/find_bar_host.h | 11 | ||||
-rwxr-xr-x | chrome/browser/views/find_bar_host_gtk.cc | 5 | ||||
-rwxr-xr-x | chrome/browser/views/find_bar_host_win.cc | 6 |
4 files changed, 23 insertions, 4 deletions
diff --git a/chrome/browser/views/find_bar_host.cc b/chrome/browser/views/find_bar_host.cc index 2c25dd1..d81d6c1 100644 --- a/chrome/browser/views/find_bar_host.cc +++ b/chrome/browser/views/find_bar_host.cc @@ -355,6 +355,11 @@ void FindBarHost::UnregisterEscAccelerator() { bool FindBarHost::MaybeForwardKeystrokeToWebpage( const views::Textfield::Keystroke& key_stroke) { + if (!ShouldForwardKeystrokeToWebpageNative(key_stroke)) { + // Native implementation says not to forward these events. + return false; + } + switch (key_stroke.GetKeyboardCode()) { case base::VKEY_DOWN: case base::VKEY_UP: diff --git a/chrome/browser/views/find_bar_host.h b/chrome/browser/views/find_bar_host.h index 97f1ded..6c77776 100644 --- a/chrome/browser/views/find_bar_host.h +++ b/chrome/browser/views/find_bar_host.h @@ -44,10 +44,10 @@ class View; // //////////////////////////////////////////////////////////////////////////////// class FindBarHost : public views::AcceleratorTarget, - public views::FocusChangeListener, - public AnimationDelegate, - public FindBar, - public FindBarTesting { + public views::FocusChangeListener, + public AnimationDelegate, + public FindBar, + public FindBarTesting { public: explicit FindBarHost(BrowserView* browser_view); virtual ~FindBarHost(); @@ -155,6 +155,9 @@ class FindBarHost : public views::AcceleratorTarget, NativeWebKeyboardEvent GetKeyboardEvent( const TabContents* contents, const views::Textfield::Keystroke& key_stroke); + // Allows native implementation to prevent keystrokes from being forwarded. + bool ShouldForwardKeystrokeToWebpageNative( + const views::Textfield::Keystroke& key_stroke); // The BrowserView that created us. BrowserView* browser_view_; diff --git a/chrome/browser/views/find_bar_host_gtk.cc b/chrome/browser/views/find_bar_host_gtk.cc index 6a0989d..2a08e32 100755 --- a/chrome/browser/views/find_bar_host_gtk.cc +++ b/chrome/browser/views/find_bar_host_gtk.cc @@ -71,3 +71,8 @@ NativeWebKeyboardEvent FindBarHost::GetKeyboardEvent( return NativeWebKeyboardEvent(key_stroke.event()); } +bool FindBarHost::ShouldForwardKeystrokeToWebpageNative( + const views::Textfield::Keystroke& key_stroke) { + return true; +} + diff --git a/chrome/browser/views/find_bar_host_win.cc b/chrome/browser/views/find_bar_host_win.cc index 74577b4..dc93e34 100755 --- a/chrome/browser/views/find_bar_host_win.cc +++ b/chrome/browser/views/find_bar_host_win.cc @@ -189,3 +189,9 @@ gfx::NativeView FindBarHost::GetNativeView(BrowserView* browser_view) { return browser_view->GetWidget()->GetNativeView(); } +bool FindBarHost::ShouldForwardKeystrokeToWebpageNative( + const views::Textfield::Keystroke& key_stroke) { + // We specifically ignore WM_CHAR. See http://crbug.com/10509. + return key_stroke.message() == WM_KEYDOWN || key_stroke.message() == WM_KEYUP; +} + |