Invalidate style for sibling combinators accurately on class change
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Feb 2018 09:01:01 +0000 (09:01 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Feb 2018 09:01:01 +0000 (09:01 +0000)
commit56435d9aa3b748024356ceb681d917f27091cfde
tree73fc0950f3276d0c4e28fd2aa89fd54274a83264
parent70f70005de33a72fcea88bf37fae4cb095ed1a39
Invalidate style for sibling combinators accurately on class change
https://bugs.webkit.org/show_bug.cgi?id=182336

Reviewed by Zalan Bujtas.

Source/WebCore:

Use Style::Invalidator to invalidate only those elements that may be affected by a class
change for sibling combinators and nth pseudo classes.

* css/RuleFeature.cpp:

Add new AllSiblings MatchElement to use for nth pseudo classes with subselectors.

(WebCore::isSiblingOrSubject):

Add a helper.

(WebCore::RuleFeatureSet::computeNextMatchElement):
(WebCore::RuleFeatureSet::computeSubSelectorMatchElement):

Compute and propage MatchElement::AllSiblings.

* css/RuleFeature.h:
* dom/Node.cpp:
(WebCore::Node::updateAncestorsForStyleRecalc):

Don't need to test for childrenAffectedByPropertyBasedBackwardPositionalRules anymore (an oddly named bit for nth pseudo classes).

* style/StyleInvalidator.cpp:
(WebCore::Style::Invalidator::invalidateStyleWithMatchElement):

Invalidate only the potentially affected elements.
The old code would just unconditionally invalidate the current element. This would propagate to descedants of siblings via
affectedByPreviousSibling bits. That mechanism can be removed when everything has been switched to accurate invalidation.

LayoutTests:

Adapt to progressions.

* fast/css/direct-adjacent-style-update-optimization-expected.txt:
* fast/css/direct-adjacent-style-update-optimization.html:
* fast/css/indirect-adjacent-style-update-optimization-expected.txt:
* fast/css/indirect-adjacent-style-update-optimization.html:
* fast/css/nth-last-child-of-style-update-optimization.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227956 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/css/direct-adjacent-style-update-optimization-expected.txt
LayoutTests/fast/css/direct-adjacent-style-update-optimization.html
LayoutTests/fast/css/indirect-adjacent-style-update-optimization-expected.txt
LayoutTests/fast/css/indirect-adjacent-style-update-optimization.html
LayoutTests/fast/css/nth-last-child-of-style-update-optimization.html
Source/WebCore/ChangeLog
Source/WebCore/css/RuleFeature.cpp
Source/WebCore/css/RuleFeature.h
Source/WebCore/dom/Node.cpp
Source/WebCore/style/StyleInvalidator.cpp