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

Issue 2228833002: MacViews: Fix behavior of move and select commands when selection direction changes. (Closed)

Created:
4 years, 4 months ago by karandeepb
Modified:
4 years, 4 months ago
Reviewers:
tapted, sky, msw
CC:
chromium-reviews, tfarina, James Su, shuchen+watch_chromium.org, yusukes+watch_chromium.org, nona+watch_chromium.org, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@use_text_commands
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

MacViews: Fix behavior of move and select commands when selection direction changes. Currently the following commands do not behave similarly to Cocoa textfields when the selection direction changes- -moveWordForwardAndModifySelection -moveWordBackwardAndModifySelection -moveToBeginningOfLineAndModifySelection -moveToEndOfLineAndModifySelection -moveToBeginningOfParagraphAndModifySelection -moveToEndOfParagraphAndModifySelection -moveToEndOfDocumentAndModifySelection -moveToBeginningOfDocumentAndModifySelection -moveParagraphForwardAndModifySelection -moveParagraphBackwardAndModifySelection -moveWordRightAndModifySelection -moveWordLeftAndModifySelection -moveToLeftEndOfLineAndModifySelection -moveToRightEndOfLineAndModifySelection This CL adds a new enum gfx::SelectionBehavior which specifies whether a selection is to be made and how. RenderText::MoveCursor() is modified to take this enum as a parameter. Also, two new text edit commands are added to the ui::TextEditCommand enum- -MOVE_PARAGRAPH_BACKWARD_AND_MODIFY_SELECTION -MOVE_PARAGRAPH_FORWARD_AND_MODIFY_SELECTION Textfield::IsTextEditCommandEnabled is modified to enable the following commands on Mac- -MOVE_DOWN: -MOVE_DOWN_AND_MODIFY_SELECTION: -MOVE_PAGE_DOWN: -MOVE_PAGE_DOWN_AND_MODIFY_SELECTION: -MOVE_PAGE_UP: -MOVE_PAGE_UP_AND_MODIFY_SELECTION: -MOVE_UP: -MOVE_UP_AND_MODIFY_SELECTION: Further, Textfield::ExecuteEditCommand is modified to set the correct SelectionBehavior value for the different text editing commands. Also, lots of tests are added. This CL should have no behavior change for non-Mac platforms. BUG=613438, 586985 Committed: https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381 Cr-Commit-Position: refs/heads/master@{#412702}

Patch Set 1 #

Total comments: 32

Patch Set 2 : Change move cursor logic. #

Patch Set 3 : Change MoveCursor API. #

Patch Set 4 : Some tests. #

Patch Set 5 : Add tests. #

Patch Set 6 : More tests. #

Patch Set 7 : Fix compile. #

Total comments: 9

Patch Set 8 : Change synthetic event for pageUp/Down and style improvements. #

Patch Set 9 : Rename SELECTION_DEFAULT to SELECTION_RETAIN #

Patch Set 10 : Add apple rdar in comment. #

Total comments: 27

Patch Set 11 : Rebase. #

Patch Set 12 : Address review comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+904 lines, -295 lines) Patch
M ui/base/ime/linux/text_edit_command_auralinux.cc View 1 chunk +4 lines, -0 lines 0 comments Download
M ui/base/ime/text_edit_commands.h View 1 chunk +2 lines, -0 lines 0 comments Download
M ui/gfx/render_text.h View 1 2 1 chunk +3 lines, -2 lines 0 comments Download
M ui/gfx/render_text.cc View 1 2 3 4 5 6 7 8 2 chunks +38 lines, -4 lines 0 comments Download
M ui/gfx/render_text_unittest.cc View 1 2 3 4 5 6 7 8 24 chunks +328 lines, -76 lines 0 comments Download
M ui/gfx/text_constants.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +31 lines, -0 lines 0 comments Download
M ui/views/cocoa/bridged_content_view.mm View 1 2 3 4 5 6 7 4 chunks +25 lines, -26 lines 0 comments Download
M ui/views/cocoa/bridged_native_widget_unittest.mm View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +24 lines, -15 lines 0 comments Download
M ui/views/controls/textfield/textfield.cc View 1 2 3 4 5 6 7 8 9 10 11 6 chunks +76 lines, -34 lines 0 comments Download
M ui/views/controls/textfield/textfield_model.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M ui/views/controls/textfield/textfield_model.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +4 lines, -5 lines 0 comments Download
M ui/views/controls/textfield/textfield_model_unittest.cc View 1 2 3 4 5 6 7 8 34 chunks +158 lines, -112 lines 0 comments Download
M ui/views/controls/textfield/textfield_test_api.h View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M ui/views/controls/textfield/textfield_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +206 lines, -20 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 68 (51 generated)
karandeepb
PTAL Trent. This is similar to https://codereview.chromium.org/1989143002/ which I had held off due to text ...
4 years, 4 months ago (2016-08-10 04:31:36 UTC) #13
tapted
The API doesn't feel right - I think the CL is trying too hard to ...
4 years, 4 months ago (2016-08-11 03:44:08 UTC) #16
karandeepb
I like the idea of renaming SelectionReversedBehavior to SelectionBehavior and removing the `bool select` argument. ...
4 years, 4 months ago (2016-08-11 07:27:29 UTC) #18
msw
Sorry, perhaps I'm missing something, but this seems overly complex. https://codereview.chromium.org/2228833002/diff/60001/ui/gfx/text_constants.h File ui/gfx/text_constants.h (right): https://codereview.chromium.org/2228833002/diff/60001/ui/gfx/text_constants.h#newcode41 ...
4 years, 4 months ago (2016-08-11 23:46:38 UTC) #19
tapted
I think encapsulating in gfx::RenderText would be a big win too, but it might mean ...
4 years, 4 months ago (2016-08-12 00:12:00 UTC) #20
karandeepb
https://codereview.chromium.org/2228833002/diff/60001/ui/gfx/text_constants.h File ui/gfx/text_constants.h (right): https://codereview.chromium.org/2228833002/diff/60001/ui/gfx/text_constants.h#newcode41 ui/gfx/text_constants.h:41: SELECTION_CARET, On 2016/08/11 23:46:37, msw wrote: > Do you ...
4 years, 4 months ago (2016-08-12 01:26:32 UTC) #21
msw
I was definitely wrong! Thanks for giving some more concrete examples. It would be quite ...
4 years, 4 months ago (2016-08-12 21:58:30 UTC) #22
tapted
I think you're still going, but I'm about to disappear for ~4 weeks so here's ...
4 years, 4 months ago (2016-08-16 03:28:31 UTC) #37
karandeepb
Thanks for the review Trent! >Changing this to RenderText::CreateInstanceForEditing() should allow the test to >run ...
4 years, 4 months ago (2016-08-16 04:20:26 UTC) #40
karandeepb
PTAL msw@. Have simplified the implementation in render_text.cc, added tests and changed the SelectionReversedBehavior enum ...
4 years, 4 months ago (2016-08-16 10:24:52 UTC) #49
msw
This is so much better (especially now that I more clearly understand Mac's intended behavior); ...
4 years, 4 months ago (2016-08-16 18:37:59 UTC) #50
karandeepb
Thanks msw@. https://codereview.chromium.org/2228833002/diff/260001/ui/gfx/text_constants.h File ui/gfx/text_constants.h (right): https://codereview.chromium.org/2228833002/diff/260001/ui/gfx/text_constants.h#newcode30 ui/gfx/text_constants.h:30: SELECTION_RETAIN, On 2016/08/16 18:37:58, msw wrote: > ...
4 years, 4 months ago (2016-08-17 04:37:23 UTC) #58
karandeepb
PTAL sky@ for ui/base review.
4 years, 4 months ago (2016-08-17 04:38:12 UTC) #60
sky
ui/base LGTM
4 years, 4 months ago (2016-08-17 15:31:01 UTC) #61
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2228833002/320001
4 years, 4 months ago (2016-08-18 00:16:09 UTC) #64
commit-bot: I haz the power
Committed patchset #12 (id:320001)
4 years, 4 months ago (2016-08-18 00:22:30 UTC) #66
commit-bot: I haz the power
4 years, 4 months ago (2016-08-18 00:25:29 UTC) #68
Message was sent while issue was closed.
Patchset 12 (id:??) landed as
https://crrev.com/84ab6fac6177ca421e01391de629bcfa36fda381
Cr-Commit-Position: refs/heads/master@{#412702}

Powered by Google App Engine
This is Rietveld 408576698