Index: third_party/WebKit/Source/core/dom/Document.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp |
index 8cbb3d73af873624fbd74e576428416855dce825..c6a894d96c2912a0618fca02aca00cf335edbcdb 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -107,6 +107,7 @@ |
#include "core/dom/VisitedLinkState.h" |
#include "core/dom/XMLDocument.h" |
#include "core/dom/custom/CustomElement.h" |
+#include "core/dom/custom/CustomElementCreationScope.h" |
#include "core/dom/custom/CustomElementRegistry.h" |
#include "core/dom/custom/V0CustomElementMicrotaskRunQueue.h" |
#include "core/dom/custom/V0CustomElementRegistrationContext.h" |
@@ -640,8 +641,10 @@ Element* Document::createElement(const AtomicString& name, ExceptionState& excep |
} |
if (isXHTMLDocument() || isHTMLDocument()) { |
- if (CustomElement::shouldCreateCustomElement(name)) |
+ if (CustomElement::shouldCreateCustomElement(name)) { |
+ CustomElementCreationScope scope(this); |
return CustomElement::createCustomElementSync(*this, name, exceptionState); |
+ } |
return HTMLElementFactory::createHTMLElement(convertLocalName(name), *this, 0, CreatedByCreateElement); |
} |
@@ -658,6 +661,7 @@ Element* Document::createElement(const AtomicString& localName, const AtomicStri |
Element* element; |
if (CustomElement::shouldCreateCustomElement(localName)) { |
+ CustomElementCreationScope scope(this); |
element = CustomElement::createCustomElementSync(*this, localName, exceptionState); |
} else if (V0CustomElement::isValidName(localName) && registrationContext()) { |
element = registrationContext()->createCustomTagElement(*this, QualifiedName(nullAtom, convertLocalName(localName), xhtmlNamespaceURI)); |
@@ -694,8 +698,10 @@ Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi |
if (qName == QualifiedName::null()) |
return nullptr; |
- if (CustomElement::shouldCreateCustomElement(qName)) |
+ if (CustomElement::shouldCreateCustomElement(qName)) { |
+ CustomElementCreationScope scope(this); |
return CustomElement::createCustomElementSync(*this, qName, exceptionState); |
+ } |
return createElement(qName, CreatedByCreateElement); |
} |
@@ -706,13 +712,14 @@ Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi |
return nullptr; |
Element* element; |
- if (CustomElement::shouldCreateCustomElement(qName)) |
+ if (CustomElement::shouldCreateCustomElement(qName)) { |
+ CustomElementCreationScope scope(this); |
element = CustomElement::createCustomElementSync(*this, qName, exceptionState); |
- else if (V0CustomElement::isValidName(qName.localName()) && registrationContext()) |
+ } else if (V0CustomElement::isValidName(qName.localName()) && registrationContext()) { |
element = registrationContext()->createCustomTagElement(*this, qName); |
- else |
+ } else { |
element = createElement(qName, CreatedByCreateElement); |
- |
+ } |
if (!typeExtension.isEmpty()) |
V0CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element, typeExtension); |