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

Unified Diff: third_party/WebKit/Source/core/dom/ProcessingInstruction.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 premature script execution Created 4 years, 8 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/ProcessingInstruction.cpp
diff --git a/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp b/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp
index 4338ba519334f6b51f9c0c83cec16402bfec78c1..da02b2704b07b5b3d46bb1670055df337ba31137 100644
--- a/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp
+++ b/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp
@@ -41,6 +41,7 @@ inline ProcessingInstruction::ProcessingInstruction(Document& document, const St
: CharacterData(document, data, CreateOther)
, m_target(target)
, m_loading(false)
+ , m_beforeBody(false)
, m_alternate(false)
, m_isCSS(false)
, m_isXSL(false)
@@ -165,8 +166,10 @@ void ProcessingInstruction::process(const String& href, const String& charset)
if (resource) {
m_loading = true;
- if (!m_isXSL)
- document().styleEngine().addPendingSheet();
+ if (!m_isXSL) {
+ m_beforeBody = m_beforeBody || !document().body();
+ document().styleEngine().addPendingSheet(m_beforeBody);
+ }
setResource(resource);
}
}
@@ -184,7 +187,7 @@ bool ProcessingInstruction::sheetLoaded()
{
if (!isLoading()) {
if (!DocumentXSLT::sheetLoaded(document(), this))
- document().styleEngine().removePendingSheet(this);
+ document().styleEngine().removePendingSheet(this, m_beforeBody);
return true;
}
return false;
@@ -288,7 +291,7 @@ void ProcessingInstruction::clearSheet()
{
DCHECK(m_sheet);
if (m_sheet->isLoading())
- document().styleEngine().removePendingSheet(this);
+ document().styleEngine().removePendingSheet(this, m_beforeBody);
m_sheet.release()->clearOwnerNode();
}

Powered by Google App Engine
This is Rietveld 408576698