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

Unified Diff: Source/core/css/resolver/ScopedStyleResolver.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/resolver/ScopedStyleResolver.cpp
diff --git a/Source/core/css/resolver/ScopedStyleResolver.cpp b/Source/core/css/resolver/ScopedStyleResolver.cpp
index 95d6b8050bb077f6be9360a429cf4fbbb7fe4eba..bb87f1f9517301f9dd250b60dd3182cd31ceb458 100644
--- a/Source/core/css/resolver/ScopedStyleResolver.cpp
+++ b/Source/core/css/resolver/ScopedStyleResolver.cpp
@@ -247,14 +247,24 @@ const ContainerNode* ScopedStyleResolver::scopingNodeFor(const CSSStyleSheet* sh
return (parent->isElementNode() || parent->isShadowRoot()) ? parent : 0;
}
-void ScopedStyleResolver::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvaluator& medium, StyleResolver* resolver)
+inline RuleSet* ScopedStyleResolver::ensureAuthorStyle()
{
if (!m_authorStyle)
m_authorStyle = RuleSet::create();
- m_authorStyle->addRulesFromSheet(sheet, medium, resolver, &m_scopingNode);
+ return m_authorStyle.get();
+}
+
+void ScopedStyleResolver::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvaluator& medium, StyleResolver* resolver, bool viewportRuleIsProcessed)
+{
+ ensureAuthorStyle()->addRulesFromSheet(sheet, medium, resolver, &m_scopingNode, viewportRuleIsProcessed);
resolver->processScopedRules(*m_authorStyle, sheet->baseURL(), &m_scopingNode);
}
+void ScopedStyleResolver::addViewportRule(StyleRuleViewport* rule)
+{
+ ensureAuthorStyle()->addViewportRule(rule);
+}
+
inline RuleSet* ScopedStyleResolver::ensureAtHostRuleSetFor(const ShadowRoot* shadowRoot)
{
HashMap<const ShadowRoot*, OwnPtr<RuleSet> >::AddResult addResult = m_atHostRules.add(shadowRoot, nullptr);

Powered by Google App Engine
This is Rietveld 408576698