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

Issue 225303002: Let Selection.collapse remember a raw Position instead of a canonicalized one. (Closed)

Created:
6 years, 8 months ago by yoichio
Modified:
6 years, 6 months ago
CC:
blink-reviews
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Let Selection.collapse remember a raw Position instead of a canonicalized one. This patch fixes a long-standing editing bug that a Range object returned by Selection.getRangeAt() may not be equivalent to the Range used to set selection with Selection.collapse(). FrameSelection.setSelectedRange sets a Range without canonicalization: https://src.chromium.org/viewvc/blink?revision=169100&view=revision Hence this patch adopts it. Following is the implementation detail. DOMSelection.cpp: - When selection.collapse(node, offset) is called, we create a caret Range corresponding to node and offset and pass it to FrameSelection.setSelectedRange. FrameSelection.cpp: - If new Selection is collapsed, use old isDirectional. This is following the current behavior. LayoutTests: editing/selection/no-range-canonicalization.html - The main test added to current setRange test. fast/css/counters/counter-before-content-not-incremented.html - Some tests expect the collapse method to canonicalize Selection so we need to set a exact DOM position. editing/editing.js - Some tests expect the collapse method to canonicalize Selection at start so I canonicalize that as the old Blink collapse implementation. editing/selection/DOMSelection-DocumentType.html - The current HTML spec says that if Range is set DocumentType node, we should throw type exception. editing/selection/selection-invalid-offset.html - We should throw exception when the method is called with a offset larger than length of a node. - Remove a redundant case. BUG=346613 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=175779

Patch Set 1 : Rebase #

Total comments: 8

Patch Set 2 : Update editing.js to canonicalize Position #

Patch Set 3 : Fix setSelectedRange arguments #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+175 lines, -65 lines) Patch
M LayoutTests/editing/editing.js View 1 2 chunks +47 lines, -12 lines 0 comments Download
M LayoutTests/editing/selection/DOMSelection-DocumentType-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M LayoutTests/editing/selection/no-range-canonicalization.html View 4 chunks +32 lines, -11 lines 0 comments Download
M LayoutTests/editing/selection/no-range-canonicalization-expected.txt View 2 chunks +57 lines, -1 line 0 comments Download
M LayoutTests/editing/selection/script-tests/DOMSelection-DocumentType.js View 1 chunk +1 line, -2 lines 0 comments Download
M LayoutTests/editing/selection/selection-invalid-offset.html View 1 1 chunk +16 lines, -24 lines 0 comments Download
M LayoutTests/editing/selection/selection-invalid-offset-expected.txt View 1 chunk +2 lines, -1 line 0 comments Download
M LayoutTests/fast/css/counters/counter-before-content-not-incremented.html View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/editing/EditorCommand.cpp View 1 2 3 chunks +3 lines, -3 lines 0 comments Download
M Source/core/editing/FrameSelection.h View 1 2 chunks +2 lines, -1 line 4 comments Download
M Source/core/editing/FrameSelection.cpp View 1 2 chunks +2 lines, -2 lines 0 comments Download
M Source/core/editing/InputMethodController.cpp View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M Source/core/page/DOMSelection.cpp View 1 1 chunk +8 lines, -3 lines 0 comments Download
M Source/web/WebLocalFrameImpl.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 37 (0 generated)
yoichio
6 years, 8 months ago (2014-04-18 01:25:22 UTC) #1
yoichio
Sorry, this CL is little fast to be reviewed. I'll ping you later.
6 years, 8 months ago (2014-04-18 02:23:34 UTC) #2
yosin_UTC9
https://codereview.chromium.org/225303002/diff/40001/Source/core/page/DOMSelection.cpp File Source/core/page/DOMSelection.cpp (right): https://codereview.chromium.org/225303002/diff/40001/Source/core/page/DOMSelection.cpp#newcode215 Source/core/page/DOMSelection.cpp:215: range->setEnd(node, offset, exceptionState); nit: |Range::setEnd()| should be succeeded, because ...
6 years, 8 months ago (2014-04-22 04:37:14 UTC) #3
Yuta Kitamura
Is this patch ready?
6 years, 8 months ago (2014-04-22 07:10:09 UTC) #4
yoichio
On 2014/04/22 07:10:09, Yuta Kitamura wrote: > Is this patch ready? Yes, but this brakes ...
6 years, 8 months ago (2014-04-22 07:35:01 UTC) #5
yoichio
Hi. Finally this CL is ready for ship. Thanks in advance.
6 years, 6 months ago (2014-06-04 04:37:35 UTC) #6
yoichio
ping?
6 years, 6 months ago (2014-06-05 03:02:33 UTC) #7
yosin_UTC9
ACK How about removing script elements from dump? If we remove scripts from dump, we ...
6 years, 6 months ago (2014-06-05 03:43:36 UTC) #8
Yuta Kitamura
LGTM if Yoshi's comments and mine are addressed. https://codereview.chromium.org/225303002/diff/190001/LayoutTests/editing/selection/selection-invalid-offset.html File LayoutTests/editing/selection/selection-invalid-offset.html (right): https://codereview.chromium.org/225303002/diff/190001/LayoutTests/editing/selection/selection-invalid-offset.html#newcode32 LayoutTests/editing/selection/selection-invalid-offset.html:32: // ...
6 years, 6 months ago (2014-06-05 09:09:28 UTC) #9
yoichio
On 2014/06/05 03:43:36, yosi wrote: > ACK > > How about removing script elements from ...
6 years, 6 months ago (2014-06-06 07:54:43 UTC) #10
yoichio
https://codereview.chromium.org/225303002/diff/190001/LayoutTests/editing/selection/selection-invalid-offset.html File LayoutTests/editing/selection/selection-invalid-offset.html (right): https://codereview.chromium.org/225303002/diff/190001/LayoutTests/editing/selection/selection-invalid-offset.html#newcode32 LayoutTests/editing/selection/selection-invalid-offset.html:32: // these should throw as well but don't at ...
6 years, 6 months ago (2014-06-06 07:54:49 UTC) #11
yoichio
The CQ bit was checked by yoichio@chromium.org
6 years, 6 months ago (2014-06-06 08:54:33 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yoichio@chromium.org/225303002/230001
6 years, 6 months ago (2014-06-06 08:55:11 UTC) #13
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_blink_dbg on tryserver.blink ...
6 years, 6 months ago (2014-06-06 09:16:09 UTC) #14
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 6 months ago (2014-06-06 09:23:02 UTC) #15
commit-bot: I haz the power
Try jobs failed on following builders: linux_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/11072)
6 years, 6 months ago (2014-06-06 09:23:02 UTC) #16
yoichio
The CQ bit was checked by yoichio@chromium.org
6 years, 6 months ago (2014-06-07 01:30:05 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yoichio@chromium.org/225303002/230001
6 years, 6 months ago (2014-06-07 01:31:06 UTC) #18
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_blink_dbg on tryserver.blink ...
6 years, 6 months ago (2014-06-07 01:48:18 UTC) #19
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 6 months ago (2014-06-07 01:55:21 UTC) #20
commit-bot: I haz the power
Try jobs failed on following builders: mac_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/mac_blink_rel/builds/10719)
6 years, 6 months ago (2014-06-07 01:55:22 UTC) #21
yoichio
The CQ bit was checked by yoichio@chromium.org
6 years, 6 months ago (2014-06-08 11:38:48 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yoichio@chromium.org/225303002/230001
6 years, 6 months ago (2014-06-08 11:39:33 UTC) #23
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_blink_dbg on tryserver.blink ...
6 years, 6 months ago (2014-06-08 11:57:58 UTC) #24
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 6 months ago (2014-06-08 12:04:28 UTC) #25
commit-bot: I haz the power
Try jobs failed on following builders: linux_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/11272)
6 years, 6 months ago (2014-06-08 12:04:28 UTC) #26
yoichio
The CQ bit was checked by yoichio@chromium.org
6 years, 6 months ago (2014-06-09 06:10:57 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yoichio@chromium.org/225303002/250001
6 years, 6 months ago (2014-06-09 06:11:16 UTC) #28
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: blink_presubmit on tryserver.blink ...
6 years, 6 months ago (2014-06-09 07:16:31 UTC) #29
yoichio
+tkent@ as an OWNER for Source/web/WebLocalFrameImpl.cpp. Could you review?
6 years, 6 months ago (2014-06-09 07:18:39 UTC) #30
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 6 months ago (2014-06-09 07:19:22 UTC) #31
commit-bot: I haz the power
Try jobs failed on following builders: blink_presubmit on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/blink_presubmit/builds/7271)
6 years, 6 months ago (2014-06-09 07:19:22 UTC) #32
tkent
lgtm https://codereview.chromium.org/225303002/diff/250001/Source/core/editing/FrameSelection.h File Source/core/editing/FrameSelection.h (right): https://codereview.chromium.org/225303002/diff/250001/Source/core/editing/FrameSelection.h#newcode103 Source/core/editing/FrameSelection.h:103: bool setSelectedRange(Range*, EAffinity, bool isDirectional = false, SetSelectionOptions ...
6 years, 6 months ago (2014-06-09 07:26:22 UTC) #33
commit-bot: I haz the power
Change committed as 175779
6 years, 6 months ago (2014-06-09 07:30:33 UTC) #34
yoichio
https://codereview.chromium.org/225303002/diff/250001/Source/core/editing/FrameSelection.h File Source/core/editing/FrameSelection.h (right): https://codereview.chromium.org/225303002/diff/250001/Source/core/editing/FrameSelection.h#newcode103 Source/core/editing/FrameSelection.h:103: bool setSelectedRange(Range*, EAffinity, bool isDirectional = false, SetSelectionOptions = ...
6 years, 6 months ago (2014-06-09 07:38:31 UTC) #35
tkent
https://codereview.chromium.org/225303002/diff/250001/Source/core/editing/FrameSelection.h File Source/core/editing/FrameSelection.h (right): https://codereview.chromium.org/225303002/diff/250001/Source/core/editing/FrameSelection.h#newcode103 Source/core/editing/FrameSelection.h:103: bool setSelectedRange(Range*, EAffinity, bool isDirectional = false, SetSelectionOptions = ...
6 years, 6 months ago (2014-06-09 07:44:17 UTC) #36
yoichio
6 years, 6 months ago (2014-06-09 07:46:22 UTC) #37
Message was sent while issue was closed.
https://codereview.chromium.org/225303002/diff/250001/Source/core/editing/Fra...
File Source/core/editing/FrameSelection.h (right):

https://codereview.chromium.org/225303002/diff/250001/Source/core/editing/Fra...
Source/core/editing/FrameSelection.h:103: bool setSelectedRange(Range*,
EAffinity, bool isDirectional = false, SetSelectionOptions = CloseTyping |
ClearTypingStyle);
On 2014/06/09 07:44:17, tkent wrote:
> On 2014/06/09 07:38:31, yoichio wrote:
> > On 2014/06/09 07:26:22, tkent wrote:
> > > nit: We should not introduce new bool arguments.
> > 
> > What do you mean?
> 
> Please refer to the 10th bullet of
> http://dev.chromium.org/blink/coding-style#TOC-Names
I see. Will fix later:) Thanks.

Powered by Google App Engine
This is Rietveld 408576698