Index: third_party/WebKit/Source/core/dom/StyleEngine.cpp |
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.cpp b/third_party/WebKit/Source/core/dom/StyleEngine.cpp |
index bf0ea0dc6fa95c8863be8c13b3be1fc163ad84f6..4efede4c161a5a90df485266a957449614b0f8af 100644 |
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp |
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp |
@@ -131,19 +131,26 @@ void StyleEngine::injectAuthorSheet(StyleSheetContents* authorSheet) |
resolverChanged(AnalyzedStyleUpdate); |
} |
-void StyleEngine::addPendingSheet() |
+void StyleEngine::addPendingSheet(bool isBeforeBody) |
{ |
m_pendingStylesheets++; |
+ if (isBeforeBody) |
+ m_pendingRenderBlockingStylesheets++; |
} |
// This method is called whenever a top-level stylesheet has finished loading. |
-void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode) |
+void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode, bool isBeforeBody) |
{ |
DCHECK(styleSheetCandidateNode); |
TreeScope* treeScope = isStyleElement(*styleSheetCandidateNode) ? &styleSheetCandidateNode->treeScope() : m_document.get(); |
if (styleSheetCandidateNode->inShadowIncludingDocument()) |
markTreeScopeDirty(*treeScope); |
+ if (isBeforeBody) { |
+ DCHECK_GT(m_pendingRenderBlockingStylesheets, 0); |
+ m_pendingRenderBlockingStylesheets--; |
+ } |
+ |
// Make sure we knew this sheet was pending, and that our count isn't out of sync. |
DCHECK_GT(m_pendingStylesheets, 0); |
@@ -508,11 +515,11 @@ static bool isCacheableForStyleElement(const StyleSheetContents& contents) |
return true; |
} |
-CSSStyleSheet* StyleEngine::createSheet(Element* e, const String& text, TextPosition startPosition) |
+CSSStyleSheet* StyleEngine::createSheet(Element* e, const String& text, TextPosition startPosition, bool isBeforeBody) |
{ |
CSSStyleSheet* styleSheet = nullptr; |
- e->document().styleEngine().addPendingSheet(); |
+ e->document().styleEngine().addPendingSheet(isBeforeBody); |
AtomicString textContent(text); |