Turn static DocumentRuleSets::s_isInvalidatingStyleWithRuleSets assertion bit into...
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Sep 2019 15:52:43 +0000 (15:52 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Sep 2019 15:52:43 +0000 (15:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=201985
<rdar://problem/54851871>

Reviewed by Zalan Bujtas.

This assert bit was catching cases that are not dangerous. Turn it into a member to narrow the scope.

* css/DocumentRuleSets.cpp:
(WebCore::DocumentRuleSets::~DocumentRuleSets):
(WebCore::DocumentRuleSets::collectFeatures const):
(): Deleted.
* css/DocumentRuleSets.h:
(WebCore::DocumentRuleSets::isInvalidatingStyleWithRuleSets):
* style/AttributeChangeInvalidation.cpp:
(WebCore::Style::AttributeChangeInvalidation::invalidateStyleWithRuleSets):
* style/ClassChangeInvalidation.cpp:
(WebCore::Style::ClassChangeInvalidation::invalidateStyleWithRuleSets):

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

Source/WebCore/ChangeLog
Source/WebCore/css/DocumentRuleSets.cpp
Source/WebCore/css/DocumentRuleSets.h
Source/WebCore/style/AttributeChangeInvalidation.cpp
Source/WebCore/style/ClassChangeInvalidation.cpp

index 6090f49..a1e3b70 100644 (file)
@@ -1,3 +1,24 @@
+2019-09-19  Antti Koivisto  <antti@apple.com>
+
+        Turn static DocumentRuleSets::s_isInvalidatingStyleWithRuleSets assertion bit into a member
+        https://bugs.webkit.org/show_bug.cgi?id=201985
+        <rdar://problem/54851871>
+
+        Reviewed by Zalan Bujtas.
+
+        This assert bit was catching cases that are not dangerous. Turn it into a member to narrow the scope.
+
+        * css/DocumentRuleSets.cpp:
+        (WebCore::DocumentRuleSets::~DocumentRuleSets):
+        (WebCore::DocumentRuleSets::collectFeatures const):
+        (): Deleted.
+        * css/DocumentRuleSets.h:
+        (WebCore::DocumentRuleSets::isInvalidatingStyleWithRuleSets):
+        * style/AttributeChangeInvalidation.cpp:
+        (WebCore::Style::AttributeChangeInvalidation::invalidateStyleWithRuleSets):
+        * style/ClassChangeInvalidation.cpp:
+        (WebCore::Style::ClassChangeInvalidation::invalidateStyleWithRuleSets):
+
 2019-09-19  Zalan Bujtas  <zalan@apple.com>
 
         [LFC] Remove redundant Layout::Box::ElementTypes
index 82b7fcc..ba192f7 100644 (file)
@@ -37,9 +37,6 @@
 
 namespace WebCore {
 
-// For catching <rdar://problem/53413013>
-bool DocumentRuleSets::s_isInvalidatingStyleWithRuleSets { false };
-
 DocumentRuleSets::DocumentRuleSets(StyleResolver& styleResolver)
     : m_styleResolver(styleResolver)
 {
@@ -49,7 +46,7 @@ DocumentRuleSets::DocumentRuleSets(StyleResolver& styleResolver)
 
 DocumentRuleSets::~DocumentRuleSets()
 {
-    RELEASE_ASSERT(!s_isInvalidatingStyleWithRuleSets);
+    RELEASE_ASSERT(!m_isInvalidatingStyleWithRuleSets);
 }
 
 RuleSet* DocumentRuleSets::userAgentMediaQueryStyle() const
@@ -154,7 +151,7 @@ void DocumentRuleSets::appendAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet
 
 void DocumentRuleSets::collectFeatures() const
 {
-    RELEASE_ASSERT(!s_isInvalidatingStyleWithRuleSets);
+    RELEASE_ASSERT(!m_isInvalidatingStyleWithRuleSets);
 
     m_features.clear();
     // Collect all ids and rules using sibling selectors (:first-child and similar)
index cd9c858..46d8a1a 100644 (file)
@@ -76,7 +76,7 @@ public:
 
     RuleFeatureSet& mutableFeatures();
 
-    static bool s_isInvalidatingStyleWithRuleSets;
+    bool& isInvalidatingStyleWithRuleSets() { return m_isInvalidatingStyleWithRuleSets; }
 
 private:
     void collectFeatures() const;
@@ -102,6 +102,9 @@ private:
     bool m_usesSharedUserStyle { false };
     bool m_isForShadowScope { false };
     bool m_isAuthorStyleDefined { false };
+
+    // For catching <rdar://problem/53413013>
+    bool m_isInvalidatingStyleWithRuleSets { false };
 };
 
 inline const RuleFeatureSet& DocumentRuleSets::features() const
index 6cd4905..4834fd0 100644 (file)
@@ -89,7 +89,7 @@ void AttributeChangeInvalidation::invalidateStyle(const QualifiedName& attribute
 
 void AttributeChangeInvalidation::invalidateStyleWithRuleSets()
 {
-    SetForScope<bool> isInvalidating(DocumentRuleSets::s_isInvalidatingStyleWithRuleSets, true);
+    SetForScope<bool> isInvalidating(m_element.styleResolver().ruleSets().isInvalidatingStyleWithRuleSets(), true);
 
     for (auto* invalidationRuleSet : m_invalidationRuleSets) {
         Invalidator invalidator(*invalidationRuleSet->ruleSet);
index 216b22c..83aa9cf 100644 (file)
@@ -120,7 +120,7 @@ void ClassChangeInvalidation::computeInvalidation(const SpaceSplitString& oldCla
 
 void ClassChangeInvalidation::invalidateStyleWithRuleSets()
 {
-    SetForScope<bool> isInvalidating(DocumentRuleSets::s_isInvalidatingStyleWithRuleSets, true);
+    SetForScope<bool> isInvalidating(m_element.styleResolver().ruleSets().isInvalidatingStyleWithRuleSets(), true);
 
     for (auto* invalidationRuleSet : m_invalidationRuleSets) {
         Invalidator invalidator(*invalidationRuleSet->ruleSet);