Use selector filter when invalidating descendants
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Feb 2018 06:09:13 +0000 (06:09 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Feb 2018 06:09:13 +0000 (06:09 +0000)
commitc62343c2067d7111a8b478e61f344dccd9caf64f
tree9edd1b0d2da39b4dd825580e3e49c5c3f2824032
parent2ea8a4991aac210eee196c92bb6562f41fc8200d
Use selector filter when invalidating descendants
https://bugs.webkit.org/show_bug.cgi?id=182839
<rdar://problem/37581072>

Reviewed by Zalan Bujtas.

We can make descendant invalidation faster by enabling filtering.

* css/SelectorFilter.cpp:
(WebCore::SelectorFilter::initializeParentStack):

    Traverse and reverse the ancestor chain, and push it.

(WebCore::SelectorFilter::pushParent):
(WebCore::SelectorFilter::pushParentInitializingIfNeeded):

    Add a version of pushParent that can initialize the stack.

(WebCore::SelectorFilter::popParent):
(WebCore::SelectorFilter::popParentsUntil):

    Pop until a given parent element.

(WebCore::SelectorFilter::pushParentStackFrame): Deleted.
(WebCore::SelectorFilter::popParentStackFrame): Deleted.

    These were the same as push/popParent.

* css/SelectorFilter.h:
(WebCore::SelectorFilter::popParent): Deleted.
* style/StyleInvalidator.cpp:
(WebCore::Style::Invalidator::invalidateStyleForDescendants):

    Use pushParentInitializingIfNeeded.

(WebCore::Style::Invalidator::invalidateStyleWithMatchElement):

    Use selector filter when doing descendant tree invalidation.
    Make sure to pop it until the parent when reusing.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228729 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/css/SelectorFilter.cpp
Source/WebCore/css/SelectorFilter.h
Source/WebCore/style/StyleInvalidator.cpp