DescriptionUse 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 #Messages
Total messages: 25 (11 generated)
|