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

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

Issue 2054433002: Implement "create an element" when sync for Custom Element V1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@async-ce
Patch Set: dominicc review Created 4 years, 6 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
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 03495d3e825bdad6fa7fceb5bf60d782d8bc65df..927377f58361c4a33558765660995cf53f959b1b 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -640,8 +640,11 @@ Element* Document::createElement(const AtomicString& name, ExceptionState& excep
return nullptr;
}
- if (isXHTMLDocument() || isHTMLDocument())
+ if (isXHTMLDocument() || isHTMLDocument()) {
+ if (CustomElement::shouldCreateCustomElement(*this, name))
+ return CustomElement::createCustomElementSync(*this, name, exceptionState);
return HTMLElementFactory::createHTMLElement(convertLocalName(name), *this, 0, CreatedByCreateElement);
+ }
return Element::create(QualifiedName(nullAtom, name, nullAtom), this);
}
@@ -656,7 +659,7 @@ Element* Document::createElement(const AtomicString& localName, const AtomicStri
Element* element;
if (CustomElement::shouldCreateCustomElement(*this, localName)) {
- element = CustomElement::createCustomElement(*this, localName, CreatedByCreateElement);
+ element = CustomElement::createCustomElementSync(*this, localName, exceptionState);
} else if (V0CustomElement::isValidName(localName) && registrationContext()) {
element = registrationContext()->createCustomTagElement(*this, QualifiedName(nullAtom, convertLocalName(localName), xhtmlNamespaceURI));
} else {
@@ -692,6 +695,8 @@ Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
if (qName == QualifiedName::null())
return nullptr;
+ if (CustomElement::shouldCreateCustomElement(*this, qName))
+ return CustomElement::createCustomElementSync(*this, qName, exceptionState);
return createElement(qName, CreatedByCreateElement);
}
@@ -703,7 +708,7 @@ Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
Element* element;
if (CustomElement::shouldCreateCustomElement(*this, qName))
- element = CustomElement::createCustomElement(*this, qName, CreatedByCreateElement);
+ element = CustomElement::createCustomElementSync(*this, qName, exceptionState);
else if (V0CustomElement::isValidName(qName.localName()) && registrationContext())
element = registrationContext()->createCustomTagElement(*this, qName);
else

Powered by Google App Engine
This is Rietveld 408576698