, m_owner(ownerDocument(frame))
, m_contextDocument(contextDocument)
, m_import(import)
+ , m_createNewRegistrationContext(false)
{
}
, m_contextDocument(other.m_contextDocument)
, m_import(other.m_import)
, m_registrationContext(other.m_registrationContext)
+ , m_createNewRegistrationContext(other.m_createNewRegistrationContext)
{
}
DocumentInit& DocumentInit::withRegistrationContext(CustomElementRegistrationContext* registrationContext)
{
- ASSERT(!m_registrationContext);
+ ASSERT(!m_createNewRegistrationContext && !m_registrationContext);
m_registrationContext = registrationContext;
return *this;
}
-PassRefPtr<CustomElementRegistrationContext> DocumentInit::registrationContext(Document* document) const
+DocumentInit& DocumentInit::withNewRegistrationContext()
{
- if (!RuntimeEnabledFeatures::customElementsEnabled() && !RuntimeEnabledFeatures::embedderCustomElementsEnabled())
- return 0;
+ ASSERT(!m_createNewRegistrationContext && !m_registrationContext);
+ m_createNewRegistrationContext = true;
+ return *this;
+}
+PassRefPtr<CustomElementRegistrationContext> DocumentInit::registrationContext(Document* document) const
+{
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