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

Issue 2089063005: Schedule sibling invalidation sets for sibling insert/remove. (Closed)

Created:
4 years, 6 months ago by rune
Modified:
4 years, 5 months ago
Reviewers:
esprehn, Eric Willigers
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-dom_chromium.org, blink-reviews-style_chromium.org, caseq+blink_chromium.org, chromium-reviews, devtools-reviews_chromium.org, dglazkov+blink, eae+blinkwatch, kozyatinskiy+blink_chromium.org, lushnikov+blink_chromium.org, pfeldman+blink_chromium.org, rwlbuis, sergeyv+blink_chromium.org, sof, webcomponents-bugzilla_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Schedule sibling invalidation sets for sibling insert/remove. Invalidation sets have been used only for changes which do not alter the tree structure, like changing id, class names, other attributes, and pseudo states. For dom tree changes, style invalidation relies on attach and detach of the layout tree for the inserted/removed element. For subsequent siblings of inserted/removed elements, we have been marking siblings for subtree recalc (when we know we have tried to match adjacent combinators on one of the siblings before) based on the maximum number of consecutive direct adjacent combinators or all subsequent siblings for indirect adjacent combinators. This CL starts using sibling invalidation sets on siblings instead of doing subtree recalcs. The following properties of invalidation sets affected how this implementation was done: * Even though we invalidate descendants/siblings based on tag names, we don't have invalidation sets for tag names as elements do not change tag names dynamically. For inserted/removed elements, we could have used invalidation sets for tag names. Take the selector "div + span". If we remove a div we could have scheduled an invalidation set for div which invalidates a span sibling. * Invalidation sets for simple selectors and their negated versions, for instance ".a" and ":not(.a)", share invalidation sets and they may do so because invalidation sets have been applied when they change. That is, "a" is either part of old or the new class attribute when the invalidation set needs to be scheduled. When removing/inserting elements, a selector like ":not(.a) + .b" will need to schedule a sibling for ".a" for all elements not having the class "a". * Consider the selector "* + .a". We have to schedule a sibling invalidation for any inserted/removed element to invalidate a sibling with class "a". However, invalidation set construction has only created an invalidation set for ".a" with the invalidateSelf flag set. For this CL, we create a single universal sibling invalidation set to handle the cases above. In fact this CL only do sibling invalidations on element insert/remove for id, class, and attribute in addition to scheduling the universal sibling invalidation set. Also, we skip selector lists (that is, :not() and :-webkit-any() as :host() :host-context() and :slotted() never match when followed by an adjacent combinator). For the following set of selectors: :not(.a) + .b + .c #x:not(.a) + .d div + span :-webkit-any(.x) + .f .g We end up with the following universal sibling invalidation set with the descendant invalidation set, containing ".g", to the right. { .c, span, .f, invalidatesSelf } => { .g } Note that if a compound contains both :not() and for instance an id selector, we will not add it to the universal sibling invalidation set as we can properly invalidate ".d" siblings above using the invalidation set for "#x". == Scheduling sibling invalidations For changes not modifying the tree, we schedule sibling invalidation sets on the changed element and invalidate the siblings with descendant sets during the invalidation process. When removing an element, however, the element is not left in the tree, so we need to associate the invalidation set with another element. When we remove an element, we instead schedule the sibling invalidation set, and the sibling invalidation set's descendant set, as descendant invalidation sets on the parent element or shadow root. Likewise for inserting an element. When inserting an element, we have elements to schedule the sibling sets on, but the sets would need to be scheduled on elements further to the right in the sibling list in order to reach the siblings we needed to invalidate. Also, they would have to be moved further right on subsequent insertions. == The effect on amazon.com This CL gets rid of all post-page-load full recalcs before you start interacting with the page. The full recalcs after you start interacting needs to be investigated further. R=esprehn@chromium.org,ericwilligers@chromium.org BUG=542082 Committed: https://crrev.com/1f82047b13f02be39b8104b6afda0615e60a7cee Cr-Commit-Position: refs/heads/master@{#402770}

Patch Set 1 #

Patch Set 2 : Rebased #

Patch Set 3 : Corrected DCHECK #

Total comments: 12

Patch Set 4 : Removed minDirectAdjacent optimization. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+503 lines, -48 lines) Patch
A third_party/WebKit/LayoutTests/fast/css/invalidation/remove-multiple-siblings.html View 1 chunk +34 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/css/invalidation/sibling-inserted.html View 3 chunks +3 lines, -3 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/css/invalidation/sibling-inserted-removed-shadow.html View 1 chunk +69 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/RuleFeature.h View 1 2 3 4 chunks +8 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/RuleFeature.cpp View 1 2 3 8 chunks +83 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp View 1 2 3 2 chunks +155 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/invalidation/InvalidationSet.h View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.h View 1 6 chunks +8 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp View 1 2 3 5 chunks +35 lines, -13 lines 0 comments Download
M third_party/WebKit/Source/core/dom/CharacterData.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/ContainerNode.h View 1 4 chunks +4 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/ContainerNode.cpp View 4 chunks +24 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Element.cpp View 1 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/dom/Node.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/StyleEngine.h View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/StyleEngine.cpp View 1 2 3 2 chunks +52 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp View 3 chunks +10 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h View 1 3 chunks +4 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp View 1 2 chunks +5 lines, -5 lines 0 comments Download

Messages

Total messages: 28 (9 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2089063005/1
4 years, 6 months ago (2016-06-22 23:22:24 UTC) #2
rune
An alternative to https://codereview.chromium.org/2059163002/
4 years, 6 months ago (2016-06-22 23:23:47 UTC) #3
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios-device on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds/25186) ios-device-gn on ...
4 years, 6 months ago (2016-06-22 23:24:56 UTC) #5
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2089063005/20001
4 years, 6 months ago (2016-06-22 23:37:31 UTC) #7
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/248766)
4 years, 6 months ago (2016-06-23 01:16:16 UTC) #9
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2089063005/40001
4 years, 6 months ago (2016-06-23 09:03:10 UTC) #11
rune
esprehn@, ericwilligers@: there were some more code changes with this approach, and I had to ...
4 years, 6 months ago (2016-06-23 10:08:17 UTC) #12
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 6 months ago (2016-06-23 10:24:07 UTC) #14
esprehn
This looks much better, can we remove the ContainerNode checking code entirely by using this ...
4 years, 6 months ago (2016-06-25 01:54:07 UTC) #15
rune
On 2016/06/25 01:54:07, esprehn wrote: > This looks much better, can we remove the ContainerNode ...
4 years, 6 months ago (2016-06-25 11:06:07 UTC) #16
rune
https://codereview.chromium.org/2089063005/diff/40001/third_party/WebKit/Source/core/css/RuleFeature.cpp File third_party/WebKit/Source/core/css/RuleFeature.cpp (right): https://codereview.chromium.org/2089063005/diff/40001/third_party/WebKit/Source/core/css/RuleFeature.cpp#newcode826 third_party/WebKit/Source/core/css/RuleFeature.cpp:826: if (siblingSet->maxDirectAdjacentSelectors() < minDirectAdjacent) On 2016/06/25 01:54:07, esprehn wrote: ...
4 years, 6 months ago (2016-06-25 11:06:35 UTC) #17
rune
ping
4 years, 5 months ago (2016-06-28 10:34:00 UTC) #18
esprehn
lgtm, this is a super cool patch. Can you double check your change description and ...
4 years, 5 months ago (2016-06-29 04:52:08 UTC) #19
rune
https://codereview.chromium.org/2089063005/diff/40001/third_party/WebKit/Source/core/css/RuleFeature.cpp File third_party/WebKit/Source/core/css/RuleFeature.cpp (right): https://codereview.chromium.org/2089063005/diff/40001/third_party/WebKit/Source/core/css/RuleFeature.cpp#newcode826 third_party/WebKit/Source/core/css/RuleFeature.cpp:826: if (siblingSet->maxDirectAdjacentSelectors() < minDirectAdjacent) On 2016/06/29 04:52:08, esprehn wrote: ...
4 years, 5 months ago (2016-06-29 07:44:21 UTC) #20
rune
https://codereview.chromium.org/2089063005/diff/40001/third_party/WebKit/Source/core/css/RuleFeature.cpp File third_party/WebKit/Source/core/css/RuleFeature.cpp (right): https://codereview.chromium.org/2089063005/diff/40001/third_party/WebKit/Source/core/css/RuleFeature.cpp#newcode826 third_party/WebKit/Source/core/css/RuleFeature.cpp:826: if (siblingSet->maxDirectAdjacentSelectors() < minDirectAdjacent) On 2016/06/29 07:44:21, rune wrote: ...
4 years, 5 months ago (2016-06-29 08:26:06 UTC) #21
rune
On 2016/06/29 04:52:08, esprehn wrote: > lgtm, this is a super cool patch. Can you ...
4 years, 5 months ago (2016-06-29 08:42:41 UTC) #22
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/2089063005/60001
4 years, 5 months ago (2016-06-29 08:43:40 UTC) #25
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 5 months ago (2016-06-29 10:30:04 UTC) #26
commit-bot: I haz the power
4 years, 5 months ago (2016-06-29 10:31:55 UTC) #28
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/1f82047b13f02be39b8104b6afda0615e60a7cee
Cr-Commit-Position: refs/heads/master@{#402770}

Powered by Google App Engine
This is Rietveld 408576698