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

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

Issue 2279703002: Add a scoped context object for synchronous CE creation (Closed)
Patch Set: Clean up Created 4 years, 4 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 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);
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/dom/custom/CustomElementCreationScope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698