Move StyleResolver to Style namespace
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Nov 2019 17:37:15 +0000 (17:37 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Nov 2019 17:37:15 +0000 (17:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=204294

Reviewed by Zalan Bujtas.

Most subparts are already in Style namespace.

Also rename it to Style::Resolver and move files to WebCore/style subdirectory.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::updateBlendingKeyframes):
* css/DOMCSSRegisterCustomProperty.cpp:
(WebCore::DOMCSSRegisterCustomProperty::registerProperty):
* css/DocumentRuleSets.cpp:
(WebCore::DocumentRuleSets::DocumentRuleSets):
(WebCore::DocumentRuleSets::collectRulesFromUserStyleSheets):
(WebCore::DocumentRuleSets::appendAuthorStyleSheets):
* css/DocumentRuleSets.h:
* css/MediaQueryEvaluator.cpp:
(WebCore::MediaQueryEvaluator::evaluate const):
* css/MediaQueryEvaluator.h:
* css/PageRuleCollector.h:
(WebCore::PageRuleCollector::PageRuleCollector):
* css/RuleSet.cpp:
(WebCore::RuleSet::addChildRules):
(WebCore::RuleSet::addRulesFromSheet):
* css/RuleSet.h:
* dom/Document.cpp:
(WebCore::Document::userAgentShadowTreeStyleResolver):
* dom/Document.h:
* dom/Element.cpp:
(WebCore::Element::styleResolver):
(WebCore::Element::resolveStyle):
(WebCore::Element::resolveCustomStyle):
* dom/Element.h:
* editing/EditingStyle.cpp:
(WebCore::EditingStyle::mergeStyleFromRules):
(WebCore::EditingStyle::removeStyleFromRulesAndContext):
(WebCore::EditingStyle::removePropertiesInElementDefaultStyle):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::focusedOrActiveStateChanged):
* html/shadow/SliderThumbElement.cpp:
(WebCore::SliderThumbElement::resolveCustomStyle):
(WebCore::SliderContainerElement::resolveCustomStyle):
* html/shadow/SliderThumbElement.h:
* html/shadow/TextControlInnerElements.cpp:
(WebCore::TextControlInnerContainer::resolveCustomStyle):
(WebCore::TextControlInnerElement::resolveCustomStyle):
(WebCore::TextControlInnerTextElement::resolveCustomStyle):
(WebCore::TextControlPlaceholderElement::resolveCustomStyle):
* html/shadow/TextControlInnerElements.h:
* inspector/agents/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::getMatchedStylesForNode):
(WebCore::InspectorCSSAgent::buildObjectForRule):
(WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):
* inspector/agents/InspectorCSSAgent.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::getMatchedCSSRules const):
* page/Page.cpp:
(WebCore::Page::updateStyleAfterChangeInEnvironment):
* page/animation/CompositeAnimation.cpp:
(WebCore::CompositeAnimation::animate):
* rendering/RenderTheme.h:
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresLayerRepaint const):
* rendering/style/RenderStyle.h:
* style/StyleResolver.cpp: Renamed from Source/WebCore/css/StyleResolver.cpp.
(WebCore::Style::Resolver::Resolver):
(WebCore::Style::Resolver::addCurrentSVGFontFaceRules):
(WebCore::Style::Resolver::appendAuthorStyleSheets):
(WebCore::Style::Resolver::addKeyframeStyle):
(WebCore::Style::Resolver::~Resolver):
(WebCore::Style::Resolver::State::State):
(WebCore::Style::Resolver::State::setStyle):
(WebCore::Style::Resolver::State::setParentStyle):
(WebCore::Style::Resolver::builderContext):
(WebCore::Style::Resolver::styleForElement):
(WebCore::Style::Resolver::styleForKeyframe):
(WebCore::Style::Resolver::isAnimationNameValid):
(WebCore::Style::Resolver::keyframeStylesForAnimation):
(WebCore::Style::Resolver::pseudoStyleForElement):
(WebCore::Style::Resolver::styleForPage):
(WebCore::Style::Resolver::defaultStyleForElement):
(WebCore::Style::Resolver::styleRulesForElement):
(WebCore::Style::Resolver::pseudoStyleRulesForElement):
(WebCore::Style::Resolver::invalidateMatchedDeclarationsCache):
(WebCore::Style::Resolver::clearCachedDeclarationsAffectedByViewportUnits):
(WebCore::Style::Resolver::applyMatchedProperties):
(WebCore::Style::Resolver::addViewportDependentMediaQueryResult):
(WebCore::Style::Resolver::hasMediaQueriesAffectedByViewportChange const):
(WebCore::Style::Resolver::addAccessibilitySettingsDependentMediaQueryResult):
(WebCore::Style::Resolver::hasMediaQueriesAffectedByAccessibilitySettingsChange const):
(WebCore::Style::Resolver::addAppearanceDependentMediaQueryResult):
(WebCore::Style::Resolver::hasMediaQueriesAffectedByAppearanceChange const):
* style/StyleResolver.h: Renamed from Source/WebCore/css/StyleResolver.h.
(WebCore::Style::ElementStyle::ElementStyle):
(WebCore::Style::Resolver::hasSelectorForAttribute const):
(WebCore::Style::Resolver::hasSelectorForId const):
* style/StyleScope.cpp:
(WebCore::Style::Scope::resolver):
(WebCore::Style::Scope::resolverIfExists):
(WebCore::Style::Scope::analyzeStyleSheetChange):
(WebCore::Style::invalidateHostAndSlottedStyleIfNeeded):
(WebCore::Style::Scope::updateActiveStyleSheets):
(WebCore::Style::Scope::updateResolver):
(WebCore::Style::Scope::scheduleUpdate):
(WebCore::Style::Scope::evaluateMediaQueriesForViewportChange):
(WebCore::Style::Scope::evaluateMediaQueriesForAccessibilitySettingsChange):
(WebCore::Style::Scope::evaluateMediaQueriesForAppearanceChange):
(WebCore::Style::Scope::updateStyleResolver): Deleted.
* style/StyleScope.h:
* style/StyleSharingResolver.cpp:
(WebCore::Style::elementHasDirectionAuto):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::Scope::Scope):
(WebCore::Style::TreeResolver::Scope::~Scope):
(WebCore::Style::TreeResolver::styleForElement):
(WebCore::Style::TreeResolver::resolveElement):
(WebCore::Style::TreeResolver::resolvePseudoStyle):
(WebCore::Style::TreeResolver::resolve):
* style/StyleTreeResolver.h:
* svg/SVGElement.cpp:
(WebCore::SVGElement::resolveCustomStyle):
* svg/SVGElement.h:

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

39 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/animation/KeyframeEffect.cpp
Source/WebCore/css/DOMCSSRegisterCustomProperty.cpp
Source/WebCore/css/DocumentRuleSets.cpp
Source/WebCore/css/DocumentRuleSets.h
Source/WebCore/css/MediaQueryEvaluator.cpp
Source/WebCore/css/MediaQueryEvaluator.h
Source/WebCore/css/PageRuleCollector.h
Source/WebCore/css/RuleSet.cpp
Source/WebCore/css/RuleSet.h
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/html/shadow/SliderThumbElement.cpp
Source/WebCore/html/shadow/SliderThumbElement.h
Source/WebCore/html/shadow/TextControlInnerElements.cpp
Source/WebCore/html/shadow/TextControlInnerElements.h
Source/WebCore/inspector/agents/InspectorCSSAgent.cpp
Source/WebCore/inspector/agents/InspectorCSSAgent.h
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/page/animation/CompositeAnimation.cpp
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/style/StyleResolver.cpp [moved from Source/WebCore/css/StyleResolver.cpp with 82% similarity]
Source/WebCore/style/StyleResolver.h [moved from Source/WebCore/css/StyleResolver.h with 87% similarity]
Source/WebCore/style/StyleScope.cpp
Source/WebCore/style/StyleScope.h
Source/WebCore/style/StyleSharingResolver.cpp
Source/WebCore/style/StyleTreeResolver.cpp
Source/WebCore/style/StyleTreeResolver.h
Source/WebCore/svg/SVGElement.cpp
Source/WebCore/svg/SVGElement.h

index 2d96946..de59aba 100644 (file)
@@ -1,3 +1,132 @@
+2019-11-18  Antti Koivisto  <antti@apple.com>
+
+        Move StyleResolver to Style namespace
+        https://bugs.webkit.org/show_bug.cgi?id=204294
+
+        Reviewed by Zalan Bujtas.
+
+        Most subparts are already in Style namespace.
+
+        Also rename it to Style::Resolver and move files to WebCore/style subdirectory.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * animation/KeyframeEffect.cpp:
+        (WebCore::KeyframeEffect::updateBlendingKeyframes):
+        * css/DOMCSSRegisterCustomProperty.cpp:
+        (WebCore::DOMCSSRegisterCustomProperty::registerProperty):
+        * css/DocumentRuleSets.cpp:
+        (WebCore::DocumentRuleSets::DocumentRuleSets):
+        (WebCore::DocumentRuleSets::collectRulesFromUserStyleSheets):
+        (WebCore::DocumentRuleSets::appendAuthorStyleSheets):
+        * css/DocumentRuleSets.h:
+        * css/MediaQueryEvaluator.cpp:
+        (WebCore::MediaQueryEvaluator::evaluate const):
+        * css/MediaQueryEvaluator.h:
+        * css/PageRuleCollector.h:
+        (WebCore::PageRuleCollector::PageRuleCollector):
+        * css/RuleSet.cpp:
+        (WebCore::RuleSet::addChildRules):
+        (WebCore::RuleSet::addRulesFromSheet):
+        * css/RuleSet.h:
+        * dom/Document.cpp:
+        (WebCore::Document::userAgentShadowTreeStyleResolver):
+        * dom/Document.h:
+        * dom/Element.cpp:
+        (WebCore::Element::styleResolver):
+        (WebCore::Element::resolveStyle):
+        (WebCore::Element::resolveCustomStyle):
+        * dom/Element.h:
+        * editing/EditingStyle.cpp:
+        (WebCore::EditingStyle::mergeStyleFromRules):
+        (WebCore::EditingStyle::removeStyleFromRulesAndContext):
+        (WebCore::EditingStyle::removePropertiesInElementDefaultStyle):
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::focusedOrActiveStateChanged):
+        * html/shadow/SliderThumbElement.cpp:
+        (WebCore::SliderThumbElement::resolveCustomStyle):
+        (WebCore::SliderContainerElement::resolveCustomStyle):
+        * html/shadow/SliderThumbElement.h:
+        * html/shadow/TextControlInnerElements.cpp:
+        (WebCore::TextControlInnerContainer::resolveCustomStyle):
+        (WebCore::TextControlInnerElement::resolveCustomStyle):
+        (WebCore::TextControlInnerTextElement::resolveCustomStyle):
+        (WebCore::TextControlPlaceholderElement::resolveCustomStyle):
+        * html/shadow/TextControlInnerElements.h:
+        * inspector/agents/InspectorCSSAgent.cpp:
+        (WebCore::InspectorCSSAgent::getMatchedStylesForNode):
+        (WebCore::InspectorCSSAgent::buildObjectForRule):
+        (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):
+        * inspector/agents/InspectorCSSAgent.h:
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::getMatchedCSSRules const):
+        * page/Page.cpp:
+        (WebCore::Page::updateStyleAfterChangeInEnvironment):
+        * page/animation/CompositeAnimation.cpp:
+        (WebCore::CompositeAnimation::animate):
+        * rendering/RenderTheme.h:
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::changeRequiresLayerRepaint const):
+        * rendering/style/RenderStyle.h:
+        * style/StyleResolver.cpp: Renamed from Source/WebCore/css/StyleResolver.cpp.
+        (WebCore::Style::Resolver::Resolver):
+        (WebCore::Style::Resolver::addCurrentSVGFontFaceRules):
+        (WebCore::Style::Resolver::appendAuthorStyleSheets):
+        (WebCore::Style::Resolver::addKeyframeStyle):
+        (WebCore::Style::Resolver::~Resolver):
+        (WebCore::Style::Resolver::State::State):
+        (WebCore::Style::Resolver::State::setStyle):
+        (WebCore::Style::Resolver::State::setParentStyle):
+        (WebCore::Style::Resolver::builderContext):
+        (WebCore::Style::Resolver::styleForElement):
+        (WebCore::Style::Resolver::styleForKeyframe):
+        (WebCore::Style::Resolver::isAnimationNameValid):
+        (WebCore::Style::Resolver::keyframeStylesForAnimation):
+        (WebCore::Style::Resolver::pseudoStyleForElement):
+        (WebCore::Style::Resolver::styleForPage):
+        (WebCore::Style::Resolver::defaultStyleForElement):
+        (WebCore::Style::Resolver::styleRulesForElement):
+        (WebCore::Style::Resolver::pseudoStyleRulesForElement):
+        (WebCore::Style::Resolver::invalidateMatchedDeclarationsCache):
+        (WebCore::Style::Resolver::clearCachedDeclarationsAffectedByViewportUnits):
+        (WebCore::Style::Resolver::applyMatchedProperties):
+        (WebCore::Style::Resolver::addViewportDependentMediaQueryResult):
+        (WebCore::Style::Resolver::hasMediaQueriesAffectedByViewportChange const):
+        (WebCore::Style::Resolver::addAccessibilitySettingsDependentMediaQueryResult):
+        (WebCore::Style::Resolver::hasMediaQueriesAffectedByAccessibilitySettingsChange const):
+        (WebCore::Style::Resolver::addAppearanceDependentMediaQueryResult):
+        (WebCore::Style::Resolver::hasMediaQueriesAffectedByAppearanceChange const):
+        * style/StyleResolver.h: Renamed from Source/WebCore/css/StyleResolver.h.
+        (WebCore::Style::ElementStyle::ElementStyle):
+        (WebCore::Style::Resolver::hasSelectorForAttribute const):
+        (WebCore::Style::Resolver::hasSelectorForId const):
+        * style/StyleScope.cpp:
+        (WebCore::Style::Scope::resolver):
+        (WebCore::Style::Scope::resolverIfExists):
+        (WebCore::Style::Scope::analyzeStyleSheetChange):
+        (WebCore::Style::invalidateHostAndSlottedStyleIfNeeded):
+        (WebCore::Style::Scope::updateActiveStyleSheets):
+        (WebCore::Style::Scope::updateResolver):
+        (WebCore::Style::Scope::scheduleUpdate):
+        (WebCore::Style::Scope::evaluateMediaQueriesForViewportChange):
+        (WebCore::Style::Scope::evaluateMediaQueriesForAccessibilitySettingsChange):
+        (WebCore::Style::Scope::evaluateMediaQueriesForAppearanceChange):
+        (WebCore::Style::Scope::updateStyleResolver): Deleted.
+        * style/StyleScope.h:
+        * style/StyleSharingResolver.cpp:
+        (WebCore::Style::elementHasDirectionAuto):
+        * style/StyleTreeResolver.cpp:
+        (WebCore::Style::TreeResolver::Scope::Scope):
+        (WebCore::Style::TreeResolver::Scope::~Scope):
+        (WebCore::Style::TreeResolver::styleForElement):
+        (WebCore::Style::TreeResolver::resolveElement):
+        (WebCore::Style::TreeResolver::resolvePseudoStyle):
+        (WebCore::Style::TreeResolver::resolve):
+        * style/StyleTreeResolver.h:
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::resolveCustomStyle):
+        * svg/SVGElement.h:
+        
 2019-11-18  Chris Dumez  <cdumez@apple.com>
 
         REGRESSION (r252497): Multiple mediacapturefromelement tests are crashing on mac debug
index c275227..4c0093b 100644 (file)
@@ -780,7 +780,6 @@ css/StyleColor.cpp
 css/StyleMedia.cpp
 css/StyleProperties.cpp
 css/StylePropertyShorthand.cpp
-css/StyleResolver.cpp
 css/StyleRule.cpp
 css/StyleRuleImport.cpp
 css/StyleSheet.cpp
@@ -2356,6 +2355,7 @@ style/StyleFontSizeFunctions.cpp
 style/StyleInvalidator.cpp
 style/StylePendingResources.cpp
 style/StyleRelations.cpp
+style/StyleResolver.cpp
 style/StyleResolveForDocument.cpp
 style/StyleScope.cpp
 style/StyleSharingResolver.cpp
index 672e992..2cd7632 100644 (file)
                                E461802C1C8DD2900026C02C /* StyleRelations.h */,
                                E4D58EB217B4DBDC00CBDCA8 /* StyleResolveForDocument.cpp */,
                                E4D58EB317B4DBDC00CBDCA8 /* StyleResolveForDocument.h */,
+                               E139866115478474001E3F65 /* StyleResolver.cpp */,
+                               E139866215478474001E3F65 /* StyleResolver.h */,
                                E461D65C1BB0C7F000CB5645 /* StyleScope.cpp */,
                                E461D65E1BB0C80D00CB5645 /* StyleScope.h */,
                                E47A3AC21C5EABBE00CCBFA7 /* StyleSharingResolver.cpp */,
                                A80E6DFA0A199067007FB8C5 /* StyleProperties.h */,
                                E1B25104152A0BAF0069B779 /* StylePropertyShorthand.cpp */,
                                E1B25105152A0BAF0069B779 /* StylePropertyShorthand.h */,
-                               E139866115478474001E3F65 /* StyleResolver.cpp */,
-                               E139866215478474001E3F65 /* StyleResolver.h */,
                                E4BBED4A14FCDBA1003F0B98 /* StyleRule.cpp */,
                                E4BBED4B14FCDBA1003F0B98 /* StyleRule.h */,
                                E4946EAC156E64DD00D3297F /* StyleRuleImport.cpp */,
index 86590d1..27ca94b 100644 (file)
@@ -741,7 +741,7 @@ void KeyframeEffect::updateBlendingKeyframes(RenderStyle& elementStyle)
         return;
 
     KeyframeList keyframeList("keyframe-effect-" + createCanonicalUUIDString());
-    StyleResolver& styleResolver = m_target->styleResolver();
+    auto& styleResolver = m_target->styleResolver();
 
     for (auto& keyframe : m_parsedKeyframes) {
         KeyframeValue keyframeValue(keyframe.computedOffset, nullptr);
index 42f80ab..d461864 100644 (file)
@@ -48,7 +48,7 @@ ExceptionOr<void> DOMCSSRegisterCustomProperty::registerProperty(Document& docum
     RefPtr<CSSCustomPropertyValue> initialValue;
     if (!descriptor.initialValue.isEmpty()) {
         CSSTokenizer tokenizer(descriptor.initialValue);
-        StyleResolver styleResolver(document);
+        Style::Resolver styleResolver(document);
 
         // We need to initialize this so that we can successfully parse computationally dependent values (like em units).
         // We don't actually need the values to be accurate, since they will be rejected later anyway
index ba192f7..a84d7e6 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace WebCore {
 
-DocumentRuleSets::DocumentRuleSets(StyleResolver& styleResolver)
+DocumentRuleSets::DocumentRuleSets(Style::Resolver& styleResolver)
     : m_styleResolver(styleResolver)
 {
     m_authorStyle = makeUnique<RuleSet>();
@@ -102,7 +102,7 @@ void DocumentRuleSets::initializeUserStyle()
         m_userStyle = WTFMove(tempUserStyle);
 }
 
-void DocumentRuleSets::collectRulesFromUserStyleSheets(const Vector<RefPtr<CSSStyleSheet>>& userSheets, RuleSet& userStyle, const MediaQueryEvaluator& medium, StyleResolver& resolver)
+void DocumentRuleSets::collectRulesFromUserStyleSheets(const Vector<RefPtr<CSSStyleSheet>>& userSheets, RuleSet& userStyle, const MediaQueryEvaluator& medium, Style::Resolver& resolver)
 {
     for (unsigned i = 0; i < userSheets.size(); ++i) {
         ASSERT(userSheets[i]->contents().isUserStyleSheet());
@@ -134,7 +134,7 @@ void DocumentRuleSets::resetUserAgentMediaQueryStyle()
     m_userAgentMediaQueryStyle = nullptr;
 }
 
-void DocumentRuleSets::appendAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet>>& styleSheets, MediaQueryEvaluator* medium, InspectorCSSOMWrappers& inspectorCSSOMWrappers, StyleResolver* resolver)
+void DocumentRuleSets::appendAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet>>& styleSheets, MediaQueryEvaluator* medium, InspectorCSSOMWrappers& inspectorCSSOMWrappers, Style::Resolver* resolver)
 {
     // This handles sheets added to the end of the stylesheet list only. In other cases the style resolver
     // needs to be reconstructed. To handle insertions too the rule order numbers would need to be updated.
index 46d8a1a..e9a756a 100644 (file)
@@ -38,6 +38,10 @@ class ExtensionStyleSheets;
 class InspectorCSSOMWrappers;
 class MediaQueryEvaluator;
 
+namespace Style {
+class Resolver;
+}
+
 struct InvalidationRuleSet {
     MatchElement matchElement;
     std::unique_ptr<RuleSet> ruleSet;
@@ -48,7 +52,7 @@ struct InvalidationRuleSet {
 
 class DocumentRuleSets {
 public:
-    DocumentRuleSets(StyleResolver&);
+    DocumentRuleSets(Style::Resolver&);
     ~DocumentRuleSets();
 
     bool isAuthorStyleDefined() const { return m_isAuthorStyleDefined; }
@@ -70,7 +74,7 @@ public:
     void initializeUserStyle();
 
     void resetAuthorStyle();
-    void appendAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet>>&, MediaQueryEvaluator*, InspectorCSSOMWrappers&, StyleResolver*);
+    void appendAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet>>&, MediaQueryEvaluator*, InspectorCSSOMWrappers&, Style::Resolver*);
 
     void resetUserAgentMediaQueryStyle();
 
@@ -80,14 +84,14 @@ public:
 
 private:
     void collectFeatures() const;
-    void collectRulesFromUserStyleSheets(const Vector<RefPtr<CSSStyleSheet>>&, RuleSet& userStyle, const MediaQueryEvaluator&, StyleResolver&);
+    void collectRulesFromUserStyleSheets(const Vector<RefPtr<CSSStyleSheet>>&, RuleSet& userStyle, const MediaQueryEvaluator&, Style::Resolver&);
     void updateUserAgentMediaQueryStyleIfNeeded() const;
 
     std::unique_ptr<RuleSet> m_authorStyle;
     mutable std::unique_ptr<RuleSet> m_userAgentMediaQueryStyle;
     std::unique_ptr<RuleSet> m_userStyle;
 
-    StyleResolver& m_styleResolver;
+    Style::Resolver& m_styleResolver;
     mutable RuleFeatureSet m_features;
     mutable std::unique_ptr<RuleSet> m_siblingRuleSet;
     mutable std::unique_ptr<RuleSet> m_uncommonAttributeRuleSet;
index 686cf0a..4115c42 100644 (file)
@@ -146,7 +146,7 @@ static bool applyRestrictor(MediaQuery::Restrictor r, bool value)
     return r == MediaQuery::Not ? !value : value;
 }
 
-bool MediaQueryEvaluator::evaluate(const MediaQuerySet& querySet, StyleResolver* styleResolver) const
+bool MediaQueryEvaluator::evaluate(const MediaQuerySet& querySet, Style::Resolver* styleResolver) const
 {
     LOG_WITH_STREAM(MediaQueries, stream << "MediaQueryEvaluator::evaluate on " << (m_document ? m_document->url().string() : emptyString()));
 
index db1b718..5a2ecdb 100644 (file)
@@ -36,7 +36,10 @@ class Document;
 class Frame;
 class MediaQuerySet;
 class RenderStyle;
-class StyleResolver;
+
+namespace Style {
+class Resolver;
+}
 
 struct MediaQueryResult {
     MediaQueryExpression expression;
@@ -63,7 +66,7 @@ public:
     bool mediaTypeMatchSpecific(const char* mediaTypeToMatch) const;
 
     // Evaluates a list of media queries.
-    WEBCORE_EXPORT bool evaluate(const MediaQuerySet&, StyleResolver* = nullptr) const;
+    WEBCORE_EXPORT bool evaluate(const MediaQuerySet&, Style::Resolver* = nullptr) const;
 
     // Evaluates media query subexpression, ie "and (media-feature: value)" part.
     bool evaluate(const MediaQueryExpression&) const;
index ce46d1c..6272fd7 100644 (file)
@@ -31,7 +31,7 @@ class StyleRulePage;
 
 class PageRuleCollector {
 public:
-    PageRuleCollector(StyleResolver::State& state, DocumentRuleSets& ruleSets)
+    PageRuleCollector(Style::Resolver::State& state, DocumentRuleSets& ruleSets)
         : m_state(state)
         , m_ruleSets(ruleSets) { }
 
@@ -47,7 +47,7 @@ private:
     void matchPageRules(RuleSet* rules, bool isLeftPage, bool isFirstPage, const String& pageName);
     void matchPageRulesForList(Vector<StyleRulePage*>& matchedRules, const Vector<StyleRulePage*>& rules, bool isLeftPage, bool isFirstPage, const String& pageName);
 
-    const StyleResolver::State& m_state;
+    const Style::Resolver::State& m_state;
     DocumentRuleSets& m_ruleSets;
 
     MatchResult m_result;
index 6acac33..8ec1c4d 100644 (file)
@@ -384,7 +384,7 @@ void RuleSet::addPageRule(StyleRulePage* rule)
     m_pageRules.append(rule);
 }
 
-void RuleSet::addChildRules(const Vector<RefPtr<StyleRuleBase>>& rules, const MediaQueryEvaluator& medium, StyleResolver* resolver, bool isInitiatingElementInUserAgentShadowTree)
+void RuleSet::addChildRules(const Vector<RefPtr<StyleRuleBase>>& rules, const MediaQueryEvaluator& medium, Style::Resolver* resolver, bool isInitiatingElementInUserAgentShadowTree)
 {
     for (auto& rule : rules) {
         if (is<StyleRule>(*rule))
@@ -411,7 +411,7 @@ void RuleSet::addChildRules(const Vector<RefPtr<StyleRuleBase>>& rules, const Me
     }
 }
 
-void RuleSet::addRulesFromSheet(StyleSheetContents& sheet, const MediaQueryEvaluator& medium, StyleResolver* resolver)
+void RuleSet::addRulesFromSheet(StyleSheetContents& sheet, const MediaQueryEvaluator& medium, Style::Resolver* resolver)
 {
     for (auto& rule : sheet.importRules()) {
         if (rule->styleSheet() && (!rule->mediaQueries() || medium.evaluate(*rule->mediaQueries(), resolver)))
index 6355e93..6180c49 100644 (file)
@@ -44,9 +44,12 @@ class CSSSelector;
 class ContainerNode;
 class MediaQueryEvaluator;
 class Node;
-class StyleResolver;
 class StyleSheetContents;
 
+namespace Style {
+class Resolver;
+}
+
 enum class MatchBasedOnRuleHash : unsigned {
     None,
     Universal,
@@ -117,7 +120,7 @@ public:
     typedef Vector<RuleData, 1> RuleDataVector;
     typedef HashMap<AtomString, std::unique_ptr<RuleDataVector>> AtomRuleMap;
 
-    void addRulesFromSheet(StyleSheetContents&, const MediaQueryEvaluator&, StyleResolver* = 0);
+    void addRulesFromSheet(StyleSheetContents&, const MediaQueryEvaluator&, Style::Resolver* = 0);
 
     void addStyleRule(StyleRule*);
     void addRule(StyleRule*, unsigned selectorIndex, unsigned selectorListIndex);
@@ -150,7 +153,7 @@ public:
     bool hasHostPseudoClassRulesMatchingInShadowTree() const { return m_hasHostPseudoClassRulesMatchingInShadowTree; }
 
 private:
-    void addChildRules(const Vector<RefPtr<StyleRuleBase>>&, const MediaQueryEvaluator& medium, StyleResolver*, bool isInitiatingElementInUserAgentShadowTree);
+    void addChildRules(const Vector<RefPtr<StyleRuleBase>>&, const MediaQueryEvaluator& medium, Style::Resolver*, bool isInitiatingElementInUserAgentShadowTree);
 
     AtomRuleMap m_idRules;
     AtomRuleMap m_classRules;
index acd58cd..67ee039 100644 (file)
@@ -2286,10 +2286,10 @@ void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
     marginLeft = style->marginLeft().isAuto() ? marginLeft : intValueForLength(style->marginLeft(), width);
 }
 
-StyleResolver& Document::userAgentShadowTreeStyleResolver()
+Style::Resolver& Document::userAgentShadowTreeStyleResolver()
 {
     if (!m_userAgentShadowTreeStyleResolver)
-        m_userAgentShadowTreeStyleResolver = makeUnique<StyleResolver>(*this);
+        m_userAgentShadowTreeStyleResolver = makeUnique<Style::Resolver>(*this);
     return *m_userAgentShadowTreeStyleResolver;
 }
 
index 7ae7e37..3824221 100644 (file)
@@ -193,7 +193,6 @@ class SelectorQueryCache;
 class SerializedScriptValue;
 class Settings;
 class StringCallback;
-class StyleResolver;
 class StyleSheet;
 class StyleSheetContents;
 class StyleSheetList;
@@ -264,6 +263,7 @@ class ResizeObserver;
 #endif
 
 namespace Style {
+class Resolver;
 class Scope;
 };
 
@@ -540,7 +540,7 @@ public:
 
     bool sawElementsInKnownNamespaces() const { return m_sawElementsInKnownNamespaces; }
 
-    StyleResolver& userAgentShadowTreeStyleResolver();
+    Style::Resolver& userAgentShadowTreeStyleResolver();
 
     CSSFontSelector& fontSelector() { return m_fontSelector; }
 
@@ -1679,7 +1679,7 @@ private:
 
     UniqueRef<Quirks> m_quirks;
 
-    std::unique_ptr<StyleResolver> m_userAgentShadowTreeStyleResolver;
+    std::unique_ptr<Style::Resolver> m_userAgentShadowTreeStyleResolver;
 
     RefPtr<DOMWindow> m_domWindow;
     WeakPtr<Document> m_contextDocument;
index 8e30cfa..c9463b1 100644 (file)
@@ -1894,7 +1894,7 @@ bool Element::allowsDoubleTapGesture() const
 }
 #endif
 
-StyleResolver& Element::styleResolver()
+Style::Resolver& Element::styleResolver()
 {
     if (auto* shadowRoot = containingShadowRoot())
         return shadowRoot->styleScope().resolver();
@@ -1902,7 +1902,7 @@ StyleResolver& Element::styleResolver()
     return document().styleScope().resolver();
 }
 
-ElementStyle Element::resolveStyle(const RenderStyle* parentStyle)
+Style::ElementStyle Element::resolveStyle(const RenderStyle* parentStyle)
 {
     return styleResolver().styleForElement(*this, parentStyle);
 }
@@ -4089,7 +4089,7 @@ void Element::didDetachRenderers()
     ASSERT(hasCustomStyleResolveCallbacks());
 }
 
-Optional<ElementStyle> Element::resolveCustomStyle(const RenderStyle&, const RenderStyle*)
+Optional<Style::ElementStyle> Element::resolveCustomStyle(const RenderStyle&, const RenderStyle*)
 {
     ASSERT(hasCustomStyleResolveCallbacks());
     return WTF::nullopt;
index 366c036..d5e71e6 100644 (file)
@@ -58,7 +58,6 @@ class PseudoElement;
 class RenderTreePosition;
 class StylePropertyMap;
 class WebAnimation;
-struct ElementStyle;
 struct ScrollIntoViewOptions;
 
 #if ENABLE(INTERSECTION_OBSERVER)
@@ -69,6 +68,10 @@ struct IntersectionObserverData;
 struct ResizeObserverData;
 #endif
 
+namespace Style {
+struct ElementStyle;
+}
+
 enum SpellcheckAttributeState {
     SpellcheckAttributeTrue,
     SpellcheckAttributeFalse,
@@ -541,7 +544,7 @@ public:
     virtual void didAttachRenderers();
     virtual void willDetachRenderers();
     virtual void didDetachRenderers();
-    virtual Optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle);
+    virtual Optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle);
 
     LayoutRect absoluteEventHandlerBounds(bool& includesFixedPositionElements) override;
 
@@ -562,8 +565,8 @@ public:
     bool allowsDoubleTapGesture() const override;
 #endif
 
-    StyleResolver& styleResolver();
-    ElementStyle resolveStyle(const RenderStyle* parentStyle);
+    Style::Resolver& styleResolver();
+    Style::ElementStyle resolveStyle(const RenderStyle* parentStyle);
 
     // Invalidates the style of a single element. Style is resolved lazily.
     // Descendant elements are resolved as needed, for example if an inherited property changes.
index a14881f..0888d12 100644 (file)
@@ -1272,7 +1272,7 @@ static Ref<MutableStyleProperties> styleFromMatchedRulesForElement(Element& elem
 void EditingStyle::mergeStyleFromRules(StyledElement& element)
 {
     RefPtr<MutableStyleProperties> styleFromMatchedRules = styleFromMatchedRulesForElement(element,
-        StyleResolver::AuthorCSSRules);
+        Style::Resolver::AuthorCSSRules);
     // Styles from the inline style declaration, held in the variable "style", take precedence 
     // over those from matched rules.
     if (m_mutableStyle)
@@ -1358,7 +1358,7 @@ void EditingStyle::removeStyleFromRulesAndContext(StyledElement& element, Node*
         return;
 
     // 1. Remove style from matched rules because style remain without repeating it in inline style declaration
-    RefPtr<MutableStyleProperties> styleFromMatchedRules = styleFromMatchedRulesForElement(element, StyleResolver::AllButEmptyCSSRules);
+    RefPtr<MutableStyleProperties> styleFromMatchedRules = styleFromMatchedRulesForElement(element, Style::Resolver::AllButEmptyCSSRules);
     if (styleFromMatchedRules && !styleFromMatchedRules->isEmpty())
         m_mutableStyle = getPropertiesNotIn(*m_mutableStyle, *styleFromMatchedRules);
 
@@ -1387,7 +1387,7 @@ void EditingStyle::removePropertiesInElementDefaultStyle(Element& element)
     if (!m_mutableStyle || m_mutableStyle->isEmpty())
         return;
 
-    RefPtr<MutableStyleProperties> defaultStyle = styleFromMatchedRulesForElement(element, StyleResolver::UAAndUserCSSRules);
+    RefPtr<MutableStyleProperties> defaultStyle = styleFromMatchedRulesForElement(element, Style::Resolver::UAAndUserCSSRules);
 
     removePropertiesInStyle(m_mutableStyle.get(), defaultStyle.get());
 }
index 74fa64b..8ae1625 100644 (file)
@@ -2064,7 +2064,7 @@ void FrameSelection::focusedOrActiveStateChanged()
         setSelectionFromNone();
     setCaretVisibility(activeAndFocused ? Visible : Hidden);
 
-    // Because StyleResolver::checkOneSelector() and
+    // Because Style::Resolver::checkOneSelector() and
     // RenderTheme::isFocused() check if the frame is active, we have to
     // update style and theme state that depended on those.
     if (Element* element = document->focusedElement()) {
index f23adba..92a7e21 100644 (file)
@@ -590,7 +590,7 @@ RefPtr<HTMLInputElement> SliderThumbElement::hostInput() const
     return downcast<HTMLInputElement>(shadowHost());
 }
 
-Optional<ElementStyle> SliderThumbElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* hostStyle)
+Optional<Style::ElementStyle> SliderThumbElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* hostStyle)
 {
     // This doesn't actually compute style. This is just a hack to pick shadow pseudo id when host style is known.
 
@@ -644,7 +644,7 @@ RenderPtr<RenderElement> SliderContainerElement::createElementRenderer(RenderSty
     return createRenderer<RenderSliderContainer>(*this, WTFMove(style));
 }
 
-Optional<ElementStyle> SliderContainerElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* hostStyle)
+Optional<Style::ElementStyle> SliderContainerElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* hostStyle)
 {
     // This doesn't actually compute style. This is just a hack to pick shadow pseudo id when host style is known.
 
index b018b98..8420b00 100644 (file)
@@ -77,7 +77,7 @@ private:
 #endif
     void willDetachRenderers() final;
 
-    Optional<ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) final;
+    Optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) final;
     const AtomString& shadowPseudoId() const final;
 
     void startDragging();
@@ -136,7 +136,7 @@ public:
 private:
     SliderContainerElement(Document&);
     RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) final;
-    Optional<ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) final;
+    Optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle&, const RenderStyle*) final;
     const AtomString& shadowPseudoId() const final;
     bool isSliderContainerElement() const final { return true; }
 
index 43932e4..55c0c33 100644 (file)
@@ -80,7 +80,7 @@ static inline bool isStrongPasswordTextField(const Element* element)
     return is<HTMLInputElement>(element) && downcast<HTMLInputElement>(element)->hasAutoFillStrongPasswordButton();
 }
 
-Optional<ElementStyle> TextControlInnerContainer::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*)
+Optional<Style::ElementStyle> TextControlInnerContainer::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*)
 {
     auto elementStyle = resolveStyle(&parentStyle);
     if (isStrongPasswordTextField(shadowHost())) {
@@ -102,7 +102,7 @@ Ref<TextControlInnerElement> TextControlInnerElement::create(Document& document)
     return adoptRef(*new TextControlInnerElement(document));
 }
 
-Optional<ElementStyle> TextControlInnerElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* shadowHostStyle)
+Optional<Style::ElementStyle> TextControlInnerElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* shadowHostStyle)
 {
     auto newStyle = RenderStyle::createPtr();
     newStyle->inheritFrom(*shadowHostStyle);
@@ -127,7 +127,7 @@ Optional<ElementStyle> TextControlInnerElement::resolveCustomStyle(const RenderS
         newStyle->setFlexBasis(Length { pixels, Fixed });
     }
 
-    return ElementStyle { WTFMove(newStyle) };
+    return { WTFMove(newStyle) };
 }
 
 // MARK: TextControlInnerTextElement
@@ -171,10 +171,10 @@ RenderTextControlInnerBlock* TextControlInnerTextElement::renderer() const
     return downcast<RenderTextControlInnerBlock>(HTMLDivElement::renderer());
 }
 
-Optional<ElementStyle> TextControlInnerTextElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* shadowHostStyle)
+Optional<Style::ElementStyle> TextControlInnerTextElement::resolveCustomStyle(const RenderStyle&, const RenderStyle* shadowHostStyle)
 {
     auto style = downcast<HTMLTextFormControlElement>(*shadowHost()).createInnerTextStyle(*shadowHostStyle);
-    return ElementStyle(makeUnique<RenderStyle>(WTFMove(style)));
+    return { makeUnique<RenderStyle>(WTFMove(style)) };
 }
 
 // MARK: TextControlPlaceholderElement
@@ -191,7 +191,7 @@ Ref<TextControlPlaceholderElement> TextControlPlaceholderElement::create(Documen
     return adoptRef(*new TextControlPlaceholderElement(document));
 }
 
-Optional<ElementStyle> TextControlPlaceholderElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle)
+Optional<Style::ElementStyle> TextControlPlaceholderElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle)
 {
     auto style = resolveStyle(&parentStyle);
 
index 7f65839..9662959 100644 (file)
@@ -40,7 +40,7 @@ public:
 protected:
     TextControlInnerContainer(Document&);
     RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
-    Optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
+    Optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
 };
 
 class TextControlInnerElement final : public HTMLDivElement {
@@ -50,7 +50,7 @@ public:
 
 protected:
     TextControlInnerElement(Document&);
-    Optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
+    Optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
 
 private:
     bool isMouseFocusable() const override { return false; }
@@ -68,7 +68,7 @@ public:
 private:
     TextControlInnerTextElement(Document&);
     RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
-    Optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
+    Optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
     bool isMouseFocusable() const override { return false; }
     bool isTextControlInnerTextElement() const override { return true; }
 };
@@ -81,7 +81,7 @@ public:
 private:
     TextControlPlaceholderElement(Document&);
     
-    Optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
+    Optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
 };
 
 class SearchFieldResultsButtonElement final : public HTMLDivElement {
index 8f08d7a..47d5933 100644 (file)
@@ -480,8 +480,8 @@ void InspectorCSSAgent::getMatchedStylesForNode(ErrorString& errorString, int no
     }
 
     // Matched rules.
-    StyleResolver& styleResolver = element->styleResolver();
-    auto matchedRules = styleResolver.pseudoStyleRulesForElement(element, elementPseudoId, StyleResolver::AllCSSRules);
+    auto& styleResolver = element->styleResolver();
+    auto matchedRules = styleResolver.pseudoStyleRulesForElement(element, elementPseudoId, Style::Resolver::AllCSSRules);
     matchedCSSRules = buildArrayForMatchedRuleList(matchedRules, styleResolver, *element, elementPseudoId);
 
     if (!originalElement->isPseudoElement()) {
@@ -490,7 +490,7 @@ void InspectorCSSAgent::getMatchedStylesForNode(ErrorString& errorString, int no
             auto pseudoElements = JSON::ArrayOf<Inspector::Protocol::CSS::PseudoIdMatches>::create();
             for (PseudoId pseudoId = PseudoId::FirstPublicPseudoId; pseudoId < PseudoId::AfterLastInternalPseudoId; pseudoId = static_cast<PseudoId>(static_cast<unsigned>(pseudoId) + 1)) {
                 if (auto protocolPseudoId = protocolValueForPseudoId(pseudoId)) {
-                    auto matchedRules = styleResolver.pseudoStyleRulesForElement(element, pseudoId, StyleResolver::AllCSSRules);
+                    auto matchedRules = styleResolver.pseudoStyleRulesForElement(element, pseudoId, Style::Resolver::AllCSSRules);
                     if (!matchedRules.isEmpty()) {
                         auto matches = Inspector::Protocol::CSS::PseudoIdMatches::create()
                             .setPseudoId(protocolPseudoId.value())
@@ -509,8 +509,8 @@ void InspectorCSSAgent::getMatchedStylesForNode(ErrorString& errorString, int no
             auto entries = JSON::ArrayOf<Inspector::Protocol::CSS::InheritedStyleEntry>::create();
             Element* parentElement = element->parentElement();
             while (parentElement) {
-                StyleResolver& parentStyleResolver = parentElement->styleResolver();
-                auto parentMatchedRules = parentStyleResolver.styleRulesForElement(parentElement, StyleResolver::AllCSSRules);
+                auto& parentStyleResolver = parentElement->styleResolver();
+                auto parentMatchedRules = parentStyleResolver.styleRulesForElement(parentElement, Style::Resolver::AllCSSRules);
                 auto entry = Inspector::Protocol::CSS::InheritedStyleEntry::create()
                     .setMatchedCSSRules(buildArrayForMatchedRuleList(parentMatchedRules, styleResolver, *parentElement, PseudoId::None))
                     .release();
@@ -944,12 +944,12 @@ Inspector::Protocol::CSS::StyleSheetOrigin InspectorCSSAgent::detectOrigin(CSSSt
     return Inspector::Protocol::CSS::StyleSheetOrigin::Regular;
 }
 
-RefPtr<Inspector::Protocol::CSS::CSSRule> InspectorCSSAgent::buildObjectForRule(StyleRule* styleRule, StyleResolver& styleResolver, Element& element)
+RefPtr<Inspector::Protocol::CSS::CSSRule> InspectorCSSAgent::buildObjectForRule(StyleRule* styleRule, Style::Resolver& styleResolver, Element& element)
 {
     if (!styleRule)
         return nullptr;
 
-    // StyleRules returned by StyleResolver::styleRulesForElement lack parent pointers since that infomation is not cheaply available.
+    // StyleRules returned by Style::Resolver::styleRulesForElement lack parent pointers since that infomation is not cheaply available.
     // Since the inspector wants to walk the parent chain, we construct the full wrappers here.
     styleResolver.inspectorCSSOMWrappers().collectDocumentWrappers(styleResolver.document().extensionStyleSheets());
     styleResolver.inspectorCSSOMWrappers().collectScopeWrappers(Style::Scope::forNode(element));
@@ -976,7 +976,7 @@ RefPtr<Inspector::Protocol::CSS::CSSRule> InspectorCSSAgent::buildObjectForRule(
     return inspectorStyleSheet ? inspectorStyleSheet->buildObjectForRule(rule, nullptr) : nullptr;
 }
 
-RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::RuleMatch>> InspectorCSSAgent::buildArrayForMatchedRuleList(const Vector<RefPtr<StyleRule>>& matchedRules, StyleResolver& styleResolver, Element& element, PseudoId pseudoId)
+RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::RuleMatch>> InspectorCSSAgent::buildArrayForMatchedRuleList(const Vector<RefPtr<StyleRule>>& matchedRules, Style::Resolver& styleResolver, Element& element, PseudoId pseudoId)
 {
     auto result = JSON::ArrayOf<Inspector::Protocol::CSS::RuleMatch>::create();
 
index e43cb5b..6742ddf 100644 (file)
@@ -50,9 +50,12 @@ class Document;
 class Element;
 class Node;
 class NodeList;
-class StyleResolver;
 class StyleRule;
 
+namespace Style {
+class Resolver;
+}
+
 class InspectorCSSAgent final : public InspectorAgentBase , public Inspector::CSSBackendDispatcherHandler , public InspectorStyleSheet::Listener {
     WTF_MAKE_NONCOPYABLE(InspectorCSSAgent);
     WTF_MAKE_FAST_ALLOCATED;
@@ -142,9 +145,9 @@ private:
     InspectorStyleSheet* createInspectorStyleSheetForDocument(Document&);
     Inspector::Protocol::CSS::StyleSheetOrigin detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument);
 
-    RefPtr<Inspector::Protocol::CSS::CSSRule> buildObjectForRule(StyleRule*, StyleResolver&, Element&);
+    RefPtr<Inspector::Protocol::CSS::CSSRule> buildObjectForRule(StyleRule*, Style::Resolver&, Element&);
     RefPtr<Inspector::Protocol::CSS::CSSRule> buildObjectForRule(CSSStyleRule*);
-    RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::RuleMatch>> buildArrayForMatchedRuleList(const Vector<RefPtr<StyleRule>>&, StyleResolver&, Element&, PseudoId);
+    RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::RuleMatch>> buildArrayForMatchedRuleList(const Vector<RefPtr<StyleRule>>&, Style::Resolver&, Element&, PseudoId);
     RefPtr<Inspector::Protocol::CSS::CSSStyle> buildObjectForAttributesStyle(StyledElement&);
 
 
index 0ace9ec..494e097 100644 (file)
@@ -1525,9 +1525,9 @@ RefPtr<CSSRuleList> DOMWindow::getMatchedCSSRules(Element* element, const String
     auto* frame = this->frame();
     frame->document()->styleScope().flushPendingUpdate();
 
-    unsigned rulesToInclude = StyleResolver::AuthorCSSRules;
+    unsigned rulesToInclude = Style::Resolver::AuthorCSSRules;
     if (!authorOnly)
-        rulesToInclude |= StyleResolver::UAAndUserCSSRules;
+        rulesToInclude |= Style::Resolver::UAAndUserCSSRules;
 
     PseudoId pseudoId = CSSSelector::pseudoId(pseudoType);
 
index cf378b0..69c1df9 100644 (file)
@@ -570,7 +570,7 @@ void Page::initGroup()
 void Page::updateStyleAfterChangeInEnvironment()
 {
     forEachDocument([](Document& document) {
-        if (StyleResolver* styleResolver = document.styleScope().resolverIfExists())
+        if (auto* styleResolver = document.styleScope().resolverIfExists())
             styleResolver->invalidateMatchedDeclarationsCache();
         document.scheduleFullStyleRebuild();
         document.styleScope().didChangeStyleSheetEnvironment();
index e576293..ad86915 100644 (file)
@@ -304,7 +304,7 @@ AnimationUpdate CompositeAnimation::animate(Element& element, const RenderStyle*
         }
 
         if (animatedStyle && checkForStackingContext) {
-            // Note that this is similar to code in StyleResolver::adjustRenderStyle() but only needs to consult
+            // Note that this is similar to code in Style::Adjuster::adjust() but only needs to consult
             // animatable properties that can trigger stacking context.
             if (animatedStyle->opacity() < 1.0f
                 || animatedStyle->hasTransformRelatedProperty()
index 77a8c39..383a935 100644 (file)
@@ -45,7 +45,6 @@ class RenderMeter;
 class RenderObject;
 class RenderProgress;
 class RenderStyle;
-class StyleResolver;
 
 class RenderTheme {
 protected:
index 87c6ce4..9d83ef8 100644 (file)
@@ -981,7 +981,7 @@ static bool rareNonInheritedDataChangeRequiresLayerRepaint(const StyleRareNonInh
 
 bool RenderStyle::changeRequiresLayerRepaint(const RenderStyle& other, OptionSet<StyleDifferenceContextSensitiveProperty>& changedContextSensitiveProperties) const
 {
-    // StyleResolver has ensured that zIndex is non-auto only if it's applicable.
+    // Style::Resolver has ensured that zIndex is non-auto only if it's applicable.
     if (m_boxData->zIndex() != other.m_boxData->zIndex() || m_boxData->hasAutoZIndex() != other.m_boxData->hasAutoZIndex())
         return true;
 
index 3b50e80..58522bd 100644 (file)
@@ -113,7 +113,6 @@ class Pair;
 class ShadowData;
 class StyleImage;
 class StyleInheritedData;
-class StyleResolver;
 class StyleScrollSnapArea;
 class StyleScrollSnapPort;
 class TransformationMatrix;
similarity index 82%
rename from Source/WebCore/css/StyleResolver.cpp
rename to Source/WebCore/style/StyleResolver.cpp
index 6443ec3..aea1a0d 100644 (file)
 #include <wtf/text/AtomStringHash.h>
 
 namespace WebCore {
+namespace Style {
 
 using namespace HTMLNames;
 
-StyleResolver::StyleResolver(Document& document)
+Resolver::Resolver(Document& document)
     : m_ruleSets(*this)
     , m_document(document)
 #if ENABLE(CSS_DEVICE_ADAPTATION)
@@ -124,7 +125,7 @@ StyleResolver::StyleResolver(Document& document)
     m_ruleSets.resetUserAgentMediaQueryStyle();
 }
 
-void StyleResolver::addCurrentSVGFontFaceRules()
+void Resolver::addCurrentSVGFontFaceRules()
 {
 #if ENABLE(SVG_FONTS)
     if (m_document.svgExtensions()) {
@@ -135,7 +136,7 @@ void StyleResolver::addCurrentSVGFontFaceRules()
 #endif
 }
 
-void StyleResolver::appendAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet>>& styleSheets)
+void Resolver::appendAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet>>& styleSheets)
 {
     m_ruleSets.appendAuthorStyleSheets(styleSheets, &m_mediaQueryEvaluator, m_inspectorCSSOMWrappers, this);
 
@@ -148,13 +149,13 @@ void StyleResolver::appendAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet>>&
 }
 
 // This is a simplified style setting function for keyframe styles
-void StyleResolver::addKeyframeStyle(Ref<StyleRuleKeyframes>&& rule)
+void Resolver::addKeyframeStyle(Ref<StyleRuleKeyframes>&& rule)
 {
     AtomString s(rule->name());
     m_keyframesRuleMap.set(s.impl(), WTFMove(rule));
 }
 
-StyleResolver::~StyleResolver()
+Resolver::~Resolver()
 {
     RELEASE_ASSERT(!m_document.isResolvingTreeStyle());
     RELEASE_ASSERT(!m_isDeleted);
@@ -165,7 +166,7 @@ StyleResolver::~StyleResolver()
 #endif
 }
 
-StyleResolver::State::State(const Element& element, const RenderStyle* parentStyle, const RenderStyle* documentElementStyle)
+Resolver::State::State(const Element& element, const RenderStyle* parentStyle, const RenderStyle* documentElementStyle)
     : m_element(&element)
     , m_parentStyle(parentStyle)
 {
@@ -181,12 +182,12 @@ StyleResolver::State::State(const Element& element, const RenderStyle* parentSty
         m_rootElementStyle = documentElementStyle ? documentElementStyle : documentElement->renderStyle();
 }
 
-inline void StyleResolver::State::setStyle(std::unique_ptr<RenderStyle> style)
+inline void Resolver::State::setStyle(std::unique_ptr<RenderStyle> style)
 {
     m_style = WTFMove(style);
 }
 
-inline void StyleResolver::State::setParentStyle(std::unique_ptr<RenderStyle> parentStyle)
+inline void Resolver::State::setParentStyle(std::unique_ptr<RenderStyle> parentStyle)
 {
     m_ownedParentStyle = WTFMove(parentStyle);
     m_parentStyle = m_ownedParentStyle.get();
@@ -198,7 +199,7 @@ static inline bool isAtShadowBoundary(const Element& element)
     return parentNode && parentNode->isShadowRoot();
 }
 
-Style::BuilderContext StyleResolver::builderContext(const State& state)
+BuilderContext Resolver::builderContext(const State& state)
 {
     return {
         m_document,
@@ -208,7 +209,7 @@ Style::BuilderContext StyleResolver::builderContext(const State& state)
     };
 }
 
-ElementStyle StyleResolver::styleForElement(const Element& element, const RenderStyle* parentStyle, const RenderStyle* parentBoxStyle, RuleMatchingBehavior matchingBehavior, const SelectorFilter* selectorFilter)
+ElementStyle Resolver::styleForElement(const Element& element, const RenderStyle* parentStyle, const RenderStyle* parentBoxStyle, RuleMatchingBehavior matchingBehavior, const SelectorFilter* selectorFilter)
 {
     RELEASE_ASSERT(!m_isDeleted);
 
@@ -252,11 +253,11 @@ ElementStyle StyleResolver::styleForElement(const Element& element, const Render
     if (collector.didMatchUncommonAttributeSelector())
         style.setUnique();
 
-    auto elementStyleRelations = Style::commitRelationsToRenderStyle(style, element, collector.styleRelations());
+    auto elementStyleRelations = commitRelationsToRenderStyle(style, element, collector.styleRelations());
 
     applyMatchedProperties(state, collector.matchResult());
 
-    Style::Adjuster adjuster(document(), *state.parentStyle(), parentBoxStyle, &element);
+    Adjuster adjuster(document(), *state.parentStyle(), parentBoxStyle, &element);
     adjuster.adjust(*state.style(), state.userAgentAppearanceStyle());
 
     if (state.style()->hasViewportUnits())
@@ -265,7 +266,7 @@ ElementStyle StyleResolver::styleForElement(const Element& element, const Render
     return { state.takeStyle(), WTFMove(elementStyleRelations) };
 }
 
-std::unique_ptr<RenderStyle> StyleResolver::styleForKeyframe(const Element& element, const RenderStyle* elementStyle, const StyleRuleKeyframe* keyframe, KeyframeValue& keyframeValue)
+std::unique_ptr<RenderStyle> Resolver::styleForKeyframe(const Element& element, const RenderStyle* elementStyle, const StyleRuleKeyframe* keyframe, KeyframeValue& keyframeValue)
 {
     RELEASE_ASSERT(!m_isDeleted);
 
@@ -277,10 +278,10 @@ std::unique_ptr<RenderStyle> StyleResolver::styleForKeyframe(const Element& elem
     state.setStyle(RenderStyle::clonePtr(*elementStyle));
     state.setParentStyle(RenderStyle::clonePtr(*elementStyle));
 
-    Style::Builder builder(*state.style(), builderContext(state), result, { Style::CascadeLevel::Author });
+    Builder builder(*state.style(), builderContext(state), result, { CascadeLevel::Author });
     builder.applyAllProperties();
 
-    Style::Adjuster adjuster(document(), *state.parentStyle(), nullptr, nullptr);
+    Adjuster adjuster(document(), *state.parentStyle(), nullptr, nullptr);
     adjuster.adjust(*state.style(), state.userAgentAppearanceStyle());
 
     // Add all the animating properties to the keyframe.
@@ -296,12 +297,12 @@ std::unique_ptr<RenderStyle> StyleResolver::styleForKeyframe(const Element& elem
     return state.takeStyle();
 }
 
-bool StyleResolver::isAnimationNameValid(const String& name)
+bool Resolver::isAnimationNameValid(const String& name)
 {
     return m_keyframesRuleMap.find(AtomString(name).impl()) != m_keyframesRuleMap.end();
 }
 
-void StyleResolver::keyframeStylesForAnimation(const Element& element, const RenderStyle* elementStyle, KeyframeList& list)
+void Resolver::keyframeStylesForAnimation(const Element& element, const RenderStyle* elementStyle, KeyframeList& list)
 {
     list.clear();
 
@@ -397,7 +398,7 @@ void StyleResolver::keyframeStylesForAnimation(const Element& element, const Ren
     }
 }
 
-std::unique_ptr<RenderStyle> StyleResolver::pseudoStyleForElement(const Element& element, const PseudoStyleRequest& pseudoStyleRequest, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle, const SelectorFilter* selectorFilter)
+std::unique_ptr<RenderStyle> Resolver::pseudoStyleForElement(const Element& element, const PseudoStyleRequest& pseudoStyleRequest, const RenderStyle& parentStyle, const RenderStyle* parentBoxStyle, const SelectorFilter* selectorFilter)
 {
     auto state = State(element, &parentStyle, m_overrideDocumentElementStyle);
 
@@ -428,7 +429,7 @@ std::unique_ptr<RenderStyle> StyleResolver::pseudoStyleForElement(const Element&
 
     applyMatchedProperties(state, collector.matchResult());
 
-    Style::Adjuster adjuster(document(), *state.parentStyle(), parentBoxStyle, nullptr);
+    Adjuster adjuster(document(), *state.parentStyle(), parentBoxStyle, nullptr);
     adjuster.adjust(*state.style(), state.userAgentAppearanceStyle());
 
     if (state.style()->hasViewportUnits())
@@ -437,7 +438,7 @@ std::unique_ptr<RenderStyle> StyleResolver::pseudoStyleForElement(const Element&
     return state.takeStyle();
 }
 
-std::unique_ptr<RenderStyle> StyleResolver::styleForPage(int pageIndex)
+std::unique_ptr<RenderStyle> Resolver::styleForPage(int pageIndex)
 {
     RELEASE_ASSERT(!m_isDeleted);
 
@@ -455,14 +456,14 @@ std::unique_ptr<RenderStyle> StyleResolver::styleForPage(int pageIndex)
 
     auto& result = collector.matchResult();
 
-    Style::Builder builder(*state.style(), builderContext(state), result, { Style::CascadeLevel::Author });
+    Builder builder(*state.style(), builderContext(state), result, { CascadeLevel::Author });
     builder.applyAllProperties();
 
     // Now return the style.
     return state.takeStyle();
 }
 
-std::unique_ptr<RenderStyle> StyleResolver::defaultStyleForElement(const Element* element)
+std::unique_ptr<RenderStyle> Resolver::defaultStyleForElement(const Element* element)
 {
     auto style = RenderStyle::createPtr();
 
@@ -471,9 +472,9 @@ std::unique_ptr<RenderStyle> StyleResolver::defaultStyleForElement(const Element
     fontDescription.setOneFamily(standardFamily);
     fontDescription.setKeywordSizeFromIdentifier(CSSValueMedium);
 
-    auto size = Style::fontSizeForKeyword(CSSValueMedium, false, document());
+    auto size = fontSizeForKeyword(CSSValueMedium, false, document());
     fontDescription.setSpecifiedSize(size);
-    fontDescription.setComputedSize(Style::computedFontSizeFromSpecifiedSize(size, fontDescription.isAbsoluteSize(), is<SVGElement>(element), style.get(), document()));
+    fontDescription.setComputedSize(computedFontSizeFromSpecifiedSize(size, fontDescription.isAbsoluteSize(), is<SVGElement>(element), style.get(), document()));
 
     fontDescription.setShouldAllowUserInstalledFonts(settings().shouldAllowUserInstalledFonts() ? AllowUserInstalledFonts::Yes : AllowUserInstalledFonts::No);
     style->setFontDescription(WTFMove(fontDescription));
@@ -483,12 +484,12 @@ std::unique_ptr<RenderStyle> StyleResolver::defaultStyleForElement(const Element
     return style;
 }
 
-Vector<RefPtr<StyleRule>> StyleResolver::styleRulesForElement(const Element* element, unsigned rulesToInclude)
+Vector<RefPtr<StyleRule>> Resolver::styleRulesForElement(const Element* element, unsigned rulesToInclude)
 {
     return pseudoStyleRulesForElement(element, PseudoId::None, rulesToInclude);
 }
 
-Vector<RefPtr<StyleRule>> StyleResolver::pseudoStyleRulesForElement(const Element* element, PseudoId pseudoId, unsigned rulesToInclude)
+Vector<RefPtr<StyleRule>> Resolver::pseudoStyleRulesForElement(const Element* element, PseudoId pseudoId, unsigned rulesToInclude)
 {
     if (!element)
         return { };
@@ -528,27 +529,27 @@ static bool elementTypeHasAppearanceFromUAStyle(const Element& element)
         || localName == HTMLNames::meterTag;
 }
 
-void StyleResolver::invalidateMatchedDeclarationsCache()
+void Resolver::invalidateMatchedDeclarationsCache()
 {
     m_matchedDeclarationsCache.invalidate();
 }
 
-void StyleResolver::clearCachedDeclarationsAffectedByViewportUnits()
+void Resolver::clearCachedDeclarationsAffectedByViewportUnits()
 {
     m_matchedDeclarationsCache.clearEntriesAffectedByViewportUnits();
 }
 
-void StyleResolver::applyMatchedProperties(State& state, const MatchResult& matchResult, UseMatchedDeclarationsCache useMatchedDeclarationsCache)
+void Resolver::applyMatchedProperties(State& state, const MatchResult& matchResult, UseMatchedDeclarationsCache useMatchedDeclarationsCache)
 {
-    unsigned cacheHash = useMatchedDeclarationsCache == UseMatchedDeclarationsCache::Yes ? Style::MatchedDeclarationsCache::computeHash(matchResult) : 0;
-    auto includedProperties = Style::PropertyCascade::IncludedProperties::All;
+    unsigned cacheHash = useMatchedDeclarationsCache == UseMatchedDeclarationsCache::Yes ? MatchedDeclarationsCache::computeHash(matchResult) : 0;
+    auto includedProperties = PropertyCascade::IncludedProperties::All;
 
     auto& style = *state.style();
     auto& parentStyle = *state.parentStyle();
     auto& element = *state.element();
 
     auto* cacheEntry = m_matchedDeclarationsCache.find(cacheHash, matchResult);
-    if (cacheEntry && Style::MatchedDeclarationsCache::isCacheable(element, style, parentStyle)) {
+    if (cacheEntry && MatchedDeclarationsCache::isCacheable(element, style, parentStyle)) {
         // We can build up the style by copying non-inherited properties from an earlier style object built using the same exact
         // style declarations. We then only need to apply the inherited properties, if any, as their values can depend on the 
         // element context. This is fast and saves memory by reusing the style data structures.
@@ -565,7 +566,7 @@ void StyleResolver::applyMatchedProperties(State& state, const MatchResult& matc
             return;
         }
         
-        includedProperties = Style::PropertyCascade::IncludedProperties::InheritedOnly;
+        includedProperties = PropertyCascade::IncludedProperties::InheritedOnly;
     }
 
     if (elementTypeHasAppearanceFromUAStyle(element)) {
@@ -573,13 +574,13 @@ void StyleResolver::applyMatchedProperties(State& state, const MatchResult& matc
         // If so, we cache the border and background styles so that RenderTheme::adjustStyle()
         // can look at them later to figure out if this is a styled form control or not.
         auto userAgentStyle = RenderStyle::clonePtr(style);
-        Style::Builder builder(*userAgentStyle, builderContext(state), matchResult, { Style::CascadeLevel::UserAgent });
+        Builder builder(*userAgentStyle, builderContext(state), matchResult, { CascadeLevel::UserAgent });
         builder.applyAllProperties();
 
         state.setUserAgentAppearanceStyle(WTFMove(userAgentStyle));
     }
 
-    Style::Builder builder(*state.style(), builderContext(state), matchResult, Style::allCascadeLevels(), includedProperties);
+    Builder builder(*state.style(), builderContext(state), matchResult, allCascadeLevels(), includedProperties);
 
     // High priority properties may affect resolution of other properties (they are mostly font related).
     builder.applyHighPriorityProperties();
@@ -598,18 +599,18 @@ void StyleResolver::applyMatchedProperties(State& state, const MatchResult& matc
     if (cacheEntry || !cacheHash)
         return;
 
-    if (Style::MatchedDeclarationsCache::isCacheable(element, style, parentStyle))
+    if (MatchedDeclarationsCache::isCacheable(element, style, parentStyle))
         m_matchedDeclarationsCache.add(style, parentStyle, cacheHash, matchResult);
 }
 
-void StyleResolver::addViewportDependentMediaQueryResult(const MediaQueryExpression& expression, bool result)
+void Resolver::addViewportDependentMediaQueryResult(const MediaQueryExpression& expression, bool result)
 {
     m_viewportDependentMediaQueryResults.append(MediaQueryResult { expression, result });
 }
 
-bool StyleResolver::hasMediaQueriesAffectedByViewportChange() const
+bool Resolver::hasMediaQueriesAffectedByViewportChange() const
 {
-    LOG(MediaQueries, "StyleResolver::hasMediaQueriesAffectedByViewportChange evaluating queries");
+    LOG(MediaQueries, "Style::Resolver::hasMediaQueriesAffectedByViewportChange evaluating queries");
     for (auto& result : m_viewportDependentMediaQueryResults) {
         if (m_mediaQueryEvaluator.evaluate(result.expression) != result.result)
             return true;
@@ -617,14 +618,14 @@ bool StyleResolver::hasMediaQueriesAffectedByViewportChange() const
     return false;
 }
 
-void StyleResolver::addAccessibilitySettingsDependentMediaQueryResult(const MediaQueryExpression& expression, bool result)
+void Resolver::addAccessibilitySettingsDependentMediaQueryResult(const MediaQueryExpression& expression, bool result)
 {
     m_accessibilitySettingsDependentMediaQueryResults.append(MediaQueryResult { expression, result });
 }
 
-bool StyleResolver::hasMediaQueriesAffectedByAccessibilitySettingsChange() const
+bool Resolver::hasMediaQueriesAffectedByAccessibilitySettingsChange() const
 {
-    LOG(MediaQueries, "StyleResolver::hasMediaQueriesAffectedByAccessibilitySettingsChange evaluating queries");
+    LOG(MediaQueries, "Style::Resolver::hasMediaQueriesAffectedByAccessibilitySettingsChange evaluating queries");
     for (auto& result : m_accessibilitySettingsDependentMediaQueryResults) {
         if (m_mediaQueryEvaluator.evaluate(result.expression) != result.result)
             return true;
@@ -632,14 +633,14 @@ bool StyleResolver::hasMediaQueriesAffectedByAccessibilitySettingsChange() const
     return false;
 }
 
-void StyleResolver::addAppearanceDependentMediaQueryResult(const MediaQueryExpression& expression, bool result)
+void Resolver::addAppearanceDependentMediaQueryResult(const MediaQueryExpression& expression, bool result)
 {
     m_appearanceDependentMediaQueryResults.append(MediaQueryResult { expression, result });
 }
 
-bool StyleResolver::hasMediaQueriesAffectedByAppearanceChange() const
+bool Resolver::hasMediaQueriesAffectedByAppearanceChange() const
 {
-    LOG(MediaQueries, "StyleResolver::hasMediaQueriesAffectedByAppearanceChange evaluating queries");
+    LOG(MediaQueries, "Style::Resolver::hasMediaQueriesAffectedByAppearanceChange evaluating queries");
     for (auto& result : m_appearanceDependentMediaQueryResults) {
         if (m_mediaQueryEvaluator.evaluate(result.expression) != result.result)
             return true;
@@ -647,4 +648,5 @@ bool StyleResolver::hasMediaQueriesAffectedByAppearanceChange() const
     return false;
 }
 
+} // namespace Style
 } // namespace WebCore
similarity index 87%
rename from Source/WebCore/css/StyleResolver.h
rename to Source/WebCore/style/StyleResolver.h
index 0e28240..e222453 100644 (file)
 
 namespace WebCore {
 
-class CSSCursorImageValue;
-class CSSFontFace;
-class CSSFontFaceRule;
-class CSSFontValue;
-class CSSImageGeneratorValue;
-class CSSImageSetValue;
-class CSSImageValue;
-class CSSPageRule;
-class CSSPrimitiveValue;
-class CSSProperty;
 class CSSStyleSheet;
-class CSSValue;
-class ContainerNode;
 class Document;
 class Element;
-class Frame;
-class FrameView;
 class KeyframeList;
 class KeyframeValue;
-class MediaQueryEvaluator;
-class Node;
+class PageRuleCollector;
 class RuleData;
 class RuleSet;
 class SelectorFilter;
 class Settings;
-class StyleCachedImage;
-class StyleGeneratedImage;
-class StyleImage;
 class StyleRuleKeyframe;
 class StyleProperties;
 class StyleRule;
@@ -74,10 +56,7 @@ class StyleRuleKeyframes;
 class StyleRulePage;
 class StyleSheet;
 class StyleSheetList;
-class StyledElement;
-class SVGElement;
 class ViewportStyleResolver;
-struct ResourceLoaderOptions;
 
 // MatchOnlyUserAgentRules is used in media queries, where relative units
 // are interpreted according to the document root element style, and styled only
@@ -89,22 +68,23 @@ enum class RuleMatchingBehavior: uint8_t {
     MatchOnlyUserAgentRules,
 };
 
+namespace Style {
+
 struct ElementStyle {
-    ElementStyle(std::unique_ptr<RenderStyle> renderStyle, std::unique_ptr<Style::Relations> relations = { })
+    ElementStyle(std::unique_ptr<RenderStyle> renderStyle, std::unique_ptr<Relations> relations = { })
         : renderStyle(WTFMove(renderStyle))
         , relations(WTFMove(relations))
     { }
 
     std::unique_ptr<RenderStyle> renderStyle;
-    std::unique_ptr<Style::Relations> relations;
+    std::unique_ptr<Relations> relations;
 };
 
-// This class selects a RenderStyle for a given element based on a collection of stylesheets.
-class StyleResolver {
-    WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED;
+class Resolver {
+    WTF_MAKE_NONCOPYABLE(Resolver); WTF_MAKE_FAST_ALLOCATED;
 public:
-    StyleResolver(Document&);
-    ~StyleResolver();
+    Resolver(Document&);
+    ~Resolver();
 
     ElementStyle styleForElement(const Element&, const RenderStyle* parentStyle, const RenderStyle* parentBoxStyle = nullptr, RuleMatchingBehavior = RuleMatchingBehavior::MatchAllRules, const SelectorFilter* = nullptr);
 
@@ -175,7 +155,7 @@ public:
     InspectorCSSOMWrappers& inspectorCSSOMWrappers() { return m_inspectorCSSOMWrappers; }
 
 private:
-    friend class PageRuleCollector;
+    friend class WebCore::PageRuleCollector;
 
     class State {
     public:
@@ -206,7 +186,7 @@ private:
         std::unique_ptr<RenderStyle> m_userAgentAppearanceStyle;
     };
 
-    Style::BuilderContext builderContext(const State&);
+    BuilderContext builderContext(const State&);
 
     enum class UseMatchedDeclarationsCache { Yes, No };
     void applyMatchedProperties(State&, const MatchResult&, UseMatchedDeclarationsCache = UseMatchedDeclarationsCache::Yes);
@@ -233,14 +213,14 @@ private:
 
     InspectorCSSOMWrappers m_inspectorCSSOMWrappers;
 
-    Style::MatchedDeclarationsCache m_matchedDeclarationsCache;
+    MatchedDeclarationsCache m_matchedDeclarationsCache;
 
     bool m_matchAuthorAndUserStyles { true };
-    // See if we still have crashes where StyleResolver gets deleted early.
+    // See if we still have crashes where Resolver gets deleted early.
     bool m_isDeleted { false };
 };
 
-inline bool StyleResolver::hasSelectorForAttribute(const Element& element, const AtomString &attributeName) const
+inline bool Resolver::hasSelectorForAttribute(const Element& element, const AtomString &attributeName) const
 {
     ASSERT(!attributeName.isEmpty());
     if (element.isHTMLElement())
@@ -248,10 +228,11 @@ inline bool StyleResolver::hasSelectorForAttribute(const Element& element, const
     return m_ruleSets.features().attributeLocalNamesInRules.contains(attributeName);
 }
 
-inline bool StyleResolver::hasSelectorForId(const AtomString& idValue) const
+inline bool Resolver::hasSelectorForId(const AtomString& idValue) const
 {
     ASSERT(!idValue.isEmpty());
     return m_ruleSets.features().idsInRules.contains(idValue);
 }
 
+} // namespace Style
 } // namespace WebCore
index dcb65bc..3c9fd88 100644 (file)
@@ -88,7 +88,7 @@ bool Scope::shouldUseSharedUserAgentShadowTreeStyleResolver() const
     return true;
 }
 
-StyleResolver& Scope::resolver()
+Resolver& Scope::resolver()
 {
     if (shouldUseSharedUserAgentShadowTreeStyleResolver())
         return m_document.userAgentShadowTreeStyleResolver();
@@ -96,7 +96,7 @@ StyleResolver& Scope::resolver()
     if (!m_resolver) {
         SetForScope<bool> isUpdatingStyleResolver { m_isUpdatingStyleResolver, true };
 
-        m_resolver = makeUnique<StyleResolver>(m_document);
+        m_resolver = makeUnique<Resolver>(m_document);
 
         if (!m_shadowRoot) {
             m_document.fontSelector().buildStarted();
@@ -117,7 +117,7 @@ StyleResolver& Scope::resolver()
     return *m_resolver;
 }
 
-StyleResolver* Scope::resolverIfExists()
+Resolver* Scope::resolverIfExists()
 {
     if (shouldUseSharedUserAgentShadowTreeStyleResolver())
         return &m_document.userAgentShadowTreeStyleResolver();
@@ -381,7 +381,7 @@ void Scope::collectActiveStyleSheets(Vector<RefPtr<StyleSheet>>& sheets)
     }
 }
 
-Scope::StyleResolverUpdateType Scope::analyzeStyleSheetChange(const Vector<RefPtr<CSSStyleSheet>>& newStylesheets, bool& requiresFullStyleRecalc)
+Scope::ResolverUpdateType Scope::analyzeStyleSheetChange(const Vector<RefPtr<CSSStyleSheet>>& newStylesheets, bool& requiresFullStyleRecalc)
 {
     requiresFullStyleRecalc = true;
     
@@ -415,17 +415,17 @@ Scope::StyleResolverUpdateType Scope::analyzeStyleSheetChange(const Vector<RefPt
         addedSheets.append(&newStylesheets[newIndex]->contents());
         ++newIndex;
     }
-    // If all new sheets were added at the end of the list we can just add them to existing StyleResolver.
+    // If all new sheets were added at the end of the list we can just add them to existing Resolver.
     // If there were insertions we need to re-add all the stylesheets so rules are ordered correctly.
-    auto styleResolverUpdateType = hasInsertions ? Reset : Additive;
+    auto ResolverUpdateType = hasInsertions ? Reset : Additive;
 
     // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs.
     if (!m_document.bodyOrFrameset() || m_document.hasNodesWithNonFinalStyle() || m_document.hasNodesWithMissingStyle())
-        return styleResolverUpdateType;
+        return ResolverUpdateType;
 
     Invalidator invalidator(addedSheets, styleResolver.mediaQueryEvaluator());
     if (invalidator.dirtiesAllStyle())
-        return styleResolverUpdateType;
+        return ResolverUpdateType;
 
     if (m_shadowRoot)
         invalidator.invalidateStyle(*m_shadowRoot);
@@ -434,7 +434,7 @@ Scope::StyleResolverUpdateType Scope::analyzeStyleSheetChange(const Vector<RefPt
 
     requiresFullStyleRecalc = false;
 
-    return styleResolverUpdateType;
+    return ResolverUpdateType;
 }
 
 static void filterEnabledNonemptyCSSStyleSheets(Vector<RefPtr<CSSStyleSheet>>& result, const Vector<RefPtr<StyleSheet>>& sheets)
@@ -453,7 +453,7 @@ static void filterEnabledNonemptyCSSStyleSheets(Vector<RefPtr<CSSStyleSheet>>& r
     }
 }
 
-static void invalidateHostAndSlottedStyleIfNeeded(ShadowRoot& shadowRoot, StyleResolver& resolver)
+static void invalidateHostAndSlottedStyleIfNeeded(ShadowRoot& shadowRoot, Resolver& resolver)
 {
     auto& host = *shadowRoot.host();
     if (!resolver.ruleSets().authorStyle().hostPseudoClassRules().isEmpty())
@@ -490,11 +490,11 @@ void Scope::updateActiveStyleSheets(UpdateType updateType)
     filterEnabledNonemptyCSSStyleSheets(activeCSSStyleSheets, activeStyleSheets);
 
     bool requiresFullStyleRecalc = true;
-    StyleResolverUpdateType styleResolverUpdateType = Reconstruct;
+    ResolverUpdateType ResolverUpdateType = Reconstruct;
     if (updateType == UpdateType::ActiveSet)
-        styleResolverUpdateType = analyzeStyleSheetChange(activeCSSStyleSheets, requiresFullStyleRecalc);
+        ResolverUpdateType = analyzeStyleSheetChange(activeCSSStyleSheets, requiresFullStyleRecalc);
 
-    updateStyleResolver(activeCSSStyleSheets, styleResolverUpdateType);
+    updateResolver(activeCSSStyleSheets, ResolverUpdateType);
 
     m_weakCopyOfActiveStyleSheetListForFastLookup = nullptr;
     m_activeStyleSheets.swap(activeCSSStyleSheets);
@@ -518,7 +518,7 @@ void Scope::updateActiveStyleSheets(UpdateType updateType)
     }
 }
 
-void Scope::updateStyleResolver(Vector<RefPtr<CSSStyleSheet>>& activeStyleSheets, StyleResolverUpdateType updateType)
+void Scope::updateResolver(Vector<RefPtr<CSSStyleSheet>>& activeStyleSheets, ResolverUpdateType updateType)
 {
     if (updateType == Reconstruct) {
         clearResolver();
@@ -603,7 +603,7 @@ void Scope::scheduleUpdate(UpdateType update)
             invalidateHostAndSlottedStyleIfNeeded(*m_shadowRoot, *m_resolver);
         // FIXME: Animation code may trigger resource load in middle of style recalc and that can add a rule to a content extension stylesheet.
         //        Fix and remove isResolvingTreeStyle() test below, see https://bugs.webkit.org/show_bug.cgi?id=194335
-        // FIXME: The m_isUpdatingStyleResolver test is here because extension stylesheets can get us here from StyleResolver::appendAuthorStyleSheets.
+        // FIXME: The m_isUpdatingStyleResolver test is here because extension stylesheets can get us here from Resolver::appendAuthorStyleSheets.
         if (!m_isUpdatingStyleResolver && !m_document.isResolvingTreeStyle())
             clearResolver();
     }
@@ -621,21 +621,21 @@ void Scope::scheduleUpdate(UpdateType update)
 
 void Scope::evaluateMediaQueriesForViewportChange()
 {
-    evaluateMediaQueries([] (StyleResolver& resolver) {
+    evaluateMediaQueries([] (Resolver& resolver) {
         return resolver.hasMediaQueriesAffectedByViewportChange();
     });
 }
 
 void Scope::evaluateMediaQueriesForAccessibilitySettingsChange()
 {
-    evaluateMediaQueries([] (StyleResolver& resolver) {
+    evaluateMediaQueries([] (Resolver& resolver) {
         return resolver.hasMediaQueriesAffectedByAccessibilitySettingsChange();
     });
 }
 
 void Scope::evaluateMediaQueriesForAppearanceChange()
 {
-    evaluateMediaQueries([] (StyleResolver& resolver) {
+    evaluateMediaQueries([] (Resolver& resolver) {
         return resolver.hasMediaQueriesAffectedByAppearanceChange();
     });
 }
index a702f73..ed14b5b 100644 (file)
@@ -43,7 +43,6 @@ class Document;
 class Element;
 class Node;
 class ProcessingInstruction;
-class StyleResolver;
 class StyleSheet;
 class StyleSheetContents;
 class StyleSheetList;
@@ -52,6 +51,8 @@ class TreeScope;
 
 namespace Style {
 
+class Resolver;
+
 // This is used to identify style scopes that can affect an element.
 // Scopes are in tree-of-trees order. Styles from earlier scopes win over later ones (modulo !important).
 enum class ScopeOrdinal : int {
@@ -114,8 +115,8 @@ public:
     Vector<Ref<ProcessingInstruction>> collectXSLTransforms();
 #endif
 
-    StyleResolver& resolver();
-    StyleResolver* resolverIfExists();
+    Resolver& resolver();
+    Resolver* resolverIfExists();
     void clearResolver();
     void releaseMemory();
 
@@ -140,13 +141,13 @@ private:
 
     void collectActiveStyleSheets(Vector<RefPtr<StyleSheet>>&);
 
-    enum StyleResolverUpdateType {
+    enum ResolverUpdateType {
         Reconstruct,
         Reset,
         Additive
     };
-    StyleResolverUpdateType analyzeStyleSheetChange(const Vector<RefPtr<CSSStyleSheet>>& newStylesheets, bool& requiresFullStyleRecalc);
-    void updateStyleResolver(Vector<RefPtr<CSSStyleSheet>>&, StyleResolverUpdateType);
+    ResolverUpdateType analyzeStyleSheetChange(const Vector<RefPtr<CSSStyleSheet>>& newStylesheets, bool& requiresFullStyleRecalc);
+    void updateResolver(Vector<RefPtr<CSSStyleSheet>>&, ResolverUpdateType);
 
     void pendingUpdateTimerFired();
     void clearPendingUpdate();
@@ -154,7 +155,7 @@ private:
     Document& m_document;
     ShadowRoot* m_shadowRoot { nullptr };
 
-    std::unique_ptr<StyleResolver> m_resolver;
+    std::unique_ptr<Resolver> m_resolver;
 
     Vector<RefPtr<StyleSheet>> m_styleSheetsForStyleSheetList;
     Vector<RefPtr<CSSStyleSheet>> m_activeStyleSheets;
index c783373..622c559 100644 (file)
@@ -69,7 +69,6 @@ static inline bool parentElementPreventsSharing(const Element& parentElement)
 
 static inline bool elementHasDirectionAuto(const Element& element)
 {
-    // FIXME: This line is surprisingly hot, we may wish to inline hasDirectionAuto into StyleResolver.
     return is<HTMLElement>(element) && downcast<HTMLElement>(element).hasDirectionAuto();
 }
 
index 41e9f44..3f5540d 100644 (file)
@@ -66,27 +66,27 @@ TreeResolver::TreeResolver(Document& document)
 TreeResolver::~TreeResolver() = default;
 
 TreeResolver::Scope::Scope(Document& document)
-    : styleResolver(document.styleScope().resolver())
-    , sharingResolver(document, styleResolver.ruleSets(), selectorFilter)
+    : resolver(document.styleScope().resolver())
+    , sharingResolver(document, resolver.ruleSets(), selectorFilter)
 {
     document.setIsResolvingTreeStyle(true);
 }
 
 TreeResolver::Scope::Scope(ShadowRoot& shadowRoot, Scope& enclosingScope)
-    : styleResolver(shadowRoot.styleScope().resolver())
-    , sharingResolver(shadowRoot.documentScope(), styleResolver.ruleSets(), selectorFilter)
+    : resolver(shadowRoot.styleScope().resolver())
+    , sharingResolver(shadowRoot.documentScope(), resolver.ruleSets(), selectorFilter)
     , shadowRoot(&shadowRoot)
     , enclosingScope(&enclosingScope)
 {
-    styleResolver.setOverrideDocumentElementStyle(enclosingScope.styleResolver.overrideDocumentElementStyle());
+    resolver.setOverrideDocumentElementStyle(enclosingScope.resolver.overrideDocumentElementStyle());
 }
 
 TreeResolver::Scope::~Scope()
 {
     if (!shadowRoot)
-        styleResolver.document().setIsResolvingTreeStyle(false);
+        resolver.document().setIsResolvingTreeStyle(false);
 
-    styleResolver.setOverrideDocumentElementStyle(nullptr);
+    resolver.setOverrideDocumentElementStyle(nullptr);
 }
 
 TreeResolver::Parent::Parent(Document& document)
@@ -134,7 +134,7 @@ std::unique_ptr<RenderStyle> TreeResolver::styleForElement(Element& element, con
     if (auto style = scope().sharingResolver.resolve(element, *m_update))
         return style;
 
-    auto elementStyle = scope().styleResolver.styleForElement(element, &inheritedStyle, parentBoxStyle(), RuleMatchingBehavior::MatchAllRules, &scope().selectorFilter);
+    auto elementStyle = scope().resolver.styleForElement(element, &inheritedStyle, parentBoxStyle(), RuleMatchingBehavior::MatchAllRules, &scope().selectorFilter);
 
     if (elementStyle.relations)
         commitRelations(WTFMove(elementStyle.relations), *m_update);
@@ -212,12 +212,12 @@ ElementUpdates TreeResolver::resolveElement(Element& element)
 
     if (&element == m_document.documentElement()) {
         m_documentElementStyle = RenderStyle::clonePtr(*update.style);
-        scope().styleResolver.setOverrideDocumentElementStyle(m_documentElementStyle.get());
+        scope().resolver.setOverrideDocumentElementStyle(m_documentElementStyle.get());
 
         if (update.change != NoChange && existingStyle && existingStyle->computedFontPixelSize() != update.style->computedFontPixelSize()) {
             // "rem" units are relative to the document element's font size so we need to recompute everything.
             // In practice this is rare.
-            scope().styleResolver.invalidateMatchedDeclarationsCache();
+            scope().resolver.invalidateMatchedDeclarationsCache();
             descendantsToResolve = DescendantsToResolve::All;
         }
     }
@@ -254,7 +254,7 @@ ElementUpdate TreeResolver::resolvePseudoStyle(Element& element, const ElementUp
     if (!elementUpdate.style->hasPseudoStyle(pseudoId))
         return { };
 
-    auto pseudoStyle = scope().styleResolver.pseudoStyleForElement(element, { pseudoId }, *elementUpdate.style, parentBoxStyleForPseudo(elementUpdate), &scope().selectorFilter);
+    auto pseudoStyle = scope().resolver.pseudoStyleForElement(element, { pseudoId }, *elementUpdate.style, parentBoxStyleForPseudo(elementUpdate), &scope().selectorFilter);
     if (!pseudoElementRendererIsNeeded(pseudoStyle.get()))
         return { };
 
@@ -565,13 +565,13 @@ std::unique_ptr<Update> TreeResolver::resolve()
     m_parentStack.append(Parent(m_document));
 
     // Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc.
-    renderView.setUsesFirstLineRules(renderView.usesFirstLineRules() || scope().styleResolver.usesFirstLineRules());
-    renderView.setUsesFirstLetterRules(renderView.usesFirstLetterRules() || scope().styleResolver.usesFirstLetterRules());
+    renderView.setUsesFirstLineRules(renderView.usesFirstLineRules() || scope().resolver.usesFirstLineRules());
+    renderView.setUsesFirstLetterRules(renderView.usesFirstLetterRules() || scope().resolver.usesFirstLetterRules());
 
     resolveComposedTree();
 
-    renderView.setUsesFirstLineRules(scope().styleResolver.usesFirstLineRules());
-    renderView.setUsesFirstLetterRules(scope().styleResolver.usesFirstLetterRules());
+    renderView.setUsesFirstLineRules(scope().resolver.usesFirstLineRules());
+    renderView.setUsesFirstLetterRules(scope().resolver.usesFirstLetterRules());
 
     ASSERT(m_scopeStack.size() == 1);
     ASSERT(m_parentStack.size() == 1);
index d946100..7b22b10 100644 (file)
@@ -40,10 +40,11 @@ class Element;
 class Node;
 class RenderStyle;
 class ShadowRoot;
-class StyleResolver;
 
 namespace Style {
 
+class Resolver;
+
 class TreeResolver {
 public:
     TreeResolver(Document&);
@@ -62,7 +63,7 @@ private:
     ElementUpdate resolvePseudoStyle(Element&, const ElementUpdate&, PseudoId);
 
     struct Scope : RefCounted<Scope> {
-        StyleResolver& styleResolver;
+        Resolver& resolver;
         SelectorFilter selectorFilter;
         SharingResolver sharingResolver;
         ShadowRoot* shadowRoot { nullptr };
index 87fd5da..2ffcbac 100644 (file)
@@ -593,12 +593,12 @@ void SVGElement::animatorWillBeDeleted(const QualifiedName& attributeName)
     propertyAnimatorFactory().animatorWillBeDeleted(attributeName);
 }
 
-Optional<ElementStyle> SVGElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*)
+Optional<Style::ElementStyle> SVGElement::resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle*)
 {
     // If the element is in a <use> tree we get the style from the definition tree.
     if (auto styleElement = makeRefPtr(this->correspondingElement())) {
-        Optional<ElementStyle> style = styleElement->resolveStyle(&parentStyle);
-        Style::Adjuster::adjustSVGElementStyle(*style->renderStyle, *this);
+        auto style = styleElement->resolveStyle(&parentStyle);
+        Style::Adjuster::adjustSVGElementStyle(*style.renderStyle, *this);
         return style;
     }
 
index 84aba22..98fcffb 100644 (file)
@@ -98,7 +98,7 @@ public:
 
     void setCorrespondingElement(SVGElement*);
 
-    Optional<ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
+    Optional<Style::ElementStyle> resolveCustomStyle(const RenderStyle& parentStyle, const RenderStyle* shadowHostStyle) override;
 
     static QualifiedName animatableAttributeForName(const AtomString&);
 #ifndef NDEBUG