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

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

Issue 159853004: Ensure that every Document has a single, distinct template content ownerDocument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Suppress expected w3c test failures Created 6 years, 10 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/Document.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/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 90e8afb08463db1fc27d15d38f0514117fc655b1..c625eede4694084d6b6b39b7b039123d5b4be9a8 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -521,7 +521,7 @@ Document::~Document()
ASSERT(m_visibilityObservers.isEmpty());
if (m_templateDocument)
- m_templateDocument->setTemplateDocumentHost(0); // balanced in templateDocument().
+ m_templateDocument->m_templateDocumentHost = 0; // balanced in ensureTemplateDocument().
m_scriptRunner.clear();
@@ -5322,8 +5322,11 @@ Locale& Document::getCachedLocale(const AtomicString& locale)
Document& Document::ensureTemplateDocument()
{
- if (const Document* document = templateDocument())
- return *const_cast<Document*>(document);
+ if (isTemplateDocument())
+ return *this;
+
+ if (m_templateDocument)
+ return *m_templateDocument;
if (isHTMLDocument()) {
DocumentInit init = DocumentInit::fromContext(contextDocument(), blankURL()).withNewRegistrationContext();
@@ -5332,7 +5335,7 @@ Document& Document::ensureTemplateDocument()
m_templateDocument = Document::create(DocumentInit(blankURL()));
}
- m_templateDocument->setTemplateDocumentHost(this); // balanced in dtor.
+ m_templateDocument->m_templateDocumentHost = this; // balanced in dtor.
return *m_templateDocument.get();
}
« no previous file with comments | « Source/core/dom/Document.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698