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

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

Issue 42543007: StyleResolver should update RuleSets lazily. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 1 month 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/RuleSet.cpp
diff --git a/Source/core/css/RuleSet.cpp b/Source/core/css/RuleSet.cpp
index f2fa53701061a08a790eb8899ead1a2adf013de3..97b459d9b2276a54a26337a8722fef21d17a61e7 100644
--- a/Source/core/css/RuleSet.cpp
+++ b/Source/core/css/RuleSet.cpp
@@ -51,11 +51,6 @@ using namespace HTMLNames;
// -----------------------------------------------------------------
-static inline bool isDocumentScope(const ContainerNode* scope)
-{
- return !scope || scope->isDocumentNode();
-}
-
static inline bool isSelectorMatchingHTMLBasedOnRuleHash(const CSSSelector* selector)
{
ASSERT(selector);
@@ -404,7 +399,7 @@ void RuleSet::addChildRules(const Vector<RefPtr<StyleRuleBase> >& rules, const M
addRegionRule(static_cast<StyleRuleRegion*>(rule), hasDocumentSecurityOrigin);
} else if (rule->isHostRule()) {
addHostRule(static_cast<StyleRuleHost*>(rule));
- } else if (rule->isViewportRule()) {
+ } else if (rule->isViewportRule() && !(addRuleFlags & ViewportRuleIsProcessed)) {
addViewportRule(static_cast<StyleRuleViewport*>(rule));
} else if (rule->isSupportsRule() && static_cast<StyleRuleSupports*>(rule)->conditionIsSupported()) {
addChildRules(static_cast<StyleRuleSupports*>(rule)->childRules(), medium, resolver, scope, hasDocumentSecurityOrigin, addRuleFlags);
@@ -412,7 +407,7 @@ void RuleSet::addChildRules(const Vector<RefPtr<StyleRuleBase> >& rules, const M
}
}
-void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvaluator& medium, StyleResolver* resolver, const ContainerNode* scope)
+void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvaluator& medium, StyleResolver* resolver, const ContainerNode* scope, bool viewportRuleIsProcessed)
{
ASSERT(sheet);
@@ -420,11 +415,11 @@ void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvalu
for (unsigned i = 0; i < importRules.size(); ++i) {
StyleRuleImport* importRule = importRules[i].get();
if (importRule->styleSheet() && (!importRule->mediaQueries() || medium.eval(importRule->mediaQueries(), resolver->viewportDependentMediaQueryResults())))
- addRulesFromSheet(importRule->styleSheet(), medium, resolver, scope);
+ addRulesFromSheet(importRule->styleSheet(), medium, resolver, scope, viewportRuleIsProcessed);
}
bool hasDocumentSecurityOrigin = resolver && resolver->document().securityOrigin()->canRequest(sheet->baseURL());
- AddRuleFlags addRuleFlags = static_cast<AddRuleFlags>((hasDocumentSecurityOrigin ? RuleHasDocumentSecurityOrigin : 0) | (!scope ? RuleCanUseFastCheckSelector : 0));
+ AddRuleFlags addRuleFlags = static_cast<AddRuleFlags>((hasDocumentSecurityOrigin ? RuleHasDocumentSecurityOrigin : 0) | (!scope ? RuleCanUseFastCheckSelector : 0) | (viewportRuleIsProcessed ? ViewportRuleIsProcessed : 0));
addChildRules(sheet->childRules(), medium, resolver, scope, hasDocumentSecurityOrigin, addRuleFlags);
}

Powered by Google App Engine
This is Rietveld 408576698