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

Unified Diff: webkit/glue/webview_impl.cc

Issue 164309: A quick fix for Issue 18844.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 4 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 | « webkit/glue/webview_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webview_impl.cc
===================================================================
--- webkit/glue/webview_impl.cc (revision 22997)
+++ webkit/glue/webview_impl.cc (working copy)
@@ -810,7 +810,7 @@
if (event.windowsKeyCode == VKEY_SPACE) {
int key_code = ((event.modifiers & WebInputEvent::ShiftKey) ?
VKEY_PRIOR : VKEY_NEXT);
- return ScrollViewWithKeyboard(key_code);
+ return ScrollViewWithKeyboard(key_code, event.modifiers);
}
break;
}
@@ -837,7 +837,7 @@
}
}
if (!event.isSystemKey) {
- return ScrollViewWithKeyboard(event.windowsKeyCode);
+ return ScrollViewWithKeyboard(event.windowsKeyCode, event.modifiers);
}
break;
}
@@ -848,7 +848,7 @@
return false;
}
-bool WebViewImpl::ScrollViewWithKeyboard(int key_code) {
+bool WebViewImpl::ScrollViewWithKeyboard(int key_code, int modifiers) {
Frame* frame = GetFocusedWebCoreFrame();
if (!frame)
return false;
@@ -867,11 +867,29 @@
break;
case VKEY_UP:
scroll_direction = ScrollUp;
+#if defined(OS_MACOSX)
+ // Many Mac applications (such as TextEdit, Safari, Firefox, etc.) scroll
+ // to the beginning of a page when typing command+up keys. It is better
+ // for Mac Chrome to emulate this behavior to improve compatibility with
+ // these applications.
+ scroll_granularity = (modifiers == WebInputEvent::MetaKey) ?
+ ScrollByDocument : ScrollByLine;
+#else
scroll_granularity = ScrollByLine;
+#endif
break;
case VKEY_DOWN:
scroll_direction = ScrollDown;
+#if defined(OS_MACOSX)
+ // Many Mac applications (such as TextEdit, Safari, Firefox, etc.) scroll
+ // to the end of a page when typing command+down keys. It is better
+ // for Mac Chrome to emulate this behavior to improve compatibility with
+ // these applications.
+ scroll_granularity = (modifiers == WebInputEvent::MetaKey) ?
+ ScrollByDocument : ScrollByLine;
+#else
scroll_granularity = ScrollByLine;
+#endif
break;
case VKEY_HOME:
scroll_direction = ScrollUp;
« no previous file with comments | « webkit/glue/webview_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698