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

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

Issue 132203012: Make Custom Element registration context creation explicit. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Nicer. Created 6 years, 11 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/DocumentInit.h ('k') | Source/core/loader/DocumentLoader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/DocumentInit.cpp
diff --git a/Source/core/dom/DocumentInit.cpp b/Source/core/dom/DocumentInit.cpp
index 7993f6c55e078a0f1361993f1e1edb2ab731ba05..e3923a7aa414250d103d644c323b6e4444941dc1 100644
--- a/Source/core/dom/DocumentInit.cpp
+++ b/Source/core/dom/DocumentInit.cpp
@@ -68,6 +68,7 @@ DocumentInit::DocumentInit(const KURL& url, Frame* frame, WeakPtr<Document> cont
, m_owner(ownerDocument(frame))
, m_contextDocument(contextDocument)
, m_import(import)
+ , m_createNewRegistrationContext(false)
{
}
@@ -79,6 +80,7 @@ DocumentInit::DocumentInit(const DocumentInit& other)
, m_contextDocument(other.m_contextDocument)
, m_import(other.m_import)
, m_registrationContext(other.m_registrationContext)
+ , m_createNewRegistrationContext(other.m_createNewRegistrationContext)
{
}
@@ -125,11 +127,18 @@ KURL DocumentInit::parentBaseURL() const
DocumentInit& DocumentInit::withRegistrationContext(CustomElementRegistrationContext* registrationContext)
{
- ASSERT(!m_registrationContext);
+ ASSERT(!m_createNewRegistrationContext && !m_registrationContext);
m_registrationContext = registrationContext;
return *this;
}
+DocumentInit& DocumentInit::withNewRegistrationContext()
+{
+ ASSERT(!m_createNewRegistrationContext && !m_registrationContext);
+ m_createNewRegistrationContext = true;
+ return *this;
+}
+
PassRefPtr<CustomElementRegistrationContext> DocumentInit::registrationContext(Document* document) const
{
if (!RuntimeEnabledFeatures::customElementsEnabled() && !RuntimeEnabledFeatures::embedderCustomElementsEnabled())
@@ -138,10 +147,10 @@ PassRefPtr<CustomElementRegistrationContext> DocumentInit::registrationContext(D
if (!document->isHTMLDocument() && !document->isXHTMLDocument())
return 0;
- if (m_registrationContext)
- return m_registrationContext.get();
+ if (m_createNewRegistrationContext)
+ return CustomElementRegistrationContext::create();
- return CustomElementRegistrationContext::create();
+ return m_registrationContext.get();
}
WeakPtr<Document> DocumentInit::contextDocument() const
« no previous file with comments | « Source/core/dom/DocumentInit.h ('k') | Source/core/loader/DocumentLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698