Unreviewed, rolling out r216069.
authorryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 May 2017 16:22:53 +0000 (16:22 +0000)
committerryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 May 2017 16:22:53 +0000 (16:22 +0000)
This change broke the build.

Reverted changeset:

"Document style resolvers should share user rulesets"
https://bugs.webkit.org/show_bug.cgi?id=171549
http://trac.webkit.org/changeset/216069

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

Source/WebCore/ChangeLog
Source/WebCore/css/DocumentRuleSets.cpp
Source/WebCore/css/DocumentRuleSets.h
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/style/StyleScope.cpp

index 63e2944..c123f5f 100644 (file)
@@ -1,3 +1,15 @@
+2017-05-02  Ryan Haddad  <ryanhaddad@apple.com>
+
+        Unreviewed, rolling out r216069.
+
+        This change broke the build.
+
+        Reverted changeset:
+
+        "Document style resolvers should share user rulesets"
+        https://bugs.webkit.org/show_bug.cgi?id=171549
+        http://trac.webkit.org/changeset/216069
+
 2017-05-02  Antti Koivisto  <antti@apple.com>
 
         Document style resolvers should share user rulesets
index 3efb3a0..b7cefd3 100644 (file)
@@ -37,8 +37,7 @@
 
 namespace WebCore {
 
-DocumentRuleSets::DocumentRuleSets(StyleResolver& styleResolver)
-    : m_styleResolver(styleResolver)
+DocumentRuleSets::DocumentRuleSets()
 {
     m_authorStyle = std::make_unique<RuleSet>();
     m_authorStyle->disableAutoShrinkToFit();
@@ -48,13 +47,6 @@ DocumentRuleSets::~DocumentRuleSets()
 {
 }
 
-RuleSet* DocumentRuleSets::userStyle() const
-{
-    if (m_usesSharedUserStyle)
-        return m_styleResolver.document().styleScope().resolver().ruleSets().userStyle();
-    return m_userStyle.get();
-}
-
 void DocumentRuleSets::initUserStyle(ExtensionStyleSheets& extensionStyleSheets, const MediaQueryEvaluator& medium, StyleResolver& resolver)
 {
     auto tempUserStyle = std::make_unique<RuleSet>();
@@ -120,8 +112,8 @@ void DocumentRuleSets::collectFeatures() const
 
     if (m_authorStyle)
         m_features.add(m_authorStyle->features());
-    if (auto* userStyle = this->userStyle())
-        m_features.add(userStyle->features());
+    if (m_userStyle)
+        m_features.add(m_userStyle->features());
 
     m_siblingRuleSet = makeRuleSet(m_features.siblingRules);
     m_uncommonAttributeRuleSet = makeRuleSet(m_features.uncommonAttributeRules);
index 1d8f14c..7cdb889 100644 (file)
@@ -40,12 +40,12 @@ class MediaQueryEvaluator;
 
 class DocumentRuleSets {
 public:
-    DocumentRuleSets(StyleResolver&);
+    DocumentRuleSets();
     ~DocumentRuleSets();
-
+    
     bool isAuthorStyleDefined() const { return m_isAuthorStyleDefined; }
     RuleSet& authorStyle() const { return *m_authorStyle.get(); }
-    RuleSet* userStyle() const;
+    RuleSet* userStyle() const { return m_userStyle.get(); }
     const RuleFeatureSet& features() const;
     RuleSet* sibling() const { return m_siblingRuleSet.get(); }
     RuleSet* uncommonAttribute() const { return m_uncommonAttributeRuleSet.get(); }
@@ -59,9 +59,7 @@ public:
     };
     const AttributeRules* ancestorAttributeRulesForHTML(const AtomicString&) const;
 
-    void setUsesSharedUserStyle(bool b) { m_usesSharedUserStyle = true; }
     void initUserStyle(ExtensionStyleSheets&, const MediaQueryEvaluator&, StyleResolver&);
-
     void resetAuthorStyle();
     void appendAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet>>&, MediaQueryEvaluator*, InspectorCSSOMWrappers&, StyleResolver*);
 
@@ -74,9 +72,7 @@ private:
     bool m_isAuthorStyleDefined { false };
     std::unique_ptr<RuleSet> m_authorStyle;
     std::unique_ptr<RuleSet> m_userStyle;
-    bool m_usesSharedUserStyle { false };
 
-    StyleResolver& m_styleResolver;
     mutable RuleFeatureSet m_features;
     mutable unsigned m_defaultStyleVersionOnFeatureCollection { 0 };
     mutable std::unique_ptr<RuleSet> m_siblingRuleSet;
index 4a3b9f4..a33dc71 100644 (file)
@@ -228,8 +228,7 @@ void StyleResolver::MatchResult::addMatchedProperties(const StyleProperties& pro
 }
 
 StyleResolver::StyleResolver(Document& document)
-    : m_ruleSets(*this)
-    , m_matchedPropertiesCacheAdditionsSinceLastSweep(0)
+    : m_matchedPropertiesCacheAdditionsSinceLastSweep(0)
     , m_matchedPropertiesCacheSweepTimer(*this, &StyleResolver::sweepMatchedPropertiesCache)
     , m_document(document)
     , m_matchAuthorAndUserStyles(m_document.settings().authorAndUserStylesEnabled())
@@ -268,6 +267,8 @@ StyleResolver::StyleResolver(Document& document)
 
     m_ruleSets.resetAuthorStyle();
 
+    m_ruleSets.initUserStyle(m_document.extensionStyleSheets(), m_mediaQueryEvaluator, *this);
+
 #if ENABLE(SVG_FONTS)
     if (m_document.svgExtensions()) {
         const HashSet<SVGFontFaceElement*>& svgFontFaceElements = m_document.svgExtensions()->svgFontFaceElements();
@@ -277,11 +278,6 @@ StyleResolver::StyleResolver(Document& document)
 #endif
 }
 
-void StyleResolver::initializeUserStyle()
-{
-    m_ruleSets.initUserStyle(m_document.extensionStyleSheets(), m_mediaQueryEvaluator, *this);
-}
-
 void StyleResolver::appendAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet>>& styleSheets)
 {
     m_ruleSets.appendAuthorStyleSheets(styleSheets, &m_mediaQueryEvaluator, m_inspectorCSSOMWrappers, this);
index 995919d..4ac4bf1 100644 (file)
@@ -152,7 +152,6 @@ public:
     const Document& document() const { return m_document; }
     const Settings& settings() const { return m_document.settings(); }
 
-    void initializeUserStyle();
     void appendAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet>>&);
 
     DocumentRuleSets& ruleSets() { return m_ruleSets; }
index 6896751..4282fa4 100644 (file)
@@ -96,12 +96,6 @@ StyleResolver& Scope::resolver()
     if (!m_resolver) {
         SetForScope<bool> isUpdatingStyleResolver { m_isUpdatingStyleResolver, true };
         m_resolver = std::make_unique<StyleResolver>(m_document);
-
-        if (!m_shadowRoot)
-            m_resolver->initializeUserStyle();
-        else if (m_shadowRoot->mode() != ShadowRootMode::UserAgent)
-            m_resolver->ruleSets().setUsesSharedUserStyle();
-
         m_resolver->appendAuthorStyleSheets(m_activeStyleSheets);
     }
     ASSERT(!m_shadowRoot || &m_document == &m_shadowRoot->document());