Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Unified Diff: Source/core/css/TreeBoundaryCrossingRules.cpp

Issue 206043009: Setup parent stylesheet for tree boundary crossing rules. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698