Use separate style resolver for user agent shadow trees
[WebKit-https.git] / Source / WebCore / ChangeLog
index d3df5e7..da653de 100644 (file)
@@ -1,3 +1,114 @@
+2015-09-29  Antti Koivisto  <antti@apple.com>
+
+        Use separate style resolver for user agent shadow trees
+        https://bugs.webkit.org/show_bug.cgi?id=149626
+
+        Reviewed by Andreas Kling.
+
+        We now support separate style resolvers for shadow trees. Use this mechanism to have a separate
+        per-document style resolver for user agent shadow trees. This isolates user agent shadow trees
+        from author style better and simplifies the style resolver. It can also avoid some unnecessary style recalcs.
+
+        * css/DocumentRuleSets.cpp:
+        (WebCore::DocumentRuleSets::resetAuthorStyle):
+        (WebCore::DocumentRuleSets::appendAuthorStyleSheets):
+
+            Change interface so that only the new rules are provided.
+
+        * css/DocumentRuleSets.h:
+        * css/ElementRuleCollector.cpp:
+        (WebCore::ElementRuleCollector::addElementStyleProperties):
+        (WebCore::ElementRuleCollector::collectMatchingRules):
+
+            We can remove special bailout as shadow tree style resolver won't have other author style
+
+        (WebCore::ElementRuleCollector::sortAndTransferMatchedRules):
+
+            Remove the exception that disables property whitelists for UA stylesheets. We don't seem to use the feature.
+
+        (WebCore::ElementRuleCollector::matchUARules):
+        (WebCore::MatchingUARulesScope::MatchingUARulesScope): Deleted.
+        (WebCore::MatchingUARulesScope::~MatchingUARulesScope): Deleted.
+        (WebCore::MatchingUARulesScope::isMatchingUARules): Deleted.
+
+            Remove this unnecessary hack.
+
+        * css/ElementRuleCollector.h:
+        (WebCore::ElementRuleCollector::ElementRuleCollector):
+        * css/RuleSet.cpp:
+        (WebCore::RuleSet::addStyleRule):
+        (WebCore::RuleSet::copyShadowPseudoElementRulesFrom):
+
+            Also copy WebVTT rules. They are currently a sort of mixture of UA and author shadow tree.
+
+        (WebCore::shrinkMapVectorsToFit):
+        * css/RuleSet.h:
+        (WebCore::RuleData::containsUncommonAttributeSelector):
+        (WebCore::RuleData::linkMatchType):
+        (WebCore::RuleData::hasDocumentSecurityOrigin):
+        (WebCore::RuleData::propertyWhitelistType):
+        (WebCore::RuleData::descendantSelectorIdentifierHashes):
+        (WebCore::RuleSet::ruleCount):
+        (WebCore::RuleSet::hasShadowPseudoElementRules):
+        * css/StyleInvalidationAnalysis.cpp:
+        (WebCore::StyleInvalidationAnalysis::StyleInvalidationAnalysis):
+        (WebCore::StyleInvalidationAnalysis::invalidateIfNeeded):
+
+            Don't invalidate the whole tree when author shadow pseudo element rules change. Just invalidate the shadow trees.
+
+        (WebCore::StyleInvalidationAnalysis::invalidateStyleForTree):
+        (WebCore::StyleInvalidationAnalysis::invalidateStyle):
+        (WebCore::invalidateIfNeeded): Deleted.
+        (WebCore::invalidateStyleForTree): Deleted.
+        * css/StyleInvalidationAnalysis.h:
+        (WebCore::StyleInvalidationAnalysis::dirtiesAllStyle):
+        (WebCore::StyleInvalidationAnalysis::hasShadowPseudoElementRulesInAuthorSheet):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::MatchResult::addMatchedProperties):
+        (WebCore::StyleResolver::StyleResolver):
+        (WebCore::StyleResolver::appendAuthorStyleSheets):
+
+            Simpler interface.
+
+        * css/StyleResolver.h:
+        (WebCore::StyleResolver::document):
+        (WebCore::StyleResolver::documentSettings):
+        (WebCore::StyleResolver::ruleSets):
+        * dom/AuthorStyleSheets.cpp:
+        (WebCore::AuthorStyleSheets::collectActiveStyleSheets):
+        (WebCore::AuthorStyleSheets::analyzeStyleSheetChange):
+
+            Cleanups.
+
+        (WebCore::filterEnabledNonemptyCSSStyleSheets):
+        (WebCore::AuthorStyleSheets::updateActiveStyleSheets):
+        (WebCore::AuthorStyleSheets::updateStyleResolver):
+
+            Factor to a function.
+            Copy any author shadow pseudo elements to user agent shadow tree resolver.
+
+        (WebCore::AuthorStyleSheets::activeStyleSheetsForInspector):
+        * dom/AuthorStyleSheets.h:
+        * dom/Document.cpp:
+        (WebCore::Document::createStyleResolver):
+        (WebCore::Document::userAgentShadowTreeStyleResolver):
+
+            Use separate resolver.
+
+        (WebCore::Document::fontsNeedUpdate):
+        (WebCore::Document::clearStyleResolver):
+        * dom/Document.h:
+        (WebCore::Document::ensureStyleResolver):
+        * dom/ShadowRoot.cpp:
+        (WebCore::ShadowRoot::styleResolver):
+
+            Return document-global shadow tree resolver for ua trees.
+
+        * style/StyleResolveTree.cpp:
+        (WebCore::Style::resolveShadowTree):
+
+            Take styleChange of shadow root into account.
+
 2015-09-30  Gwang Yoon Hwang  <yoon@igalia.com>
 
         [GTK] Support HiDPI Properly in WebKitGtk+ with the TextureMapper