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