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

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: Prefer ExceptionState over throw 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 b4f3645f135ab7d580657005588c50beaee12d1b..4b34259d3e223206fedec88428d459d5df00aaae 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::createCustomElement(*this, name, CreatedByCreateElement, 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::createCustomElement(*this, localName, CreatedByCreateElement, exceptionState);
} else if (V0CustomElement::isValidName(localName) && registrationContext()) {
element = registrationContext()->createCustomTagElement(*this, QualifiedName(nullAtom, convertLocalName(localName), xhtmlNamespaceURI));
} else {
@@ -692,7 +695,7 @@ Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
if (qName == QualifiedName::null())
return nullptr;
- return createElement(qName, CreatedByCreateElement);
+ return createElement(qName, CreatedByCreateElement, exceptionState);
}
Element* Document::createElementNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& typeExtension, ExceptionState& exceptionState)
@@ -703,7 +706,7 @@ Element* Document::createElementNS(const AtomicString& namespaceURI, const Atomi
Element* element;
if (CustomElement::shouldCreateCustomElement(*this, qName))
- element = CustomElement::createCustomElement(*this, qName, CreatedByCreateElement);
+ element = CustomElement::createCustomElement(*this, qName, CreatedByCreateElement, exceptionState);
else if (V0CustomElement::isValidName(qName.localName()) && registrationContext())
element = registrationContext()->createCustomTagElement(*this, qName);
else
@@ -986,6 +989,13 @@ Element* Document::createElement(const QualifiedName& qName, CreateElementFlags
return e;
}
+Element* Document::createElement(const QualifiedName& qName, CreateElementFlags flags, ExceptionState& exceptionState)
+{
+ if (CustomElement::shouldCreateCustomElement(*this, qName))
+ return CustomElement::createCustomElement(*this, qName, flags, exceptionState);
+ return createElement(qName, flags);
+}
+
String Document::readyState() const
{
DEFINE_STATIC_LOCAL(const String, loading, ("loading"));

Powered by Google App Engine
This is Rietveld 408576698