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

Issue 2653523003: Make DOMSelection cache Range (Closed)

Created:
3 years, 11 months ago by yoichio
Modified:
3 years, 10 months ago
Reviewers:
tkent, yosin_UTC9
CC:
blink-reviews, chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make DOMSelection cache Range This patch improves selection WPT score. For example selection/addRange-00.html of 2784 tests, Canary Version 57.0.2985.0 : 1199 Pass This Patch : 1895 Pass DOMSelection::addRange caches the passed Range if no selection and cached merged Range if there is already selection. SelectionEditor clear the cached Range if selection is changed. DOMSelection::getRangeAt return the cached Range if exists. If it doesn't, create and recache it. BUG=490206 Review-Url: https://codereview.chromium.org/2653523003 Cr-Commit-Position: refs/heads/master@{#449258} Committed: https://chromium.googlesource.com/chromium/src/+/0ea3c20f46d0ce2139eaf03bba6a3dd79429c786

Patch Set 1 : Just cache and return it. #

Patch Set 2 : Cache Range and clear it if SelectionEditor changes selection and let FrameSelection.setSelection not clear if its called by DOMSelection #

Patch Set 3 : Cache Range and clear it if SelectionEditor changes selection. Calling FrameSelection.setSelection inside DOMSelection is instantly resumed. #

Patch Set 4 : Patch#3 plus cache merged Range #

Patch Set 5 : Clear cached Range considering Shadow #

Total comments: 6

Patch Set 6 : update #

Total comments: 7

Patch Set 7 : update #

Total comments: 1

Patch Set 8 : update #

Total comments: 4

Patch Set 9 : update #

Total comments: 3

Patch Set 10 : not cache shadow.getSelection().addRange() #

Patch Set 11 : update #

Total comments: 2

Patch Set 12 : cache Range in SelectionEditor #

Total comments: 14

Patch Set 13 : update #

Total comments: 6

Patch Set 14 : nit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+5049 lines, -14147 lines) Patch
M third_party/WebKit/LayoutTests/TestExpectations View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +9 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/selection/addRange-08-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 112 chunks +348 lines, -1060 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/selection/addRange-12-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 92 chunks +1160 lines, -4318 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/selection/addRange-20-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 82 chunks +791 lines, -1733 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/selection/addRange-24-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 97 chunks +678 lines, -1732 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/selection/addRange-40-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 112 chunks +348 lines, -1060 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/selection/addRange-44-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 112 chunks +348 lines, -1060 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/selection/addRange-48-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 112 chunks +348 lines, -1060 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/selection/addRange-52-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 112 chunks +348 lines, -1060 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/selection/addRange-56-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 56 chunks +174 lines, -530 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 10 11 12 13 1 chunk +3 lines, -6 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/selection/extend-20-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +283 lines, -352 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/selection/extend-40-expected.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +122 lines, -176 lines 0 comments Download
M third_party/WebKit/Source/core/editing/DOMSelection.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +7 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/DOMSelection.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 7 chunks +38 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/FrameSelection.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/FrameSelection.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +12 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/SelectionEditor.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +8 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/editing/SelectionEditor.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 5 chunks +20 lines, -0 lines 0 comments Download

Messages

Total messages: 93 (63 generated)
yoichio
This CL needs to refine Layouttests/external/wpt/selection/*-expected.txt Could you tell me an easy way to do ...
3 years, 11 months ago (2017-01-25 07:43:49 UTC) #18
tkent
On 2017/01/25 at 07:43:49, yoichio wrote: > This CL needs to refine Layouttests/external/wpt/selection/*-expected.txt > > ...
3 years, 11 months ago (2017-01-25 07:46:07 UTC) #19
tkent
https://codereview.chromium.org/2653523003/diff/120001/third_party/WebKit/Source/core/editing/DOMSelection.cpp File third_party/WebKit/Source/core/editing/DOMSelection.cpp (right): https://codereview.chromium.org/2653523003/diff/120001/third_party/WebKit/Source/core/editing/DOMSelection.cpp#newcode422 third_party/WebKit/Source/core/editing/DOMSelection.cpp:422: if (!areRangesEqual(newRange, m_Range)) m_Range is always nullptr. Is this ...
3 years, 11 months ago (2017-01-25 07:59:12 UTC) #20
tkent
https://codereview.chromium.org/2653523003/diff/140001/third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt File third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt (right): https://codereview.chromium.org/2653523003/diff/140001/third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt#newcode13 third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt:13: FAIL testDiv.appendChild(testDiv.lastChild), with selected range collapsed at (testDiv.lastChild, 0) ...
3 years, 11 months ago (2017-01-25 23:55:58 UTC) #25
yosin_UTC9
https://codereview.chromium.org/2653523003/diff/140001/third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt File third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt (right): https://codereview.chromium.org/2653523003/diff/140001/third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt#newcode13 third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt:13: FAIL testDiv.appendChild(testDiv.lastChild), with selected range collapsed at (testDiv.lastChild, 0) ...
3 years, 11 months ago (2017-01-26 08:12:49 UTC) #26
yosin_UTC9
https://codereview.chromium.org/2653523003/diff/140001/third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt File third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt (right): https://codereview.chromium.org/2653523003/diff/140001/third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt#newcode13 third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt:13: FAIL testDiv.appendChild(testDiv.lastChild), with selected range collapsed at (testDiv.lastChild, 0) ...
3 years, 11 months ago (2017-01-26 08:28:04 UTC) #27
yoichio
It seems "--reset" flag rewrites tests expectation even it is marked Failure in TestExpectations(e.g. external/wpt/webstorage/document-domain-expected.txt) ...
3 years, 10 months ago (2017-01-27 08:33:04 UTC) #28
yosin_UTC9
https://codereview.chromium.org/2653523003/diff/150001/third_party/WebKit/Source/core/editing/SelectionEditor.cpp File third_party/WebKit/Source/core/editing/SelectionEditor.cpp (right): https://codereview.chromium.org/2653523003/diff/150001/third_party/WebKit/Source/core/editing/SelectionEditor.cpp#newcode88 third_party/WebKit/Source/core/editing/SelectionEditor.cpp:88: selection.start().anchorNode()->treeScope().getSelection()->markRangeDirty(); We want to have |TreeScope::getSelectionIfExists()| to avoid creating ...
3 years, 10 months ago (2017-01-27 10:19:35 UTC) #33
tkent
On 2017/01/27 at 08:33:04, yoichio wrote: > It seems "--reset" flag rewrites tests expectation even ...
3 years, 10 months ago (2017-01-27 11:12:38 UTC) #34
yosin_UTC9
https://codereview.chromium.org/2653523003/diff/170001/third_party/WebKit/Source/core/editing/SelectionEditor.cpp File third_party/WebKit/Source/core/editing/SelectionEditor.cpp (right): https://codereview.chromium.org/2653523003/diff/170001/third_party/WebKit/Source/core/editing/SelectionEditor.cpp#newcode85 third_party/WebKit/Source/core/editing/SelectionEditor.cpp:85: while (treeScope) { Better to use for-statement; for (TreeScope* ...
3 years, 10 months ago (2017-02-07 10:04:30 UTC) #39
tkent
https://codereview.chromium.org/2653523003/diff/170001/third_party/WebKit/LayoutTests/external/wpt/selection/extend-00-expected.txt File third_party/WebKit/LayoutTests/external/wpt/selection/extend-00-expected.txt (right): https://codereview.chromium.org/2653523003/diff/170001/third_party/WebKit/LayoutTests/external/wpt/selection/extend-00-expected.txt#newcode531 third_party/WebKit/LayoutTests/external/wpt/selection/extend-00-expected.txt:531: FAIL extend() with range 1 [paras[0].firstChild, 0, paras[0].firstChild, 0] ...
3 years, 10 months ago (2017-02-08 00:38:24 UTC) #42
yoichio
I'm wondering why following tests are failed: external/wpt/service-workers/service-worker/navigation-redirect.https.html external/wpt/selection/addRange-36.html external/wpt/selection/addRange-00.html external/wpt/selection/addRange-16.html external/wpt/selection/addRange-32.html external/wpt/selection/addRange-28.html external/wpt/selection/addRange-04.html
3 years, 10 months ago (2017-02-08 01:01:30 UTC) #43
tkent
https://codereview.chromium.org/2653523003/diff/170001/third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt File third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt (right): https://codereview.chromium.org/2653523003/diff/170001/third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt#newcode13 third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt:13: FAIL testDiv.appendChild(testDiv.lastChild), with selected range collapsed at (testDiv.lastChild, 0) ...
3 years, 10 months ago (2017-02-08 01:12:31 UTC) #44
tkent
On 2017/02/08 at 01:01:30, yoichio wrote: > I'm wondering why following tests are failed: > ...
3 years, 10 months ago (2017-02-08 01:13:59 UTC) #45
tkent
I think I investigated all of PASS->FAILs. In summary, - We don't need to care ...
3 years, 10 months ago (2017-02-08 01:15:56 UTC) #46
tkent
https://codereview.chromium.org/2653523003/diff/170001/third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt File third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt (right): https://codereview.chromium.org/2653523003/diff/170001/third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt#newcode13 third_party/WebKit/LayoutTests/external/wpt/dom/ranges/Range-mutations-appendChild-expected.txt:13: FAIL testDiv.appendChild(testDiv.lastChild), with selected range collapsed at (testDiv.lastChild, 0) ...
3 years, 10 months ago (2017-02-08 01:47:04 UTC) #47
yoichio
I fixed DOMSelection::extend issue but there are many diff in selection/extend-*-expected.txt. They consist of few ...
3 years, 10 months ago (2017-02-08 06:09:33 UTC) #51
tkent
lgtm. This CL doesn't need to update the following file. Please revert the change. third_party/WebKit/LayoutTests/external/wpt/html/browsers/the-window-object/security-window/window-security-expected.txt ...
3 years, 10 months ago (2017-02-08 06:16:50 UTC) #55
yosin_UTC9
https://codereview.chromium.org/2653523003/diff/200001/third_party/WebKit/Source/core/editing/SelectionEditor.cpp File third_party/WebKit/Source/core/editing/SelectionEditor.cpp (right): https://codereview.chromium.org/2653523003/diff/200001/third_party/WebKit/Source/core/editing/SelectionEditor.cpp#newcode97 third_party/WebKit/Source/core/editing/SelectionEditor.cpp:97: markRangeDirty(&startScope); We should reset all ranges in whole tree-of-tree ...
3 years, 10 months ago (2017-02-08 06:20:26 UTC) #56
yoichio
As offline discussion, we cache only selection is of root document.
3 years, 10 months ago (2017-02-08 07:41:36 UTC) #59
yosin_UTC9
Please hold |Range| object in |SelectionEditor| rather than |DOMSelection|. We don't need to hold |Range| ...
3 years, 10 months ago (2017-02-08 09:20:25 UTC) #63
tkent
https://codereview.chromium.org/2653523003/diff/230001/third_party/WebKit/LayoutTests/external/wpt/selection/selectAllChildren-expected.txt File third_party/WebKit/LayoutTests/external/wpt/selection/selectAllChildren-expected.txt (right): https://codereview.chromium.org/2653523003/diff/230001/third_party/WebKit/LayoutTests/external/wpt/selection/selectAllChildren-expected.txt#newcode398 third_party/WebKit/LayoutTests/external/wpt/selection/selectAllChildren-expected.txt:398: FAIL Range 1 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 1 ...
3 years, 10 months ago (2017-02-09 00:21:36 UTC) #66
yoichio
On 2017/02/08 09:20:25, yosin_BlinkOn_slow wrote: > Please hold |Range| object in |SelectionEditor| rather than |DOMSelection|. ...
3 years, 10 months ago (2017-02-09 05:59:06 UTC) #71
yoichio
https://codereview.chromium.org/2653523003/diff/230001/third_party/WebKit/LayoutTests/external/wpt/selection/selectAllChildren-expected.txt File third_party/WebKit/LayoutTests/external/wpt/selection/selectAllChildren-expected.txt (right): https://codereview.chromium.org/2653523003/diff/230001/third_party/WebKit/LayoutTests/external/wpt/selection/selectAllChildren-expected.txt#newcode398 third_party/WebKit/LayoutTests/external/wpt/selection/selectAllChildren-expected.txt:398: FAIL Range 1 [paras[0].firstChild, 0, paras[0].firstChild, 0], node 1 ...
3 years, 10 months ago (2017-02-09 05:59:16 UTC) #72
yosin_UTC9
https://codereview.chromium.org/2653523003/diff/260001/third_party/WebKit/Source/core/editing/DOMSelection.cpp File third_party/WebKit/Source/core/editing/DOMSelection.cpp (right): https://codereview.chromium.org/2653523003/diff/260001/third_party/WebKit/Source/core/editing/DOMSelection.cpp#newcode423 third_party/WebKit/Source/core/editing/DOMSelection.cpp:423: if (!isTreeScopeDocument()) If we have |cachedRangeIfDocumentSlection()| and |cacheRangeIfDocumentSelection()| if ...
3 years, 10 months ago (2017-02-09 06:52:06 UTC) #76
yoichio
https://codereview.chromium.org/2653523003/diff/260001/third_party/WebKit/Source/core/editing/DOMSelection.cpp File third_party/WebKit/Source/core/editing/DOMSelection.cpp (right): https://codereview.chromium.org/2653523003/diff/260001/third_party/WebKit/Source/core/editing/DOMSelection.cpp#newcode423 third_party/WebKit/Source/core/editing/DOMSelection.cpp:423: if (!isTreeScopeDocument()) On 2017/02/09 06:52:06, yosin_UTC9 wrote: > If ...
3 years, 10 months ago (2017-02-09 09:31:20 UTC) #85
yosin_UTC9
lgtm w/ small nits https://codereview.chromium.org/2653523003/diff/290001/third_party/WebKit/Source/core/editing/DOMSelection.cpp File third_party/WebKit/Source/core/editing/DOMSelection.cpp (right): https://codereview.chromium.org/2653523003/diff/290001/third_party/WebKit/Source/core/editing/DOMSelection.cpp#newcode451 third_party/WebKit/Source/core/editing/DOMSelection.cpp:451: nit: Please get rid of ...
3 years, 10 months ago (2017-02-09 09:32:10 UTC) #86
yoichio
https://codereview.chromium.org/2653523003/diff/290001/third_party/WebKit/Source/core/editing/DOMSelection.cpp File third_party/WebKit/Source/core/editing/DOMSelection.cpp (right): https://codereview.chromium.org/2653523003/diff/290001/third_party/WebKit/Source/core/editing/DOMSelection.cpp#newcode451 third_party/WebKit/Source/core/editing/DOMSelection.cpp:451: On 2017/02/09 09:32:09, yosin_UTC9 wrote: > nit: Please get ...
3 years, 10 months ago (2017-02-09 09:36:04 UTC) #89
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/2653523003/300001
3 years, 10 months ago (2017-02-09 09:36:09 UTC) #90
commit-bot: I haz the power
3 years, 10 months ago (2017-02-09 11:16:32 UTC) #93
Message was sent while issue was closed.
Committed patchset #14 (id:300001) as
https://chromium.googlesource.com/chromium/src/+/0ea3c20f46d0ce2139eaf03bba6a...

Powered by Google App Engine
This is Rietveld 408576698