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() |