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

Unified Diff: third_party/WebKit/Source/core/dom/custom/CustomElement.cpp

Issue 2446903008: Custom Elements: Lookup custom element definition algorithm (Closed)
Patch Set: Patch Created 4 years, 1 month 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
index 2baf3bfefa30383be95843dfec0989c083083423..c86abfe261a64bc17246a54fb299ed9729dde3cd 100644
--- a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
@@ -69,10 +69,11 @@ bool CustomElement::shouldCreateCustomElement(const QualifiedName& tagName) {
tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI;
}
-static CustomElementDefinition* definitionForName(const Document& document,
- const QualifiedName& name) {
+static CustomElementDefinition* definitionFor(
+ const Document& document,
+ const CustomElementDescriptor desc) {
if (CustomElementRegistry* registry = CustomElement::registry(document))
- return registry->definitionForName(name.localName());
+ return registry->definitionFor(desc);
return nullptr;
}
@@ -88,8 +89,9 @@ HTMLElement* CustomElement::createCustomElementSync(
Document& document,
const QualifiedName& tagName) {
DCHECK(shouldCreateCustomElement(tagName));
- if (CustomElementDefinition* definition =
- definitionForName(document, tagName))
+ if (CustomElementDefinition* definition = definitionFor(
+ document,
+ CustomElementDescriptor(tagName.localName(), tagName.localName())))
return definition->createElementSync(document, tagName);
return createUndefinedElement(document, tagName);
}
@@ -103,8 +105,9 @@ HTMLElement* CustomElement::createCustomElementAsync(
// https://dom.spec.whatwg.org/#concept-create-element
// 6. If definition is non-null, then:
// 6.2. If the synchronous custom elements flag is not set:
- if (CustomElementDefinition* definition =
- definitionForName(document, tagName))
+ if (CustomElementDefinition* definition = definitionFor(
+ document,
+ CustomElementDescriptor(tagName.localName(), tagName.localName())))
return definition->createElementAsync(document, tagName);
return createUndefinedElement(document, tagName);
@@ -209,8 +212,8 @@ void CustomElement::tryToUpgrade(Element* element) {
CustomElementRegistry* registry = CustomElement::registry(*element);
if (!registry)
return;
- if (CustomElementDefinition* definition =
- registry->definitionForName(element->localName()))
+ if (CustomElementDefinition* definition = registry->definitionFor(
+ CustomElementDescriptor(element->localName(), element->localName())))
definition->enqueueUpgradeReaction(element);
else
registry->addCandidate(element);
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698