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

Issue 2680943004: Make FrameSelection to hold non-canonicalized positions (Closed)

Created:
3 years, 10 months ago by yosin_UTC9
Modified:
3 years, 10 months ago
CC:
blink-reviews, blink-reviews-dom_chromium.org, blink-reviews-layout_chromium.org, blink-reviews-style_chromium.org, chromium-reviews, darin-cc_chromium.org, dcheng, dglazkov+blink, eae+blinkwatch, jam, jchaffraix+rendering, leviw+renderwatch, pdr+renderingwatchlist_chromium.org, rwlbuis, sof, szager+layoutwatch_chromium.org, zoltan1
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make FrameSelection to hold non-canonicalized DOM positions This patch makes |FrameSelection| to hold non-canonicalized DOM positions in |SelectionEditor| to align Selection API specification[1] for improving interoperatbility[2]. Before this patch we holds selection as |VisibleSelection| as canonicalized DOM positions. This behavior is not align with Selection API specification[1] then the most complained issue of Blink from editing-tf@w3c. The heart of this patch is holding selection as |SelectionInDOMTree| and compute |VisibleSelection| on-demand with cache of computed |VisibleSelection|. |VisibleSelection| cache is invalidate each DOM tree change and style change since canonicalization referes CSS style properties, e.g display, visibility, -webkit-user-modify, etc, and layout dimension. |SelectionEditor| utilizes |SynchronousMutationObserver| to relocate |m_selectionInDOMTree| instead of |FrameSelection|. Before this patch |FrameSelection| relocates |VisibleSelection| with dirty layout tree then sets |FrameSelection::setSelection()|. To void cyclic reference between |FrameSelection| and |SelectionEditor|, we could not move relocation part to |SelectionEditor|. This patch also updates |FrameSelection::updatePostionAfterAdoptingTextNodesMerged()| to handle |PositonAnchorType|. # Highlight of changes ## FrameCaret - Compute caret position after "layout clean" rather than each selection change to align rendering pipeline. ## CharacterData Changes timing of notifying character data update for ease of relocation of positions. ## FrameSelection - Move |m_isHandleVisible| to |SelectionInDOMTree| as follow-up of [5]. - Move selection relocation to |SelectionEditor|; following patch will move implementations to "SelectionEditor.cpp" ## SelecitonEdtior - Make it to hold |SelectionInDOMTree| with relocation at DOM mutation. - Caching |VisibleSelection| # Brief description of test expectation changes: ## ImeTest.java: This patch gets rid of redundant selection change event from - |testImePaste|, - |testContentEditableEvents_DeleteSurroundingText| - |testInputTextEvents_DeleteSurroundingText| ## LayoutTests Before this patch, Blink uses |VisibleSelection| when it sets even if style and layout changed. This is wrong and unexpected behavior since positions in |VisibleSelection| can no longer be canonicalized positions. This patch changes this behavior to return "sane" canonicalized positions with clean style and layout tree. This patch is the result of many attempts. Previous changes can be found in [3][4]. [1] https://www.w3.org/TR/selection-api/ W3C Selection API [2] https://goo.gl/9v1zOK Improving Interoperatbility of Selection [3] http://crrev.com/1958093002 [4] http://crrev.com/2637013002 [5] http://crrev.com/2651803007 Added isHandleVisible to |SelectionTemplate| BUG=139552, 603684, 605499, 606499, 625533, 644648, 679991 TEST=See changes in this patch CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Review-Url: https://codereview.chromium.org/2680943004 Cr-Original-Original-Commit-Position: refs/heads/master@{#449928} Committed: https://chromium.googlesource.com/chromium/src/+/157413286770a7ac5a24c446a30c08f749738276 Review-Url: https://codereview.chromium.org/2680943004 Cr-Original-Commit-Position: refs/heads/master@{#450280} Committed: https://chromium.googlesource.com/chromium/src/+/17c84b2b6519c821dc319e79f2a7a4508508e20f Review-Url: https://codereview.chromium.org/2680943004 Cr-Commit-Position: refs/heads/master@{#450370} Committed: https://chromium.googlesource.com/chromium/src/+/d892f9592860691ae9a782c12260c94ed6bd1a63

Patch Set 1 : 2017-02-09T14:04:22 #

Patch Set 2 : 2017-02-09T14:47:39 #

Patch Set 3 : 2017-02-09T15:13:43 #

Total comments: 5

Patch Set 4 : 2017-02-10T15:36:22 Rebase #

Patch Set 5 : 2017-02-10T16:43:07 Rebase and update test expectation for cached Document Range #

Total comments: 28

Patch Set 6 : 2017-02-10T19:11:26 Changed for tkent@'s comments #

Total comments: 20

Patch Set 7 : 2017-02-13T16:39:09 Update for yoichio@'s comments #

Patch Set 8 : 2017-02-13T18:00:23 #

Patch Set 9 : 2017-02-13T18:18:28 Rebase #

Patch Set 10 : 2017-02-14T18:34:24 Update test expectation for crrev.com/2694043004 #

Total comments: 1

Patch Set 11 : 2014-02-14T23:34:22 Update TestExpectation to include extend-{0,2,4}0.html and selectAllChildren.html #

Unified diffs Side-by-side diffs Delta from patch set Stats (+674 lines, -631 lines) Patch
M content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java View 3 chunks +4 lines, -7 lines 0 comments Download
M third_party/WebKit/LayoutTests/TestExpectations View 1 2 3 4 5 6 7 8 9 10 3 chunks +7 lines, -6 lines 0 comments Download
M third_party/WebKit/LayoutTests/editing/deleting/delete-br-001.html View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/editing/deleting/delete-br-001-expected.txt View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/editing/deleting/delete-character-003.html View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/editing/deleting/delete-character-003-expected.txt View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -4 lines 0 comments Download
M third_party/WebKit/LayoutTests/editing/execCommand/crash-indenting-list-item.html View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/editing/execCommand/crash-inserting-list.html View 1 chunk +3 lines, -4 lines 0 comments Download
M third_party/WebKit/LayoutTests/editing/execCommand/format-block-multiple-paragraphs-in-pre.html View 2 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/editing/execCommand/remove_format_and_extract_contents.html View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/editing/selection/character-data-mutation.html View 4 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/LayoutTests/editing/selection/document-mutation.html View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/editing/selection/select_all/select_all_details_crash.html View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/editing/selection/select_all/select_all_iframe_crash.html View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/editing/selection/selection_remove_children.html View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/editing/style/justify-left-crash.html View 1 chunk +5 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/editing/undo/redo-selection-modify-crash.html View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/selection/collapse-00-expected.txt View 1 2 3 4 5 6 7 8 9 19 chunks +89 lines, -80 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/selection/collapse-30-expected.txt View 1 2 3 4 5 6 7 8 9 10 chunks +36 lines, -32 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/selection/collapseToStartEnd-expected.txt View 1 2 3 4 5 6 7 8 9 5 chunks +41 lines, -22 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/dom/delete-contents.html View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/dom/shadow/selection-in-nested-shadow.html View 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/dynamic/move-node-with-selection.html View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/events/drag_and_drop_into_removed_on_focus.html View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/images/element-gcd-while-generating-alt-content-expected.txt View 1 2 3 4 5 6 7 8 1 chunk +1 line, -9 lines 0 comments Download
M third_party/WebKit/LayoutTests/platform/mac/fast/css/first-letter-rtc-crash-expected.txt View 1 2 3 4 1 chunk +4 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/platform/win/fast/css/first-letter-rtc-crash-expected.txt View 1 2 3 4 1 chunk +4 lines, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/svg/foreignObject/viewport-foreignobject-crash-expected.html View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/editing/FrameCaret.h View 1 2 3 2 chunks +2 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/editing/FrameCaret.cpp View 1 2 3 4 chunks +11 lines, -16 lines 0 comments Download
M third_party/WebKit/Source/core/editing/FrameSelection.h View 1 2 3 10 chunks +8 lines, -31 lines 0 comments Download
M third_party/WebKit/Source/core/editing/FrameSelection.cpp View 1 2 3 4 5 6 7 19 chunks +237 lines, -279 lines 0 comments Download
M third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp View 1 chunk +3 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/editing/SelectionEditor.h View 1 2 3 4 5 6 5 chunks +43 lines, -23 lines 0 comments Download
M third_party/WebKit/Source/core/editing/SelectionEditor.cpp View 1 2 3 4 5 6 7 6 chunks +130 lines, -65 lines 0 comments Download
M third_party/WebKit/Source/core/editing/VisibleSelection.cpp View 2 chunks +5 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/FrameView.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/page/FocusController.cpp View 1 chunk +3 lines, -2 lines 0 comments Download

Messages

Total messages: 91 (57 generated)
yosin_UTC9
PTAL changwang@, PTAL for ImeTest.java changes.
3 years, 10 months ago (2017-02-09 06:16:46 UTC) #9
Changwan Ryu
On 2017/02/09 06:16:46, yosin_BlinkOn_slow wrote: > PTAL > > changwang@, PTAL for ImeTest.java changes. ImeTest.java ...
3 years, 10 months ago (2017-02-09 06:26:24 UTC) #10
yosin_UTC9
+xiaochengh@, it seems he is now settled. (^_^)
3 years, 10 months ago (2017-02-09 09:21:13 UTC) #12
yoichio
https://codereview.chromium.org/2680943004/diff/40001/third_party/WebKit/Source/core/editing/SelectionEditor.cpp File third_party/WebKit/Source/core/editing/SelectionEditor.cpp (right): https://codereview.chromium.org/2680943004/diff/40001/third_party/WebKit/Source/core/editing/SelectionEditor.cpp#newcode94 third_party/WebKit/Source/core/editing/SelectionEditor.cpp:94: const_cast<SelectionEditor*>(this)->updateCachedVisibleSelectionIfNeeded(); Why do you const_cast the same type? https://codereview.chromium.org/2680943004/diff/40001/third_party/WebKit/Source/core/editing/VisibleSelection.cpp ...
3 years, 10 months ago (2017-02-10 05:24:52 UTC) #13
yosin_UTC9
https://codereview.chromium.org/2680943004/diff/40001/third_party/WebKit/Source/core/editing/SelectionEditor.cpp File third_party/WebKit/Source/core/editing/SelectionEditor.cpp (right): https://codereview.chromium.org/2680943004/diff/40001/third_party/WebKit/Source/core/editing/SelectionEditor.cpp#newcode94 third_party/WebKit/Source/core/editing/SelectionEditor.cpp:94: const_cast<SelectionEditor*>(this)->updateCachedVisibleSelectionIfNeeded(); On 2017/02/10 at 05:24:52, yoichio wrote: > Why ...
3 years, 10 months ago (2017-02-10 06:38:42 UTC) #16
tkent
to be honest, I don't understand the logic change in this CL. Added general comments. ...
3 years, 10 months ago (2017-02-10 08:47:41 UTC) #21
yosin_UTC9
PTAL https://codereview.chromium.org/2680943004/diff/80001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2680943004/diff/80001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode122 third_party/WebKit/Source/core/editing/FrameSelection.cpp:122: // TODO(yosin): We should replace // |visibleSelection<EditingStrategy>()| to ...
3 years, 10 months ago (2017-02-10 10:13:21 UTC) #26
tkent
I have no additional comments. I'll approve this after l-g-t-m by yoichio@ or xiaochengh@.
3 years, 10 months ago (2017-02-13 00:07:31 UTC) #29
yoichio
I recommend you splitting the cl into 1. Having SelectionEditor cached VS 2. change FrameSelection ...
3 years, 10 months ago (2017-02-13 04:38:19 UTC) #30
yoichio
Could you add description about SynchronousMutationObsderver implementation change both in FrameSelection and SelectionEditor?
3 years, 10 months ago (2017-02-13 05:38:39 UTC) #31
yosin_UTC9
On 2017/02/13 at 05:38:39, yoichio wrote: > Could you add description about SynchronousMutationObsderver implementation change ...
3 years, 10 months ago (2017-02-13 05:55:12 UTC) #33
yoichio
https://codereview.chromium.org/2680943004/diff/100001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2680943004/diff/100001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode246 third_party/WebKit/Source/core/editing/FrameSelection.cpp:246: if (!selection().isNone() && !(options & DoNotSetFocus)) { I prefer ...
3 years, 10 months ago (2017-02-13 06:37:43 UTC) #34
yosin_UTC9
PTAL https://codereview.chromium.org/2680943004/diff/100001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2680943004/diff/100001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode246 third_party/WebKit/Source/core/editing/FrameSelection.cpp:246: if (!selection().isNone() && !(options & DoNotSetFocus)) { On ...
3 years, 10 months ago (2017-02-13 07:28:41 UTC) #37
yoichio
https://codereview.chromium.org/2680943004/diff/100001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2680943004/diff/100001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode475 third_party/WebKit/Source/core/editing/FrameSelection.cpp:475: static Position updatePostionAfterAdoptingTextNodesMerged( On 2017/02/13 07:28:40, yosin_UTC9 wrote: > ...
3 years, 10 months ago (2017-02-13 08:18:04 UTC) #44
tkent
https://codereview.chromium.org/2680943004/diff/100001/third_party/WebKit/Source/core/editing/SelectionEditor.cpp File third_party/WebKit/Source/core/editing/SelectionEditor.cpp (right): https://codereview.chromium.org/2680943004/diff/100001/third_party/WebKit/Source/core/editing/SelectionEditor.cpp#newcode98 third_party/WebKit/Source/core/editing/SelectionEditor.cpp:98: SelectionEditor::computeVisibleSelectionInFlatTree() const { On 2017/02/13 at 08:18:03, yoichio wrote: ...
3 years, 10 months ago (2017-02-13 08:33:27 UTC) #45
yosin_UTC9
On 2017/02/13 at 08:33:27, tkent wrote: > https://codereview.chromium.org/2680943004/diff/100001/third_party/WebKit/Source/core/editing/SelectionEditor.cpp > File third_party/WebKit/Source/core/editing/SelectionEditor.cpp (right): > > https://codereview.chromium.org/2680943004/diff/100001/third_party/WebKit/Source/core/editing/SelectionEditor.cpp#newcode98 ...
3 years, 10 months ago (2017-02-13 09:19:13 UTC) #50
yosin_UTC9
PTAL https://codereview.chromium.org/2680943004/diff/100001/third_party/WebKit/Source/core/editing/FrameSelection.cpp File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2680943004/diff/100001/third_party/WebKit/Source/core/editing/FrameSelection.cpp#newcode475 third_party/WebKit/Source/core/editing/FrameSelection.cpp:475: static Position updatePostionAfterAdoptingTextNodesMerged( On 2017/02/13 at 08:18:03, yoichio ...
3 years, 10 months ago (2017-02-13 09:24:14 UTC) #53
yoichio
lgtm
3 years, 10 months ago (2017-02-13 09:26:42 UTC) #54
tkent
lgtm
3 years, 10 months ago (2017-02-13 09:39:26 UTC) #55
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/2680943004/180001
3 years, 10 months ago (2017-02-13 09:54:10 UTC) #59
commit-bot: I haz the power
Committed patchset #9 (id:180001) as https://chromium.googlesource.com/chromium/src/+/157413286770a7ac5a24c446a30c08f749738276
3 years, 10 months ago (2017-02-13 10:55:52 UTC) #62
Garrett Casto
A revert of this CL (patchset #9 id:180001) has been created in https://codereview.chromium.org/2694823002/ by gcasto@chromium.org. ...
3 years, 10 months ago (2017-02-13 17:32:36 UTC) #63
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/2680943004/180001
3 years, 10 months ago (2017-02-14 06:29:30 UTC) #65
yosin_UTC9
On 2017/02/13 at 17:32:36, gcasto wrote: > A revert of this CL (patchset #9 id:180001) ...
3 years, 10 months ago (2017-02-14 06:32:13 UTC) #66
commit-bot: I haz the power
Committed patchset #9 (id:180001) as https://chromium.googlesource.com/chromium/src/+/17c84b2b6519c821dc319e79f2a7a4508508e20f
3 years, 10 months ago (2017-02-14 06:35:43 UTC) #69
tyoshino (SeeGerritForStatus)
It looks this patch caused the following layout tests failures: fast/dom/delete-contents.html editing/deleting/delete-br-001.html external/wpt/selection/collapse-30.html external/wpt/selection/collapse-00.html editing/deleting/delete-character-003.html ...
3 years, 10 months ago (2017-02-14 08:07:59 UTC) #70
tyoshino (SeeGerritForStatus)
A revert of this CL (patchset #9 id:180001) has been created in https://codereview.chromium.org/2691243002/ by tyoshino@chromium.org. ...
3 years, 10 months ago (2017-02-14 08:16:14 UTC) #71
yosin_UTC9
On 2017/02/14 at 08:16:14, tyoshino wrote: > A revert of this CL (patchset #9 id:180001) ...
3 years, 10 months ago (2017-02-14 09:38:21 UTC) #72
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/2680943004/200001
3 years, 10 months ago (2017-02-14 09:38:55 UTC) #75
yosin_UTC9
https://codereview.chromium.org/2680943004/diff/200001/third_party/WebKit/LayoutTests/external/wpt/selection/collapseToStartEnd-expected.txt File third_party/WebKit/LayoutTests/external/wpt/selection/collapseToStartEnd-expected.txt (right): https://codereview.chromium.org/2680943004/diff/200001/third_party/WebKit/LayoutTests/external/wpt/selection/collapseToStartEnd-expected.txt#newcode30 third_party/WebKit/LayoutTests/external/wpt/selection/collapseToStartEnd-expected.txt:30: FAIL Range 5 [paras[1].firstChild, 0, paras[1].firstChild, 0] collapseToStart() assert_equals: ...
3 years, 10 months ago (2017-02-14 10:09:53 UTC) #76
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/2680943004/220001
3 years, 10 months ago (2017-02-14 12:39:08 UTC) #80
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/2680943004/200001
3 years, 10 months ago (2017-02-14 14:28:15 UTC) #84
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/2680943004/240001
3 years, 10 months ago (2017-02-14 14:35:14 UTC) #88
commit-bot: I haz the power
3 years, 10 months ago (2017-02-14 15:56:46 UTC) #91
Message was sent while issue was closed.
Committed patchset #11 (id:240001) as
https://chromium.googlesource.com/chromium/src/+/d892f9592860691ae9a782c12260...

Powered by Google App Engine
This is Rietveld 408576698