DescriptionStore :last/first-child state as restyle flags.
firstChildState and lastChildState were set to true on RenderStyle if we
had tried to match :first-child or :last-child on the element for which we
were constructing the RenderStyle. But also, when trying to match
:last-child on siblings or ascendants of the element, we set this flag on
their RenderStyle objects respectively.
That was problematic for a number of reasons. First, the state is used to
check if an element needs a style recalc when nodes are added or removed,
and that recalc is also necessary for if you have
:last-child { display: none }
in which case you have no RenderStyle. Second, the flag was reset as part
of recalculating style for a RenderStyle whose descendants depended on its
:last-child state. That flag would not be set again if the descendants
themselves didn't need a recalc. Last, the flag inconsistency caused
RenderStyle operator== to incorrectly return false, causing an assert in
the animations code.
This CL converts these RenderStyle state flags to DynamicRestyleFlags on
Element instead. That means they will give more false positives about the
need to recalculate for last-child/first-child mutations since they will
not be reset that often. They will be cleared along with the other restyle
flags when the element is removed from the tree. Since they will not be
reset on style recalc, they will also be unconditionally set when trying
to match the selector, not only when it matches.
BUG=435481, 100559, 435534
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=186043
Patch Set 1 #Patch Set 2 : Null-ptr checks and bug-fixes #
Total comments: 1
Patch Set 3 : Added :only-child test #Patch Set 4 : Fixed assert #
Total comments: 2
Messages
Total messages: 16 (4 generated)
|