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 2235723002: Use invalidation sets for nth invalidations. (Closed)

Created:
4 years, 4 months ago by rune
Modified:
4 years, 4 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, chromium-reviews, dglazkov+blink, eae+blinkwatch, rwlbuis, sof
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use invalidation sets for nth invalidations. Invalidate siblings of inserted/removed elements for :nth type changes by scheduling a descendant invalidation set on the parent node of the inserted element. There is currently one such set for all structural pseudo classes with the exception of :first-child, :last-child, and :only-child, which have their own sets and may have so since they can't affect arbitrary siblings. The descendant set never has invalidatesSelf since it's scheduled on the parent node of where the actual change happens. Structural pseudo classes in the righmost compound adds rightmost compound features to the descendant set: .a:nth-child(3n) {} => adds ".a" to the descendant set. Righmost compound structural pseudo classes where there are no other features makes the descendant set have wholeSubtreeInvalid since all siblings where the mutation happens have to be invalidated: :nth-child(3n) {} => setWholeSubtreeInvalid() Sibling selectors turns into descendant features: :nth-child(3n) + .a {} => adds ".a" to the descendant set. Descendant selectors causes features to be added as normal: :nth-child(3n) .a {} => adds ".a" to the descendant set. This approach isn't super optimal since having a rightmost structural pseudo without other features in the compound will cause nth- invalidations to still be full subtree invalidations, but it should be a good first iteration. What we could do is something along the lines of what sibling invalidations do where they have a maximum number of siblings a set applies to. The nth-invalidation where the pseudo is in the rightmost compound really needs to invalidation all siblings and not their descendants. We could have some notion of removing descendant sets which should no longer apply walking down the tree. Traversing siblings scheduling invalidation sets on them was not chosen for the same reason we schedule siblings invalidations as descendant invalidations on the parent node for sibling mutations already. R=esprehn@chromium.org,ericwilligers@chromium.org BUG=624277 Committed: https://crrev.com/1ba555726fbc99f2eb999a97a69c728b31ca1cc5 Cr-Commit-Position: refs/heads/master@{#411647}

Patch Set 1 #

Total comments: 3

Patch Set 2 : Rebased #

Patch Set 3 : Unnecessary to add features after setWholeSubtreeInvalid #

Patch Set 4 : Comment ::before/::after #

Unified diffs Side-by-side diffs Delta from patch set Stats (+256 lines, -43 lines) Patch
M third_party/WebKit/LayoutTests/fast/css/invalidation/nth-pseudo.html View 3 chunks +20 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/css/RuleFeature.h View 4 chunks +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/RuleFeature.cpp View 1 2 3 9 chunks +46 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp View 3 chunks +145 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp View 8 chunks +19 lines, -17 lines 0 comments Download
M third_party/WebKit/Source/core/dom/ContainerNode.cpp View 1 chunk +7 lines, -13 lines 0 comments Download
M third_party/WebKit/Source/core/dom/StyleEngine.h View 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/StyleEngine.cpp View 1 6 chunks +12 lines, -5 lines 0 comments Download

Messages

Total messages: 25 (11 generated)
rune
ptal
4 years, 4 months ago (2016-08-10 16:06:21 UTC) #6
esprehn
Hmm, I wonder if we should just add another bit that means "just children" instead ...
4 years, 4 months ago (2016-08-11 09:44:25 UTC) #7
rune
On 2016/08/11 09:44:25, esprehn wrote: > Hmm, I wonder if we should just add another ...
4 years, 4 months ago (2016-08-11 10:13:36 UTC) #8
esprehn
I'll admit the extractInvalidationSetFeatures code is making less and less sense to me, I think ...
4 years, 4 months ago (2016-08-11 10:32:55 UTC) #9
esprehn
On 2016/08/11 at 10:13:36, rune wrote: > On 2016/08/11 09:44:25, esprehn wrote: > > Hmm, ...
4 years, 4 months ago (2016-08-11 10:33:07 UTC) #10
rune
https://codereview.chromium.org/2235723002/diff/1/third_party/WebKit/Source/core/css/RuleFeature.cpp File third_party/WebKit/Source/core/css/RuleFeature.cpp (right): https://codereview.chromium.org/2235723002/diff/1/third_party/WebKit/Source/core/css/RuleFeature.cpp#newcode474 third_party/WebKit/Source/core/css/RuleFeature.cpp:474: m_nthInvalidationSet->setWholeSubtreeInvalid(); On 2016/08/11 10:32:55, esprehn wrote: > If we're ...
4 years, 4 months ago (2016-08-12 11:03:14 UTC) #11
rune
On 2016/08/11 10:32:55, esprehn wrote: > I'll admit the extractInvalidationSetFeatures code is making less and ...
4 years, 4 months ago (2016-08-12 11:03:46 UTC) #12
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/2235723002/60001
4 years, 4 months ago (2016-08-12 11:46:29 UTC) #15
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/121612)
4 years, 4 months ago (2016-08-12 13:07:59 UTC) #17
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/2235723002/60001
4 years, 4 months ago (2016-08-12 13:55:24 UTC) #19
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 4 months ago (2016-08-12 14:36:40 UTC) #21
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/1ba555726fbc99f2eb999a97a69c728b31ca1cc5 Cr-Commit-Position: refs/heads/master@{#411647}
4 years, 4 months ago (2016-08-12 14:39:05 UTC) #23
Eric Willigers
https://codereview.chromium.org/2235723002/diff/1/third_party/WebKit/LayoutTests/fast/css/invalidation/nth-pseudo.html File third_party/WebKit/LayoutTests/fast/css/invalidation/nth-pseudo.html (right): https://codereview.chromium.org/2235723002/diff/1/third_party/WebKit/LayoutTests/fast/css/invalidation/nth-pseudo.html#newcode59 third_party/WebKit/LayoutTests/fast/css/invalidation/nth-pseudo.html:59: }, "Prepending an element sibling should not affect :nth-last-child ...
4 years, 4 months ago (2016-08-13 01:00:05 UTC) #24
rune
4 years, 4 months ago (2016-08-15 07:38:06 UTC) #25
Message was sent while issue was closed.
On 2016/08/13 01:00:05, Eric Willigers wrote:
>
https://codereview.chromium.org/2235723002/diff/1/third_party/WebKit/LayoutTe...
> File third_party/WebKit/LayoutTests/fast/css/invalidation/nth-pseudo.html
> (right):
> 
>
https://codereview.chromium.org/2235723002/diff/1/third_party/WebKit/LayoutTe...
> third_party/WebKit/LayoutTests/fast/css/invalidation/nth-pseudo.html:59: },
> "Prepending an element sibling should not affect :nth-last-child of succeeding
> siblings.");
> This test is about nth-child.

Thanks for spotting that. Uploaded https://codereview.chromium.org/2242113002/

Powered by Google App Engine
This is Rietveld 408576698