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

Unified Diff: third_party/WebKit/Source/core/dom/StyleEngine.cpp

Issue 1903803002: Do not block painting for in-body CSS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed merge conflict Created 4 years, 7 months 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: 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 e68b424767d778f476eb9bd4c48b36ced163e570..5efdd124421ea579c4c44c51cb791733162eba88 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -131,19 +131,28 @@ void StyleEngine::injectAuthorSheet(StyleSheetContents* authorSheet)
resolverChanged(AnalyzedStyleUpdate);
}
-void StyleEngine::addPendingSheet()
+void StyleEngine::addPendingSheet(StyleEngineContext &context)
{
m_pendingStylesheets++;
+
+ context.addingPendingSheet(document());
+ if (context.addedPendingSheetBeforeBody())
+ m_pendingRenderBlockingStylesheets++;
}
// This method is called whenever a top-level stylesheet has finished loading.
-void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode)
+void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode, const StyleEngineContext &context)
{
DCHECK(styleSheetCandidateNode);
TreeScope* treeScope = isStyleElement(*styleSheetCandidateNode) ? &styleSheetCandidateNode->treeScope() : m_document.get();
if (styleSheetCandidateNode->inShadowIncludingDocument())
markTreeScopeDirty(*treeScope);
+ if (context.addedPendingSheetBeforeBody()) {
+ 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);
@@ -493,11 +502,11 @@ void StyleEngine::markDocumentDirty()
document().importsController()->master()->styleEngine().markDocumentDirty();
}
-CSSStyleSheet* StyleEngine::createSheet(Element* e, const String& text, TextPosition startPosition)
+CSSStyleSheet* StyleEngine::createSheet(Element* e, const String& text, TextPosition startPosition, StyleEngineContext &context)
{
CSSStyleSheet* styleSheet = nullptr;
- e->document().styleEngine().addPendingSheet();
+ e->document().styleEngine().addPendingSheet(context);
AtomicString textContent(text);
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | third_party/WebKit/Source/core/dom/StyleEngineContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698