Index: Source/core/css/DocumentRuleSets.cpp |
diff --git a/Source/core/css/DocumentRuleSets.cpp b/Source/core/css/DocumentRuleSets.cpp |
index dc17860b56f703a2b43e8b631bf480ba106da37e..27f082f121d815b0e55eb982cc1b4168b5d92853 100644 |
--- a/Source/core/css/DocumentRuleSets.cpp |
+++ b/Source/core/css/DocumentRuleSets.cpp |
@@ -47,30 +47,13 @@ DocumentRuleSets::~DocumentRuleSets() |
{ |
} |
-void DocumentRuleSets::initUserStyle(StyleEngine* styleSheetCollection, const Vector<RefPtr<StyleRule> >& watchedSelectors, const MediaQueryEvaluator& medium, StyleResolver& resolver) |
-{ |
- OwnPtr<RuleSet> tempUserStyle = RuleSet::create(); |
- if (CSSStyleSheet* pageUserSheet = styleSheetCollection->pageUserSheet()) |
- tempUserStyle->addRulesFromSheet(pageUserSheet->contents(), medium, &resolver); |
- collectRulesFromUserStyleSheets(styleSheetCollection->documentUserStyleSheets(), *tempUserStyle, medium, resolver); |
- collectRulesFromWatchedSelectors(watchedSelectors, *tempUserStyle); |
- if (tempUserStyle->ruleCount() > 0 || tempUserStyle->pageRules().size() > 0) |
- m_userStyle = tempUserStyle.release(); |
-} |
- |
-void DocumentRuleSets::collectRulesFromUserStyleSheets(const Vector<RefPtr<CSSStyleSheet> >& userSheets, RuleSet& userStyle, const MediaQueryEvaluator& medium, StyleResolver& resolver) |
-{ |
- for (unsigned i = 0; i < userSheets.size(); ++i) { |
- ASSERT(userSheets[i]->contents()->isUserStyleSheet()); |
- userStyle.addRulesFromSheet(userSheets[i]->contents(), medium, &resolver); |
- resolver.addFontFaceRules(userStyle.fontFaceRules()); |
- } |
-} |
- |
-void DocumentRuleSets::collectRulesFromWatchedSelectors(const Vector<RefPtr<StyleRule> >& watchedSelectors, RuleSet& userStyle) |
+void DocumentRuleSets::initWatchedSelectorRules(const Vector<RefPtr<StyleRule> >& watchedSelectors) |
{ |
+ if (!watchedSelectors.size()) |
+ return; |
+ m_watchedSelectorsRules = RuleSet::create(); |
for (unsigned i = 0; i < watchedSelectors.size(); ++i) |
- userStyle.addStyleRule(watchedSelectors[i].get(), RuleHasNoSpecialState); |
+ m_watchedSelectorsRules->addStyleRule(watchedSelectors[i].get(), RuleHasNoSpecialState); |
} |
void DocumentRuleSets::resetAuthorStyle() |
@@ -89,8 +72,8 @@ void DocumentRuleSets::collectFeaturesTo(RuleFeatureSet& features, bool isViewSo |
if (isViewSource) |
features.add(CSSDefaultStyleSheets::viewSourceStyle()->features()); |
- if (m_userStyle) |
- features.add(m_userStyle->features()); |
+ if (m_watchedSelectorsRules) |
+ features.add(m_watchedSelectorsRules->features()); |
m_treeBoundaryCrossingRules.collectFeaturesTo(features); |
} |