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

Unified Diff: Source/core/dom/ProcessingInstruction.cpp

Issue 429363004: Should clear sheet when ProcessingInstruction's removedFrom or attributeChanged (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
« no previous file with comments | « Source/core/dom/ProcessingInstruction.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ProcessingInstruction.cpp
diff --git a/Source/core/dom/ProcessingInstruction.cpp b/Source/core/dom/ProcessingInstruction.cpp
index cfa280d811f4463e34c9cb0c34d7992bab4b8eb5..585454e54fe53b4d59fd27022fa329e107def90e 100644
--- a/Source/core/dom/ProcessingInstruction.cpp
+++ b/Source/core/dom/ProcessingInstruction.cpp
@@ -57,7 +57,7 @@ ProcessingInstruction::~ProcessingInstruction()
{
#if !ENABLE(OILPAN)
if (m_sheet)
- m_sheet->clearOwnerNode();
+ clearSheet();
// FIXME: ProcessingInstruction should not be in document here.
// However, if we add ASSERT(!inDocument()), fast/xsl/xslt-entity.xml
@@ -90,8 +90,9 @@ PassRefPtrWillBeRawPtr<Node> ProcessingInstruction::cloneNode(bool /*deep*/)
void ProcessingInstruction::didAttributeChanged()
{
- ASSERT(!m_sheet);
- ASSERT(!isLoading());
+ if (m_sheet)
+ clearSheet();
+
String href;
String charset;
if (!checkStyleSheet(href, charset))
@@ -211,6 +212,11 @@ void ProcessingInstruction::setCSSStyleSheet(const String& href, const KURL& bas
void ProcessingInstruction::setXSLStyleSheet(const String& href, const KURL& baseURL, const String& sheet)
{
+ if (!inDocument()) {
+ ASSERT(!m_sheet);
+ return;
+ }
+
ASSERT(m_isXSL);
m_sheet = XSLStyleSheet::create(this, href, baseURL);
parseStyleSheet(sheet);
@@ -274,8 +280,7 @@ void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint)
if (m_sheet) {
ASSERT(m_sheet->ownerNode() == this);
- m_sheet->clearOwnerNode();
- m_sheet = nullptr;
+ clearSheet();
}
// If we're in document teardown, then we don't need to do any notification of our sheet's removal.
@@ -283,6 +288,14 @@ void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint)
document().removedStyleSheet(removedSheet.get());
}
+void ProcessingInstruction::clearSheet()
+{
+ ASSERT(m_sheet);
+ if (m_sheet->isLoading())
+ document().styleEngine()->removePendingSheet(this);
+ m_sheet.release()->clearOwnerNode();
+}
+
void ProcessingInstruction::trace(Visitor* visitor)
{
visitor->trace(m_sheet);
« no previous file with comments | « Source/core/dom/ProcessingInstruction.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698