| Index: Source/core/css/TreeBoundaryCrossingRules.cpp
|
| diff --git a/Source/core/css/TreeBoundaryCrossingRules.cpp b/Source/core/css/TreeBoundaryCrossingRules.cpp
|
| index 4184d9f568108a3d9e6f7122bb872fae445ee1f9..ef800fe172725585285a0ae6ba4639205e1bb428 100644
|
| --- a/Source/core/css/TreeBoundaryCrossingRules.cpp
|
| +++ b/Source/core/css/TreeBoundaryCrossingRules.cpp
|
| @@ -34,15 +34,21 @@
|
|
|
| namespace WebCore {
|
|
|
| -void TreeBoundaryCrossingRules::addRule(StyleRule* rule, size_t selectorIndex, ContainerNode* scopingNode, AddRuleFlags addRuleFlags)
|
| +void TreeBoundaryCrossingRules::addRule(StyleRule* rule, size_t selectorIndex, ContainerNode* scopingNode, CSSStyleSheet* parentStyleSheet, AddRuleFlags addRuleFlags)
|
| {
|
| - if (m_treeBoundaryCrossingRuleSetMap.contains(scopingNode)) {
|
| - m_treeBoundaryCrossingRuleSetMap.get(scopingNode)->addRule(rule, selectorIndex, addRuleFlags);
|
| + if (!m_treeBoundaryCrossingRuleSetMap.contains(scopingNode)) {
|
| + OwnPtrWillBeRawPtr<CSSStyleSheetRuleSubSet> styleSheetRuleSubSetForScope = adoptPtr(new CSSStyleSheetRuleSubSet());
|
| + m_treeBoundaryCrossingRuleSetMap.add(scopingNode, styleSheetRuleSubSetForScope.release());
|
| + m_scopingNodes.add(scopingNode);
|
| + }
|
| + CSSStyleSheetRuleSubSet* ruleSubSet = m_treeBoundaryCrossingRuleSetMap.get(scopingNode);
|
| +
|
| + if (ruleSubSet->contains(parentStyleSheet)) {
|
| + ruleSubSet->get(parentStyleSheet)->addRule(rule, selectorIndex, addRuleFlags);
|
| } else {
|
| OwnPtrWillBeRawPtr<RuleSet> ruleSetForScope = RuleSet::create();
|
| ruleSetForScope->addRule(rule, selectorIndex, addRuleFlags);
|
| - m_treeBoundaryCrossingRuleSetMap.add(scopingNode, ruleSetForScope.release());
|
| - m_scopingNodes.add(scopingNode);
|
| + ruleSubSet->add(parentStyleSheet, ruleSetForScope.release());
|
| }
|
| }
|
|
|
| @@ -52,12 +58,20 @@ void TreeBoundaryCrossingRules::reset(const ContainerNode* scopingNode)
|
| m_scopingNodes.remove(scopingNode);
|
| }
|
|
|
| -void TreeBoundaryCrossingRules::collectFeaturesTo(RuleFeatureSet& features)
|
| +static void collectFeaturesFromStyleSheetSubSet(TreeBoundaryCrossingRules::CSSStyleSheetRuleSubSet* styleSheetSubSet, RuleFeatureSet& features)
|
| {
|
| - for (TreeBoundaryCrossingRuleSetMap::iterator::Values it = m_treeBoundaryCrossingRuleSetMap.values().begin(); it != m_treeBoundaryCrossingRuleSetMap.values().end(); ++it) {
|
| + for (TreeBoundaryCrossingRules::CSSStyleSheetRuleSubSet::iterator::Values it = styleSheetSubSet->values().begin(); it != styleSheetSubSet->values().end(); ++it) {
|
| RuleSet* ruleSet = it->get();
|
| features.add(ruleSet->features());
|
| }
|
| }
|
|
|
| +void TreeBoundaryCrossingRules::collectFeaturesTo(RuleFeatureSet& features)
|
| +{
|
| + for (TreeBoundaryCrossingRuleSetMap::iterator::Values it = m_treeBoundaryCrossingRuleSetMap.values().begin(); it != m_treeBoundaryCrossingRuleSetMap.values().end(); ++it) {
|
| + CSSStyleSheetRuleSubSet* styleSheetSubSet = it->get();
|
| + collectFeaturesFromStyleSheetSubSet(styleSheetSubSet, features);
|
| + }
|
| +}
|
| +
|
| } // namespace WebCore
|
|
|