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

Unified Diff: chrome/browser/views/find_bar_win.cc

Issue 67135: Fix: Find box forwarding scroll messages to the page when it shouldn't (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 | « chrome/browser/views/find_bar_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/find_bar_win.cc
===================================================================
--- chrome/browser/views/find_bar_win.cc (revision 13620)
+++ chrome/browser/views/find_bar_win.cc (working copy)
@@ -232,10 +232,30 @@
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 @@
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;
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « chrome/browser/views/find_bar_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698