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

Unified Diff: Source/core/dom/Document.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/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 3388b1d232304afa36428ef56a5ff40e83fa8307..a3faa382a80c6e37d7aefb8404098eb69efa07de 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -616,6 +616,7 @@ MediaQueryMatcher& Document::mediaQueryMatcher()
{
if (!m_mediaQueryMatcher)
m_mediaQueryMatcher = MediaQueryMatcher::create(this);
+ appendPendingStyleSheetsIfNeeded(m_styleResolver.get());
return *m_mediaQueryMatcher;
}
@@ -1704,6 +1705,8 @@ void Document::recalcStyle(StyleRecalcChange change)
if (m_elemSheet && m_elemSheet->contents()->usesRemUnits())
m_styleEngine->setUsesRemUnit(true);
+ appendPendingStyleSheetsIfNeeded(m_styleResolver.get());
+
{
PostAttachCallbacks::SuspendScope suspendPostAttachCallbacks;
RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates;
@@ -1757,7 +1760,7 @@ void Document::recalcStyle(StyleRecalcChange change)
if (m_styleResolver) {
// Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc.
- m_styleEngine->resetCSSFeatureFlags(m_styleResolver->ruleFeatureSet());
+ m_styleEngine->resetCSSFeatureFlags(m_styleResolver->ensureRuleFeatureSet());
m_styleResolver->clearStyleSharingList();
}
}
@@ -1904,12 +1907,16 @@ PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem
{
ASSERT_ARG(element, element->document() == this);
TemporaryChange<bool> ignoreStyleSheets(m_ignorePendingStylesheets, true);
- return styleResolver()->styleForElement(element, element->parentNode() ? element->parentNode()->computedStyle() : 0);
+ StyleResolver* resolver = styleResolver();
+ appendPendingStyleSheetsIfNeeded(resolver);
+ return resolver->styleForElement(element, element->parentNode() ? element->parentNode()->computedStyle() : 0);
}
PassRefPtr<RenderStyle> Document::styleForPage(int pageIndex)
{
- return styleResolver()->styleForPage(pageIndex);
+ StyleResolver* resolver = styleResolver();
+ appendPendingStyleSheetsIfNeeded(resolver);
+ return resolver->styleForPage(pageIndex);
}
bool Document::isPageBoxVisible(int pageIndex)
@@ -1974,7 +1981,7 @@ void Document::createStyleResolver()
ASSERT(frame());
m_styleResolver = adoptPtr(new StyleResolver(*this));
- m_styleEngine->combineCSSFeatureFlags(m_styleResolver->ruleFeatureSet());
+ m_styleEngine->combineCSSFeatureFlags(m_styleResolver->ensureRuleFeatureSet());
}
void Document::clearStyleResolver()

Powered by Google App Engine
This is Rietveld 408576698