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

Issue 15017002: WebFrame::selectRange and moveCaret should behave like mouse selection (Closed)

Created:
7 years, 7 months ago by cjhopman
Modified:
7 years, 7 months ago
CC:
blink-reviews, jamesr, abarth_chromum.org, ojan
Visibility:
Public.

Description

WebFrame::selectRange should behave like moveCaret selectRange and moveCaret are used to alter the current selection by a user dragging an insertion/selection handle on Android and ChromeOS. There are two expected behaviors that this change fixes. First, if the current selection is in an editable element, the new selection will be within the same editable element. Second, the selection should stay horizontally aligned with the handle. Currently, selectRange doesn't even consider the second behavior and it sort of gets the first behavior by restricting the resulting selection to not cross editable boundaries and assuming that the focus point is within the current editable element. This is incredibly fragile. This extracts the logic used for determining selection when dragging the mouse, selectionExtentRespectingEditingBoundary, from EventHandler.cpp so that it can also be used for selectRange/moveCaret so that all these behaviors can be consistent. To better reflect what these functions do (and that they are really paired together) this change introduces new names for these two functions: WebFrame::moveCaretSelection and WebFrame::moveRangeSelection. NOTRY=true BUG=232385, 238329, 238334 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=151125

Patch Set 1 #

Patch Set 2 : #

Total comments: 4

Patch Set 3 : #

Total comments: 2

Patch Set 4 : Move to method of VisibleSelection, fix style nits #

Total comments: 3

Patch Set 5 : Rebase #

Patch Set 6 : Address comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+203 lines, -69 lines) Patch
M Source/WebKit/chromium/public/WebFrame.h View 1 2 3 4 5 1 chunk +7 lines, -3 lines 0 comments Download
M Source/WebKit/chromium/src/WebFrameImpl.h View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M Source/WebKit/chromium/src/WebFrameImpl.cpp View 1 2 3 2 chunks +24 lines, -17 lines 0 comments Download
M Source/WebKit/chromium/tests/WebFrameTest.cpp View 1 2 3 6 chunks +136 lines, -7 lines 0 comments Download
M Source/WebKit/chromium/tests/data/move_caret.html View 1 chunk +6 lines, -1 line 0 comments Download
A + Source/WebKit/chromium/tests/data/select_range_div_editable.html View 1 chunk +1 line, -1 line 0 comments Download
D Source/WebKit/chromium/tests/data/select_range_editable.html View 1 chunk +0 lines, -19 lines 0 comments Download
A + Source/WebKit/chromium/tests/data/select_range_span_editable.html View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M Source/core/editing/VisibleSelection.h View 1 2 3 2 chunks +4 lines, -0 lines 0 comments Download
M Source/core/editing/VisibleSelection.cpp View 1 2 3 2 chunks +23 lines, -0 lines 0 comments Download
M Source/core/page/EventHandler.cpp View 1 2 3 4 2 chunks +1 line, -22 lines 0 comments Download

Messages

Total messages: 23 (0 generated)
cjhopman
https://codereview.chromium.org/15017002/diff/3001/Source/WebKit/chromium/public/WebFrame.h File Source/WebKit/chromium/public/WebFrame.h (right): https://codereview.chromium.org/15017002/diff/3001/Source/WebKit/chromium/public/WebFrame.h#newcode459 Source/WebKit/chromium/public/WebFrame.h:459: virtual void moveCaretSelectionTowardsWindowPoint(const WebPoint&) = 0; These two will ...
7 years, 7 months ago (2013-05-06 21:49:37 UTC) #1
cjhopman
leviw: ptal
7 years, 7 months ago (2013-05-06 21:50:18 UTC) #2
leviw_travelin_and_unemployed
Typo in commit message: "current selection is in _and_ editable element" I don't think this ...
7 years, 7 months ago (2013-05-06 22:38:47 UTC) #3
cjhopman
So, I've extracted selectionExtentRespectingEditingBoundary from EventHandler.cpp so that it can be used for these functions. ...
7 years, 7 months ago (2013-05-14 01:02:54 UTC) #4
cjhopman
leviw: ping
7 years, 7 months ago (2013-05-17 01:11:33 UTC) #5
leviw_travelin_and_unemployed
On 2013/05/14 01:02:54, cjhopman wrote: > Note that this still has the issue with contenteditable ...
7 years, 7 months ago (2013-05-21 19:21:33 UTC) #6
leviw_travelin_and_unemployed
https://codereview.chromium.org/15017002/diff/3002/Source/core/editing/VisiblePosition.h File Source/core/editing/VisiblePosition.h (right): https://codereview.chromium.org/15017002/diff/3002/Source/core/editing/VisiblePosition.h#newcode144 Source/core/editing/VisiblePosition.h:144: VisiblePosition visiblePositionRespectingEditingBoundary(const VisibleSelection& currentSelection, const LayoutPoint& localPoint, Node* targetNode); ...
7 years, 7 months ago (2013-05-21 19:21:40 UTC) #7
cjhopman
https://codereview.chromium.org/15017002/diff/3002/Source/core/editing/VisiblePosition.h File Source/core/editing/VisiblePosition.h (right): https://codereview.chromium.org/15017002/diff/3002/Source/core/editing/VisiblePosition.h#newcode144 Source/core/editing/VisiblePosition.h:144: VisiblePosition visiblePositionRespectingEditingBoundary(const VisibleSelection& currentSelection, const LayoutPoint& localPoint, Node* targetNode); ...
7 years, 7 months ago (2013-05-22 23:45:10 UTC) #8
leviw_travelin_and_unemployed
https://codereview.chromium.org/15017002/diff/33001/Source/core/page/EventHandler.cpp File Source/core/page/EventHandler.cpp (right): https://codereview.chromium.org/15017002/diff/33001/Source/core/page/EventHandler.cpp#newcode32 Source/core/page/EventHandler.cpp:32: #include "SVGNames.h" I don't think you meant to have ...
7 years, 7 months ago (2013-05-22 23:50:02 UTC) #9
cjhopman
https://codereview.chromium.org/15017002/diff/33001/Source/core/page/EventHandler.cpp File Source/core/page/EventHandler.cpp (right): https://codereview.chromium.org/15017002/diff/33001/Source/core/page/EventHandler.cpp#newcode32 Source/core/page/EventHandler.cpp:32: #include "SVGNames.h" On 2013/05/22 23:50:02, Levi wrote: > I ...
7 years, 7 months ago (2013-05-22 23:58:33 UTC) #10
leviw_travelin_and_unemployed
Okay. lgtm.
7 years, 7 months ago (2013-05-23 22:52:18 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/cjhopman@chromium.org/15017002/33001
7 years, 7 months ago (2013-05-23 23:27:30 UTC) #12
commit-bot: I haz the power
Retried try job too often on blink_presubmit for step(s) presubmit http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=blink_presubmit&number=494
7 years, 7 months ago (2013-05-23 23:40:07 UTC) #13
cjhopman
abarth: Source/WebKit/*
7 years, 7 months ago (2013-05-23 23:44:30 UTC) #14
jamesr
lgtm https://chromiumcodereview.appspot.com/15017002/diff/33001/Source/WebKit/chromium/public/WebFrame.h File Source/WebKit/chromium/public/WebFrame.h (right): https://chromiumcodereview.appspot.com/15017002/diff/33001/Source/WebKit/chromium/public/WebFrame.h#newcode466 Source/WebKit/chromium/public/WebFrame.h:466: // new selection will be restricted to the ...
7 years, 7 months ago (2013-05-23 23:46:45 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/cjhopman@chromium.org/15017002/51002
7 years, 7 months ago (2013-05-23 23:58:40 UTC) #16
commit-bot: I haz the power
Retried try job too often on mac_layout_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=mac_layout_rel&number=7161
7 years, 7 months ago (2013-05-24 01:20:48 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/cjhopman@chromium.org/15017002/51002
7 years, 7 months ago (2013-05-24 01:39:21 UTC) #18
commit-bot: I haz the power
Retried try job too often on linux_layout_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_layout_rel&number=9806
7 years, 7 months ago (2013-05-24 02:34:12 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/cjhopman@chromium.org/15017002/51002
7 years, 7 months ago (2013-05-24 16:25:39 UTC) #20
commit-bot: I haz the power
Retried try job too often on linux_layout_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_layout_rel&number=10106
7 years, 7 months ago (2013-05-24 17:35:14 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/cjhopman@chromium.org/15017002/51002
7 years, 7 months ago (2013-05-24 19:33:31 UTC) #22
commit-bot: I haz the power
7 years, 7 months ago (2013-05-24 19:33:47 UTC) #23
Message was sent while issue was closed.
Change committed as 151125

Powered by Google App Engine
This is Rietveld 408576698