Changeset 163263 in webkit


Ignore:
Timestamp:
Feb 2, 2014, 9:27:02 AM (11 years ago)
Author:
Antti Koivisto
Message:

Remove StyleScopeResolver
https://bugs.webkit.org/show_bug.cgi?id=128069

Reviewed by Anders Carlsson.

This is dead code.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • WebCore.xcodeproj/project.pbxproj:
  • css/DocumentRuleSets.cpp:

(WebCore::DocumentRuleSets::appendAuthorStyleSheets):
(WebCore::DocumentRuleSets::collectFeatures):

  • css/DocumentRuleSets.h:
  • css/ElementRuleCollector.h:

(WebCore::ElementRuleCollector::ElementRuleCollector):

  • css/RuleSet.cpp:

(WebCore::RuleSet::addChildRules):

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::pushParentElement):
(WebCore::StyleResolver::popParentElement):
(WebCore::StyleResolver::locateSharedStyle):
(WebCore::StyleResolver::styleForElement):

  • css/StyleResolver.h:

(WebCore::StyleResolver::document):

  • css/StyleScopeResolver.cpp: Removed.
  • css/StyleScopeResolver.h: Removed.
  • style/StyleResolveTree.cpp:

(WebCore::Style::attachShadowRoot):
(WebCore::Style::resolveShadowTree):

Location:
trunk/Source/WebCore
Files:
2 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r163225 r163263  
    11051105    css/StyleRule.cpp
    11061106    css/StyleRuleImport.cpp
    1107     css/StyleScopeResolver.cpp
    11081107    css/StyleSheet.cpp
    11091108    css/StyleSheetContents.cpp
  • trunk/Source/WebCore/ChangeLog

    r163262 r163263  
     12014-02-02  Antti Koivisto  <antti@apple.com>
     2
     3        Remove StyleScopeResolver
     4        https://bugs.webkit.org/show_bug.cgi?id=128069
     5
     6        Reviewed by Anders Carlsson.
     7
     8        This is dead code.
     9
     10        * CMakeLists.txt:
     11        * GNUmakefile.list.am:
     12        * WebCore.xcodeproj/project.pbxproj:
     13        * css/DocumentRuleSets.cpp:
     14        (WebCore::DocumentRuleSets::appendAuthorStyleSheets):
     15        (WebCore::DocumentRuleSets::collectFeatures):
     16        * css/DocumentRuleSets.h:
     17        * css/ElementRuleCollector.h:
     18        (WebCore::ElementRuleCollector::ElementRuleCollector):
     19        * css/RuleSet.cpp:
     20        (WebCore::RuleSet::addChildRules):
     21        * css/StyleResolver.cpp:
     22        (WebCore::StyleResolver::pushParentElement):
     23        (WebCore::StyleResolver::popParentElement):
     24        (WebCore::StyleResolver::locateSharedStyle):
     25        (WebCore::StyleResolver::styleForElement):
     26        * css/StyleResolver.h:
     27        (WebCore::StyleResolver::document):
     28        * css/StyleScopeResolver.cpp: Removed.
     29        * css/StyleScopeResolver.h: Removed.
     30        * style/StyleResolveTree.cpp:
     31        (WebCore::Style::attachShadowRoot):
     32        (WebCore::Style::resolveShadowTree):
     33
    1342014-02-02  Zalan Bujtas  <zalan@apple.com>
    235
  • trunk/Source/WebCore/GNUmakefile.list.am

    r163253 r163263  
    26952695        Source/WebCore/css/StyleRuleImport.cpp \
    26962696        Source/WebCore/css/StyleRuleImport.h \
    2697         Source/WebCore/css/StyleScopeResolver.cpp \
    2698         Source/WebCore/css/StyleScopeResolver.h \
    26992697        Source/WebCore/css/StyleSheet.cpp \
    27002698        Source/WebCore/css/StyleSheet.h \
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r163253 r163263  
    37253725                A7AD2F880EC89D07008AB002 /* LinkHash.h in Headers */ = {isa = PBXBuildFile; fileRef = A7AD2F860EC89D07008AB002 /* LinkHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
    37263726                A7B6E69F0B291A9600D0529F /* DragData.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B6E69D0B291A9600D0529F /* DragData.h */; settings = {ATTRIBUTES = (Private, ); }; };
    3727                 A7B761A1161EE526002083D3 /* StyleScopeResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B7619F161EE526002083D3 /* StyleScopeResolver.h */; };
    37283727                A7BBE26611AFB3F20005EA03 /* JSHTMLMeterElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7BBE26411AFB3F20005EA03 /* JSHTMLMeterElement.cpp */; };
    37293728                A7BBE26711AFB3F20005EA03 /* JSHTMLMeterElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A7BBE26511AFB3F20005EA03 /* JSHTMLMeterElement.h */; };
     
    1070210701                A7B4EA7914C9348400C8F5BF /* JSInternalSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInternalSettings.h; sourceTree = "<group>"; };
    1070310702                A7B6E69D0B291A9600D0529F /* DragData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragData.h; sourceTree = "<group>"; };
    10704                 A7B7619F161EE526002083D3 /* StyleScopeResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleScopeResolver.h; sourceTree = "<group>"; };
    1070510703                A7BBE26411AFB3F20005EA03 /* JSHTMLMeterElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLMeterElement.cpp; sourceTree = "<group>"; };
    1070610704                A7BBE26511AFB3F20005EA03 /* JSHTMLMeterElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLMeterElement.h; sourceTree = "<group>"; };
     
    2152421522                                E4946EAC156E64DD00D3297F /* StyleRuleImport.cpp */,
    2152521523                                E4946EAD156E64DD00D3297F /* StyleRuleImport.h */,
    21526                                 A7B7619F161EE526002083D3 /* StyleScopeResolver.h */,
    2152721524                                A8EA80050A19516E00A8EF5F /* StyleSheet.cpp */,
    2152821525                                A8EA80040A19516E00A8EF5F /* StyleSheet.h */,
     
    2534025337                                E4BBED4D14FCDBA1003F0B98 /* StyleRule.h in Headers */,
    2534125338                                E4946EAF156E64DD00D3297F /* StyleRuleImport.h in Headers */,
    25342                                 A7B761A1161EE526002083D3 /* StyleScopeResolver.h in Headers */,
    2534325339                                A8EA800C0A19516E00A8EF5F /* StyleSheet.h in Headers */,
    2534425340                                0F54DCE61881051D003EEDBB /* TextAutoSizing.h in Headers */,
  • trunk/Source/WebCore/css/CSSAllInOne.cpp

    r159856 r163263  
    8585#include "StylePropertyShorthand.cpp"
    8686#include "StyleResolver.cpp"
    87 #include "StyleScopeResolver.cpp"
    8887#include "ViewportStyleResolver.cpp"
  • trunk/Source/WebCore/css/DocumentRuleSets.cpp

    r163073 r163263  
    9494        if (cssSheet->mediaQueries() && !medium->eval(cssSheet->mediaQueries(), resolver))
    9595            continue;
    96         StyleSheetContents& sheet = cssSheet->contents();
    97 #if ENABLE(SHADOW_DOM)
    98         if (const ContainerNode* scope = StyleScopeResolver::scopeFor(cssSheet)) {
    99             // FIXME: Remove a dependency to calling a StyleResolver's member function.
    100             // If we can avoid calling resolver->ensureScopeResolver() here, we don't have to include "StyleResolver.h".
    101             // https://bugs.webkit.org/show_bug.cgi?id=108890
    102             resolver->ensureScopeResolver()->ensureRuleSetFor(scope)->addRulesFromSheet(&sheet, *medium, resolver, scope);
    103             continue;
    104         }
    105 #endif
    106         m_authorStyle->addRulesFromSheet(&sheet, *medium, resolver);
     96        m_authorStyle->addRulesFromSheet(&cssSheet->contents(), *medium, resolver);
    10797        inspectorCSSOMWrappers.collectFromStyleSheetIfNeeded(cssSheet);
    10898    }
    10999    m_authorStyle->shrinkToFit();
    110     collectFeatures(isViewSource, resolver->scopeResolver());
     100    collectFeatures(isViewSource);
    111101}
    112102
    113 void DocumentRuleSets::collectFeatures(bool isViewSource, StyleScopeResolver* scopeResolver)
     103void DocumentRuleSets::collectFeatures(bool isViewSource)
    114104{
    115105    m_features.clear();
     
    124114        m_features.add(CSSDefaultStyleSheets::viewSourceStyle()->features());
    125115
    126     if (scopeResolver)
    127         scopeResolver->collectFeaturesTo(m_features);
    128116    if (m_userStyle)
    129117        m_features.add(m_userStyle->features());
  • trunk/Source/WebCore/css/DocumentRuleSets.h

    r157653 r163263  
    3939class MediaQueryEvaluator;
    4040class RuleSet;
    41 class StyleScopeResolver;
    4241
    4342class DocumentRuleSets {
     
    5655    void appendAuthorStyleSheets(unsigned firstNew, const Vector<RefPtr<CSSStyleSheet>>&, MediaQueryEvaluator*, InspectorCSSOMWrappers&, bool isViewSource, StyleResolver*);
    5756
    58     void collectFeatures(bool isViewSource, StyleScopeResolver*);
     57    void collectFeatures(bool isViewSource);
    5958
    6059private:
  • trunk/Source/WebCore/css/ElementRuleCollector.h

    r162773 r163263  
    3838class RuleSet;
    3939class SelectorFilter;
    40 class StyleScopeResolver;
    4140
    4241class ElementRuleCollector {
     
    4645        , m_ruleSets(styleResolver->ruleSets())
    4746        , m_selectorFilter(styleResolver->selectorFilter())
    48         , m_scopeResolver(styleResolver->scopeResolver())
    4947        , m_isPrintStyle(false)
    5048        , m_regionForStyling(0)
     
    9290    DocumentRuleSets& m_ruleSets;
    9391    SelectorFilter& m_selectorFilter;
    94     StyleScopeResolver* m_scopeResolver;
    9592
    9693    bool m_isPrintStyle;
  • trunk/Source/WebCore/css/RuleSet.cpp

    r157653 r163263  
    307307        }
    308308#endif
    309 #if ENABLE(SHADOW_DOM)
    310         else if (rule->isHostRule())
    311             resolver->addHostRule(static_cast<StyleRuleHost*>(rule), hasDocumentSecurityOrigin, scope);
    312 #endif
    313309#if ENABLE(CSS_DEVICE_ADAPTATION)
    314310        else if (rule->isViewportRule() && resolver) {
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r163079 r163263  
    329329    else
    330330        m_selectorFilter.pushParent(parent);
    331 
    332     // Note: We mustn't skip ShadowRoot nodes for the scope stack.
    333     if (m_scopeResolver)
    334         m_scopeResolver->push(parent, parent->parentOrShadowHostNode());
    335331}
    336332
     
    341337    if (m_selectorFilter.parentStackIsConsistent(parent))
    342338        m_selectorFilter.popParent();
    343     if (m_scopeResolver)
    344         m_scopeResolver->pop(parent);
    345 }
    346 
    347 void StyleResolver::pushParentShadowRoot(const ShadowRoot* shadowRoot)
    348 {
    349     ASSERT(shadowRoot->hostElement());
    350     if (m_scopeResolver)
    351         m_scopeResolver->push(shadowRoot, shadowRoot->hostElement());
    352 }
    353 
    354 void StyleResolver::popParentShadowRoot(const ShadowRoot* shadowRoot)
    355 {
    356     ASSERT(shadowRoot->hostElement());
    357     if (m_scopeResolver)
    358         m_scopeResolver->pop(shadowRoot);
    359339}
    360340
     
    398378}
    399379
    400 inline bool StyleResolver::styleSharingCandidateMatchesHostRules()
    401 {
    402 #if ENABLE(SHADOW_DOM)
    403     return m_scopeResolver && m_scopeResolver->styleSharingCandidateMatchesHostRules(m_state.element());
    404 #else
    405     return false;
    406 #endif
    407 }
    408 
    409380bool StyleResolver::classNamesAffectedByRules(const SpaceSplitString& classNames) const
    410381{
     
    776747    if (styleSharingCandidateMatchesRuleSet(m_ruleSets.uncommonAttribute()))
    777748        return 0;
    778     // Can't share if @host @-rules apply.
    779     if (styleSharingCandidateMatchesHostRules())
    780         return 0;
    781749    // Tracking child index requires unique style for each node. This may get set by the sibling rule match above.
    782750    if (parentElementPreventsSharing(state.element()->parentElement()))
     
    840808    CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(element, needsCollection);
    841809    if (needsCollection)
    842         m_ruleSets.collectFeatures(document().isViewSource(), m_scopeResolver.get());
     810        m_ruleSets.collectFeatures(document().isViewSource());
    843811
    844812    ElementRuleCollector collector(this, state);
  • trunk/Source/WebCore/css/StyleResolver.h

    r162770 r163263  
    3737#include "SelectorFilter.h"
    3838#include "StyleInheritedData.h"
    39 #include "StyleScopeResolver.h"
    4039#include "ViewportStyleResolver.h"
    4140#include <memory>
     
    7877class RuleSet;
    7978class Settings;
    80 class StyleScopeResolver;
    8179class StyleImage;
    8280class StyleKeyframe;
     
    148146    void pushParentElement(Element*);
    149147    void popParentElement(Element*);
    150     void pushParentShadowRoot(const ShadowRoot*);
    151     void popParentShadowRoot(const ShadowRoot*);
    152 #if ENABLE(SHADOW_DOM)
    153     void addHostRule(StyleRuleHost* rule, bool hasDocumentSecurityOrigin, const ContainerNode* scope) { ensureScopeResolver()->addHostRule(rule, hasDocumentSecurityOrigin, scope); }
    154 #endif
    155148
    156149    PassRef<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle = 0, StyleSharingBehavior = AllowStyleSharing,
     
    169162    Element* element() { return m_state.element(); }
    170163    Document& document() { return m_document; }
    171     StyleScopeResolver* scopeResolver() const { return m_scopeResolver.get(); }
    172164    bool hasParentNode() const { return m_state.parentNode(); }
    173165
     
    179171    const DocumentRuleSets& ruleSets() const { return m_ruleSets; }
    180172    SelectorFilter& selectorFilter() { return m_selectorFilter; }
    181 
    182 #if ENABLE(SHADOW_DOM)
    183     StyleScopeResolver* ensureScopeResolver()
    184     {
    185         ASSERT(RuntimeEnabledFeatures::sharedFeatures().shadowDOMEnabled());
    186         if (!m_scopeResolver)
    187             m_scopeResolver = std::make_unique<StyleScopeResolver>();
    188         return m_scopeResolver.get();
    189     }
    190 #endif
    191173
    192174private:
     
    194176    RenderStyle* locateSharedStyle();
    195177    bool styleSharingCandidateMatchesRuleSet(RuleSet*);
    196     bool styleSharingCandidateMatchesHostRules();
    197178    Node* locateCousinList(Element* parent, unsigned& visitedNodeCount) const;
    198179    StyledElement* findSiblingForStyleSharing(Node*, unsigned& count) const;
     
    546527    const DeprecatedStyleBuilder& m_deprecatedStyleBuilder;
    547528
    548     std::unique_ptr<StyleScopeResolver> m_scopeResolver;
    549529    CSSToStyleMap m_styleMap;
    550530    InspectorCSSOMWrappers m_inspectorCSSOMWrappers;
  • trunk/Source/WebCore/style/StyleResolveTree.cpp

    r162726 r163263  
    467467static void attachShadowRoot(ShadowRoot& shadowRoot)
    468468{
    469     StyleResolver& styleResolver = shadowRoot.document().ensureStyleResolver();
    470     styleResolver.pushParentShadowRoot(&shadowRoot);
    471 
    472469    attachChildren(shadowRoot);
    473 
    474     styleResolver.popParentShadowRoot(&shadowRoot);
    475470
    476471    shadowRoot.clearNeedsStyleRecalc();
     
    727722    if (!shadowRoot)
    728723        return;
    729     StyleResolver& styleResolver = shadowRoot->document().ensureStyleResolver();
    730     styleResolver.pushParentShadowRoot(shadowRoot);
    731724
    732725    for (Node* child = shadowRoot->firstChild(); child; child = child->nextSibling()) {
    733726        if (child->isTextNode()) {
    734             // Current user agent ShadowRoots don't have immediate text children so this branch is never actually taken.
    735727            updateTextStyle(*toText(child));
    736728            continue;
    737729        }
    738         resolveTree(*toElement(child), change);
    739     }
    740 
    741     styleResolver.popParentShadowRoot(shadowRoot);
     730        if (child->isElementNode())
     731            resolveTree(*toElement(child), change);
     732    }
     733
    742734    shadowRoot->clearNeedsStyleRecalc();
    743735    shadowRoot->clearChildNeedsStyleRecalc();
Note: See TracChangeset for help on using the changeset viewer.