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

Issue 254002: Fix cmd-up/cmd-down. (Closed)

Created:
11 years, 2 months ago by Nico
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com, Avi (use Gerrit)
Visibility:
Public.

Description

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). Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=27464

Patch Set 1 #

Patch Set 2 : Add test. #

Patch Set 3 : Set edit command in test, so that I actually test what I want to test. #

Patch Set 4 : Stuff seems to work. #

Patch Set 5 : Remove debug fprintf #

Patch Set 6 : update comment #

Total comments: 4

Patch Set 7 : Address comments. #

Total comments: 2

Patch Set 8 : Fix typo found by suzhe #

Total comments: 14
Unified diffs Side-by-side diffs Delta from patch set Stats (+234 lines, -81 lines) Patch
M chrome/chrome.gyp View 2 3 4 5 6 7 3 chunks +3 lines, -2 lines 0 comments Download
M chrome/renderer/render_view.h View 3 4 5 6 7 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/renderer/render_view.cc View 1 2 3 4 5 6 7 1 chunk +6 lines, -1 line 2 comments Download
M chrome/renderer/render_view_unittest.cc View 2 chunks +42 lines, -42 lines 0 comments Download
A chrome/renderer/render_view_unittest_mac.mm View 2 3 4 5 1 chunk +132 lines, -0 lines 8 comments Download
M chrome/test/render_view_test.h View 2 chunks +4 lines, -0 lines 2 comments Download
M chrome/test/render_view_test.cc View 2 3 4 5 6 7 2 chunks +11 lines, -12 lines 0 comments Download
M webkit/glue/webframe_impl.cc View 1 2 3 4 5 6 2 chunks +17 lines, -2 lines 2 comments Download
M webkit/glue/webview_impl.h View 4 5 6 7 1 chunk +5 lines, -0 lines 0 comments Download
M webkit/glue/webview_impl.cc View 4 5 6 7 3 chunks +11 lines, -22 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
Nico
darin: I'd appreciate a quick look at webview_impl.h and WebFrameImpl::executeCommand(const WebString&, const WebString&). hbono, suzhe: ...
11 years, 2 months ago (2009-09-28 15:18:57 UTC) #1
darin (slow to review)
LG http://codereview.chromium.org/254002/diff/5002/4011 File chrome/renderer/render_view.cc (right): http://codereview.chromium.org/254002/diff/5002/4011#newcode1535 Line 1535: else no need for 'else' after 'break' ...
11 years, 2 months ago (2009-09-28 16:39:11 UTC) #2
Nico
http://codereview.chromium.org/254002/diff/5002/4011 File chrome/renderer/render_view.cc (right): http://codereview.chromium.org/254002/diff/5002/4011#newcode1535 Line 1535: else On 2009/09/28 16:39:11, darin wrote: > no ...
11 years, 2 months ago (2009-09-28 22:12:27 UTC) #3
James Su
LGTM. Just wondering if there are other edit commands need such special treatment? James Su ...
11 years, 2 months ago (2009-09-29 00:55:51 UTC) #4
Nico
> Just wondering if there are other edit commands need such special treatment? I don't ...
11 years, 2 months ago (2009-09-29 03:52:32 UTC) #5
Nico
http://codereview.chromium.org/254002/diff/4/1026 File webkit/glue/webview_impl.h (right): http://codereview.chromium.org/254002/diff/4/1026#newcode259 Line 259: // Tries to scroll a frame or any ...
11 years, 2 months ago (2009-09-29 03:52:46 UTC) #6
jeremy
http://codereview.chromium.org/254002/diff/6/8 File chrome/renderer/render_view.cc (right): http://codereview.chromium.org/254002/diff/6/8#newcode1519 Line 1519: // not execute the rest. Are we sure ...
11 years, 2 months ago (2009-09-29 18:12:56 UTC) #7
hbono1
thakis, Thank you for your change and sorry for my slow response. Since I have ...
11 years, 2 months ago (2009-09-30 03:05:04 UTC) #8
Nico
11 years, 2 months ago (2009-09-30 03:51:34 UTC) #9
Sorry about all the style issues. I've uploaded a followup-CL to
http://codereview.chromium.org/244044 .

http://codereview.chromium.org/254002/diff/6/8
File chrome/renderer/render_view.cc (right):

http://codereview.chromium.org/254002/diff/6/8#newcode1519
Line 1519: // not execute the rest.
On 2009/09/29 18:12:56, jeremy wrote:
> Are we sure this isn't possible on OSX as well?
> According to http://www.erasetotheleft.com/post/mac-os-x-key-bindings/ you can
> bind a key to multiple edit commands on OS X.

Oh, this wasn't supposed to mean "only in gtk" but "for example in gtk". I guess
being explicit doesn't hurt. Done.

http://codereview.chromium.org/254002/diff/6/11
File chrome/renderer/render_view_unittest_mac.mm (right):

http://codereview.chromium.org/254002/diff/6/11#newcode15
Line 15: 
On 2009/09/29 18:12:56, jeremy wrote:
> extra newline.

Done.

http://codereview.chromium.org/254002/diff/6/11#newcode18
Line 18: case kVK_UpArrow: uniChar = NSUpArrowFunctionKey; break;
On 2009/09/29 18:12:56, jeremy wrote:
>
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Loops_...:
> 
> switch () {
>   case bla:
>      foo;
>     break;

Surely the styleguide wants to say
switch() {
  case bla:
    foo;
    break;
}

? (i.e. the "4 indent" is relative to the "switch")

Anyway, indented the "case"s, but kept them as one line. Is that ok?

http://codereview.chromium.org/254002/diff/6/11#newcode39
Line 39: 
On 2009/09/29 18:12:56, jeremy wrote:
> extra newline

Done.

http://codereview.chromium.org/254002/diff/6/11#newcode94
Line 94: "40,false,false,true,false\n1936\np1\n\np2";
On 2009/09/29 18:12:56, jeremy wrote:
> Could you provide a helper function that does the equality check rather than
> doing an EXPECT_EQ with this raw string, that would make this easier to modify
> and understand later on.

Not easily. The helper function would have to go into render_view_test.h, which
is used on win and linux as well, and the most general function I can come up
for this isn't useful for other test either (the function would look like
ExpectPageText(keyCode, isShiftdown, isCtrlDown, isMetaDown, isAltDown,
scrollOffset, trailingText).

http://codereview.chromium.org/254002/diff/6/13
File chrome/test/render_view_test.h (right):

http://codereview.chromium.org/254002/diff/6/13#newcode14
Line 14: #include "chrome/common/native_web_keyboard_event.h"
On 2009/09/29 18:12:56, jeremy wrote:
> alphabetize include order.

Done.

http://codereview.chromium.org/254002/diff/6/14
File webkit/glue/webframe_impl.cc (right):

http://codereview.chromium.org/254002/diff/6/14#newcode1018
Line 1018: // for editable nodes.
On 2009/09/29 18:12:56, jeremy wrote:
> hbono had quite alot to say about this, could you elaborate on this comment if
> there's anything more to say here?

Not sure what you're after…he suggested that we should disable edit commands for
non-editable nodes in general, but that breaks e.g. selectAll as noted on the
bug, so I came up with this approach. Do you want me to add something to the
comment (what?) or…?

Powered by Google App Engine
This is Rietveld 408576698