Chromium Code Reviews| Index: Source/core/dom/Document.cpp |
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
| index 00c2016fa9359e21c64a70928aa004df5967e4ef..6f8bfcf487a6385f606b878462b2476f91aa5e8d 100644 |
| --- a/Source/core/dom/Document.cpp |
| +++ b/Source/core/dom/Document.cpp |
| @@ -635,6 +635,8 @@ MediaQueryMatcher& Document::mediaQueryMatcher() |
| { |
| if (!m_mediaQueryMatcher) |
| m_mediaQueryMatcher = MediaQueryMatcher::create(this); |
| + if (m_styleResolver && m_styleResolver->hasPendingAuthorStyleSheets()) |
| + m_styleResolver->appendPendingAuthorStyleSheets(); |
| return *m_mediaQueryMatcher; |
| } |
| @@ -1700,6 +1702,9 @@ void Document::recalcStyle(StyleRecalcChange change) |
| if (m_elemSheet && m_elemSheet->contents()->usesRemUnits()) |
| m_styleEngine->setUsesRemUnit(true); |
| + if (m_styleResolver && m_styleResolver->hasPendingAuthorStyleSheets()) |
| + m_styleResolver->appendPendingAuthorStyleSheets(); |
|
esprehn
2013/10/25 02:37:58
You shouldn't be repeated this everywhere. Just li
tasak
2013/10/25 10:10:10
I see.
I added an inline function to StyleResolver
|
| + |
| { |
| PostAttachCallbacks::SuspendScope suspendPostAttachCallbacks; |
| RenderWidget::UpdateSuspendScope suspendWidgetHierarchyUpdates; |
| @@ -1887,12 +1892,18 @@ 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(); |
| + if (resolver->hasPendingAuthorStyleSheets()) |
| + resolver->appendPendingAuthorStyleSheets(); |
|
esprehn
2013/10/25 02:37:58
This doesn't make sense. You call appendPendingAut
tasak
2013/10/25 10:10:10
Yeah, this is my mistake.
Since I removed the call
|
| + return resolver->styleForElement(element, element->parentNode() ? element->parentNode()->computedStyle() : 0); |
| } |
| PassRefPtr<RenderStyle> Document::styleForPage(int pageIndex) |
| { |
| - return styleResolver()->styleForPage(pageIndex); |
| + StyleResolver* resolver = styleResolver(); |
| + if (resolver->hasPendingAuthorStyleSheets()) |
| + resolver->appendPendingAuthorStyleSheets(); |
|
esprehn
2013/10/25 02:37:58
Same.
tasak
2013/10/25 10:10:10
Done.
|
| + return resolver->styleForPage(pageIndex); |
| } |
| bool Document::isPageBoxVisible(int pageIndex) |
| @@ -1958,6 +1969,14 @@ void Document::createStyleResolver() |
| m_styleEngine->combineCSSFeatureFlags(m_styleResolver->ruleFeatureSet()); |
| } |
| +void Document::appendPendingAuthorStyleSheets() |
| +{ |
| + ASSERT(m_styleResolver); |
| + if (!m_styleResolver->hasPendingAuthorStyleSheets()) |
| + return; |
| + m_styleResolver->appendPendingAuthorStyleSheets(); |
| +} |
| + |
| void Document::clearStyleResolver() |
| { |
| m_styleResolver.clear(); |