Use invalidation sets for sibling mutations affected by :nth-* selectors
Reported by
r...@opera.com,
Jun 29 2016
|
|||
Issue descriptionWe resort to using SubtreeStyleChange [1] on the parent of inserted/removed elements when siblings are affected by :nth-* selectors. See if we can utilize invalidation sets to do less recalculations for such changes. [1] https://codesearch.chromium.org/chromium/src/third_party/WebKit/Source/core/dom/ContainerNode.cpp?q=checkForSiblingStyleChanges&sq=package:chromium&dr=CSs&l=1237-1241
,
Aug 10 2016
,
Aug 12 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/1ba555726fbc99f2eb999a97a69c728b31ca1cc5 commit 1ba555726fbc99f2eb999a97a69c728b31ca1cc5 Author: rune <rune@opera.com> Date: Fri Aug 12 14:36:24 2016 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 Review-Url: https://codereview.chromium.org/2235723002 Cr-Commit-Position: refs/heads/master@{#411647} [modify] https://crrev.com/1ba555726fbc99f2eb999a97a69c728b31ca1cc5/third_party/WebKit/LayoutTests/fast/css/invalidation/nth-pseudo.html [modify] https://crrev.com/1ba555726fbc99f2eb999a97a69c728b31ca1cc5/third_party/WebKit/Source/core/css/RuleFeature.cpp [modify] https://crrev.com/1ba555726fbc99f2eb999a97a69c728b31ca1cc5/third_party/WebKit/Source/core/css/RuleFeature.h [modify] https://crrev.com/1ba555726fbc99f2eb999a97a69c728b31ca1cc5/third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp [modify] https://crrev.com/1ba555726fbc99f2eb999a97a69c728b31ca1cc5/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp [modify] https://crrev.com/1ba555726fbc99f2eb999a97a69c728b31ca1cc5/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.h [modify] https://crrev.com/1ba555726fbc99f2eb999a97a69c728b31ca1cc5/third_party/WebKit/Source/core/dom/ContainerNode.cpp [modify] https://crrev.com/1ba555726fbc99f2eb999a97a69c728b31ca1cc5/third_party/WebKit/Source/core/dom/StyleEngine.cpp [modify] https://crrev.com/1ba555726fbc99f2eb999a97a69c728b31ca1cc5/third_party/WebKit/Source/core/dom/StyleEngine.h
,
Aug 12 2016
,
Aug 16 2016
,
Aug 19 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/dae81dbb5e468db696af6994346b8e3acde7bb26 commit dae81dbb5e468db696af6994346b8e3acde7bb26 Author: ericwilligers <ericwilligers@chromium.org> Date: Fri Aug 19 01:25:56 2016 CSS: RuleFeature::clear clears all invalidation sets The recently added members m_universalSiblingInvalidationSet and m_nthInvalidationSet were not being cleared in RuleFeature::clear(). For consistency, we now also clear these members. BUG= 624277 Review-Url: https://codereview.chromium.org/2253053002 Cr-Commit-Position: refs/heads/master@{#413001} [add] https://crrev.com/dae81dbb5e468db696af6994346b8e3acde7bb26/third_party/WebKit/LayoutTests/fast/css/invalidation/rule-change.html [modify] https://crrev.com/dae81dbb5e468db696af6994346b8e3acde7bb26/third_party/WebKit/Source/core/css/RuleFeature.cpp |
|||
►
Sign in to add a comment |
|||
Comment 1 by r...@opera.com
, Jun 29 2016