Title: [198553] trunk/Source/WebCore
Revision
198553
Author
[email protected]
Date
2016-03-22 14:31:16 -0700 (Tue, 22 Mar 2016)

Log Message

Non-const DocumentRuleSets::features() does not check default style version
https://bugs.webkit.org/show_bug.cgi?id=155766

Reviewed by Andreas Kling.

This may leave it out of date when the default stylesheet expands.

No test, don't know how to hit this with current codebase. With some further optimizations
it starts affecting some tests involving UA media control stylesheets.

* css/DocumentRuleSets.h:
(WebCore::DocumentRuleSets::mutableFeatures):

    Check the default style version number in non-const case too.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (198552 => 198553)


--- trunk/Source/WebCore/ChangeLog	2016-03-22 21:28:43 UTC (rev 198552)
+++ trunk/Source/WebCore/ChangeLog	2016-03-22 21:31:16 UTC (rev 198553)
@@ -1,3 +1,20 @@
+2016-03-22  Antti Koivisto  <[email protected]>
+
+        Non-const DocumentRuleSets::features() does not check default style version
+        https://bugs.webkit.org/show_bug.cgi?id=155766
+
+        Reviewed by Andreas Kling.
+
+        This may leave it out of date when the default stylesheet expands.
+
+        No test, don't know how to hit this with current codebase. With some further optimizations
+        it starts affecting some tests involving UA media control stylesheets.
+
+        * css/DocumentRuleSets.h:
+        (WebCore::DocumentRuleSets::mutableFeatures):
+
+            Check the default style version number in non-const case too.
+
 2016-03-22  Daniel Bates  <[email protected]>
 
         CSP: Should only execute <script> or apply <style> if its hash appears in all policies

Modified: trunk/Source/WebCore/css/DocumentRuleSets.h (198552 => 198553)


--- trunk/Source/WebCore/css/DocumentRuleSets.h	2016-03-22 21:28:43 UTC (rev 198552)
+++ trunk/Source/WebCore/css/DocumentRuleSets.h	2016-03-22 21:31:16 UTC (rev 198553)
@@ -46,7 +46,6 @@
     ~DocumentRuleSets();
     RuleSet* authorStyle() const { return m_authorStyle.get(); }
     RuleSet* userStyle() const { return m_userStyle.get(); }
-    RuleFeatureSet& features() { return m_features; }
     const RuleFeatureSet& features() const;
     RuleSet* sibling() const { return m_siblingRuleSet.get(); }
     RuleSet* uncommonAttribute() const { return m_uncommonAttributeRuleSet.get(); }
@@ -62,6 +61,8 @@
     void resetAuthorStyle();
     void appendAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet>>&, MediaQueryEvaluator*, InspectorCSSOMWrappers&, StyleResolver*);
 
+    RuleFeatureSet& mutableFeatures();
+
 private:
     void collectFeatures() const;
     void collectRulesFromUserStyleSheets(const Vector<RefPtr<CSSStyleSheet>>&, RuleSet& userStyle, const MediaQueryEvaluator&, StyleResolver&);
@@ -84,6 +85,14 @@
     return m_features;
 }
 
+// FIXME: There should be just the const version.
+inline RuleFeatureSet& DocumentRuleSets::mutableFeatures()
+{
+    if (m_defaultStyleVersionOnFeatureCollection < CSSDefaultStyleSheets::defaultStyleVersion)
+        collectFeatures();
+    return m_features;
+}
+
 } // namespace WebCore
 
 #endif // DocumentRuleSets_h

Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (198552 => 198553)


--- trunk/Source/WebCore/css/StyleBuilderCustom.h	2016-03-22 21:28:43 UTC (rev 198552)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h	2016-03-22 21:31:16 UTC (rev 198553)
@@ -1345,8 +1345,8 @@
             styleResolver.style()->setContent(value.isNull() ? emptyAtom : value.impl(), didSet);
             didSet = true;
             // Register the fact that the attribute value affects the style.
-            styleResolver.ruleSets().features().attributeCanonicalLocalNamesInRules.add(attr.localName().impl());
-            styleResolver.ruleSets().features().attributeLocalNamesInRules.add(attr.localName().impl());
+            styleResolver.ruleSets().mutableFeatures().attributeCanonicalLocalNamesInRules.add(attr.localName().impl());
+            styleResolver.ruleSets().mutableFeatures().attributeLocalNamesInRules.add(attr.localName().impl());
         } else if (contentValue.isCounter()) {
             Counter* counterValue = contentValue.getCounterValue();
             EListStyleType listStyleType = NoneListStyle;
@@ -1715,8 +1715,8 @@
         styleResolver.style()->setContentAltText(value.isNull() ? emptyAtom : value);
 
         // Register the fact that the attribute value affects the style.
-        styleResolver.ruleSets().features().attributeCanonicalLocalNamesInRules.add(attr.localName().impl());
-        styleResolver.ruleSets().features().attributeLocalNamesInRules.add(attr.localName().impl());
+        styleResolver.ruleSets().mutableFeatures().attributeCanonicalLocalNamesInRules.add(attr.localName().impl());
+        styleResolver.ruleSets().mutableFeatures().attributeLocalNamesInRules.add(attr.localName().impl());
     } else
         styleResolver.style()->setContentAltText(emptyAtom);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to