diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-14 20:14:24 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-14 20:14:24 +0000 |
commit | 3db4da761ef830846c8a1f6b62e9c0d91392a28c (patch) | |
tree | 895f96d25f496e01d7d2e55a4933844a16a9e44f /chrome/browser/views/find_bar_win.cc | |
parent | 7bea1c588a1951e65f525cdab0e99c0839be691c (diff) | |
download | chromium_src-3db4da761ef830846c8a1f6b62e9c0d91392a28c.zip chromium_src-3db4da761ef830846c8a1f6b62e9c0d91392a28c.tar.gz chromium_src-3db4da761ef830846c8a1f6b62e9c0d91392a28c.tar.bz2 |
A fix for the Find box forwarding scroll messages to the page when it shouldn't.
TEST=Open Find on a page with scrollbars, type in 'nomatch', scroll to the middle of the page, set the cursor at the end of the Find text field and add '!', '(' and ')' to the search string. Make sure the page doesn't scroll.
BUG=10509
Review URL: http://codereview.chromium.org/67135
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13696 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/find_bar_win.cc')
-rw-r--r-- | chrome/browser/views/find_bar_win.cc | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/chrome/browser/views/find_bar_win.cc b/chrome/browser/views/find_bar_win.cc index a1d01a9..d85c2ef 100644 --- a/chrome/browser/views/find_bar_win.cc +++ b/chrome/browser/views/find_bar_win.cc @@ -232,10 +232,30 @@ void FindBarWin::MoveWindowIfNecessary(const gfx::Rect& selection_rect, view_->SchedulePaint(); } -void FindBarWin::ForwardKeystrokeToWebpage(TCHAR key) { +bool FindBarWin::MaybeForwardKeystrokeToWebpage( + UINT message, TCHAR key, UINT flags) { + // We specifically ignore WM_CHAR. See http://crbug.com/10509. + if (message != WM_KEYDOWN && message != WM_KEYUP) + return false; + + switch (key) { + case VK_HOME: + case VK_END: + // Ctrl+Home and Ctrl+End should be forwarded to the page. + if (GetKeyState(VK_CONTROL) >= 0) + return false; // Ctrl not pressed: Abort. Otherwise fall through. + case VK_UP: + case VK_DOWN: + case VK_PRIOR: // Page up + case VK_NEXT: // Page down + break; // The keys above are the ones we want to forward to the page. + default: + return false; + } + WebContents* contents = find_bar_controller_->web_contents(); if (!contents) - return; + return false; RenderViewHost* render_view_host = contents->render_view_host(); @@ -245,9 +265,8 @@ void FindBarWin::ForwardKeystrokeToWebpage(TCHAR key) { HWND hwnd = contents->GetContentNativeView(); render_view_host->ForwardKeyboardEvent( - NativeWebKeyboardEvent(hwnd, WM_KEYDOWN, key, 0)); - render_view_host->ForwardKeyboardEvent( - NativeWebKeyboardEvent(hwnd, WM_KEYUP, key, 0)); + NativeWebKeyboardEvent(hwnd, message, key, 0)); + return true; } //////////////////////////////////////////////////////////////////////////////// |