diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-29 03:56:51 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-29 03:56:51 +0000 |
commit | 507b33eab2acbb4e360b5b6eb9f2e666079d0e3b (patch) | |
tree | 6fd3dd864e9da3e68efc7ded0dbaf96b597fcd3c /webkit/glue/webframe_impl.cc | |
parent | 529338471fec2ab9b07bac9b07e3477b20e0ae28 (diff) | |
download | chromium_src-507b33eab2acbb4e360b5b6eb9f2e666079d0e3b.zip chromium_src-507b33eab2acbb4e360b5b6eb9f2e666079d0e3b.tar.gz chromium_src-507b33eab2acbb4e360b5b6eb9f2e666079d0e3b.tar.bz2 |
Fix cmd-up/cmd-down.
The approach is to special-case moveToBeginningOfDocument and moveToEndOfDocument in WebFrameImpl::executeCommand(). With this (and the cocoa keyboard bindings patch being landed), the special-case code in WebViewImpl::ScrollViewWithKeyboard() can be removed.
Also add a test for cmd-up/down.
Change chrome.gyp so that it supports osx-only unit tests (_unittest_mac.mm).
Move OnPrintPageAsBitmap to the other printing tests.
BUG=22585
TEST=Go to a page with both text box and scrollbar (e.g. http://en.wikipedia.org ). Pressing cmd-down should scroll to end of page, cmd-up back to start. Clicking the text box and trying some emacs shortcuts should work (ctrl-a jumps to start of line, cmd-h acts as backspace, etc).
Review URL: http://codereview.chromium.org/254002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27464 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webframe_impl.cc')
-rw-r--r-- | webkit/glue/webframe_impl.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index 68c6882..e49fed8 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -121,6 +121,7 @@ MSVC_PUSH_WARNING_LEVEL(0); #include "ScriptSourceCode.h" #include "ScriptValue.h" #include "ScrollbarTheme.h" +#include "ScrollTypes.h" #include "SelectionController.h" #include "Settings.h" #include "SkiaUtils.h" @@ -1011,8 +1012,22 @@ bool WebFrameImpl::executeCommand(const WebString& name) { bool WebFrameImpl::executeCommand(const WebString& name, const WebString& value) { ASSERT(frame()); - return frame()->editor()->command(webkit_glue::WebStringToString(name)). - execute(webkit_glue::WebStringToString(value)); + WebCore::String web_name = webkit_glue::WebStringToString(name); + + // moveToBeginningOfDocument and moveToEndfDocument are only handled by WebKit + // for editable nodes. + if (!frame()->editor()->canEdit() && + web_name == "moveToBeginningOfDocument") { + return GetWebViewImpl()->PropagateScroll(WebCore::ScrollUp, + WebCore::ScrollByDocument); + } else if (!frame()->editor()->canEdit() && + web_name == "moveToEndOfDocument") { + return GetWebViewImpl()->PropagateScroll(WebCore::ScrollDown, + WebCore::ScrollByDocument); + } else { + return frame()->editor()->command(web_name). + execute(webkit_glue::WebStringToString(value)); + } } bool WebFrameImpl::isCommandEnabled(const WebString& name) const { |