Enable selector filtering for ::before and ::after pseudo element resolution
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Dec 2017 20:31:35 +0000 (20:31 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Dec 2017 20:31:35 +0000 (20:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180364

Reviewed by Ryosuke Niwa.

Since these pseudo elements are now resolved by TreeResolver we can use selector filter for them.

This is 10%+ progression in StyleBench pseudo element subtest.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::pseudoStyleForElement):
* css/StyleResolver.h:
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolvePseudoStyle):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225485 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/style/StyleTreeResolver.cpp

index d25f9c7..f4c756a 100644 (file)
@@ -1,3 +1,20 @@
+2017-12-04  Antti Koivisto  <antti@apple.com>
+
+        Enable selector filtering for ::before and ::after pseudo element resolution
+        https://bugs.webkit.org/show_bug.cgi?id=180364
+
+        Reviewed by Ryosuke Niwa.
+
+        Since these pseudo elements are now resolved by TreeResolver we can use selector filter for them.
+
+        This is 10%+ progression in StyleBench pseudo element subtest.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::pseudoStyleForElement):
+        * css/StyleResolver.h:
+        * style/StyleTreeResolver.cpp:
+        (WebCore::Style::TreeResolver::resolvePseudoStyle):
+
 2017-12-04  Youenn Fablet  <youenn@apple.com>
 
         Add support https://w3c.github.io/ServiceWorker/#on-client-unload-algorithm
index 5c79812..5e28ad7 100644 (file)
@@ -552,9 +552,9 @@ void StyleResolver::keyframeStylesForAnimation(const Element& element, const Ren
     }
 }
 
-std::unique_ptr<RenderStyle> StyleResolver::pseudoStyleForElement(const Element& element, const PseudoStyleRequest& pseudoStyleRequest, const RenderStyle& parentStyle)
+std::unique_ptr<RenderStyle> StyleResolver::pseudoStyleForElement(const Element& element, const PseudoStyleRequest& pseudoStyleRequest, const RenderStyle& parentStyle, const SelectorFilter* selectorFilter)
 {
-    m_state = State(element, &parentStyle);
+    m_state = State(element, &parentStyle, m_overrideDocumentElementStyle, selectorFilter);
 
     State& state = m_state;
 
index 25dae94..738b050 100644 (file)
@@ -133,7 +133,7 @@ public:
 
     void keyframeStylesForAnimation(const Element&, const RenderStyle*, KeyframeList&);
 
-    std::unique_ptr<RenderStyle> pseudoStyleForElement(const Element&, const PseudoStyleRequest&, const RenderStyle& parentStyle);
+    std::unique_ptr<RenderStyle> pseudoStyleForElement(const Element&, const PseudoStyleRequest&, const RenderStyle& parentStyle, const SelectorFilter* = nullptr);
 
     std::unique_ptr<RenderStyle> styleForPage(int pageIndex);
     std::unique_ptr<RenderStyle> defaultStyleForElement();
index 13df9b4..333e42a 100644 (file)
@@ -233,7 +233,7 @@ ElementUpdate TreeResolver::resolvePseudoStyle(Element& element, const ElementUp
     if (!elementUpdate.style->hasPseudoStyle(pseudoId))
         return { };
 
-    auto pseudoStyle = scope().styleResolver.pseudoStyleForElement(element, { pseudoId }, *elementUpdate.style);
+    auto pseudoStyle = scope().styleResolver.pseudoStyleForElement(element, { pseudoId }, *elementUpdate.style, &scope().selectorFilter);
     if (!pseudoStyle)
         return { };