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

Unified Diff: Source/core/dom/custom/CustomElementRegistrationContext.cpp

Issue 106903007: Let unresolved custom element go through CustomElementCallbackQueue. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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: Source/core/dom/custom/CustomElementRegistrationContext.cpp
diff --git a/Source/core/dom/custom/CustomElementRegistrationContext.cpp b/Source/core/dom/custom/CustomElementRegistrationContext.cpp
index e248ab7cbf1b659f1b0a03dae0ca0b173c0e5057..b68f1533204b1aa25abf9b0091c4e9dd824ec782 100644
--- a/Source/core/dom/custom/CustomElementRegistrationContext.cpp
+++ b/Source/core/dom/custom/CustomElementRegistrationContext.cpp
@@ -74,16 +74,16 @@ PassRefPtr<Element> CustomElementRegistrationContext::createCustomTagElement(Doc
}
element->setCustomElementState(Element::WaitingForUpgrade);
- resolve(element.get(), nullAtom);
+ resolveNewElement(element.get(), nullAtom);
return element.release();
}
void CustomElementRegistrationContext::didGiveTypeExtension(Element* element, const AtomicString& type)
{
- resolve(element, type);
+ resolveNewElement(element, type);
}
-void CustomElementRegistrationContext::resolve(Element* element, const AtomicString& typeExtension)
+void CustomElementRegistrationContext::resolveNewElement(Element* element, const AtomicString& typeExtension)
{
// If an element has a custom tag name it takes precedence over
// the "is" attribute (if any).
@@ -100,6 +100,15 @@ void CustomElementRegistrationContext::resolve(Element* element, const AtomicStr
didCreateUnresolvedElement(descriptor, element);
}
+void CustomElementRegistrationContext::resolvePoppedElement(Element* element, const CustomElementDescriptor& descriptor)
+{
+ CustomElementDefinition* definition = m_registry.find(descriptor);
+ if (definition)
+ didResolveElement(definition, element);
+ else
+ didFailResolution(descriptor, element);
+}
+
void CustomElementRegistrationContext::didResolveElement(CustomElementDefinition* definition, Element* element)
{
CustomElement::define(element, definition);
@@ -108,6 +117,12 @@ void CustomElementRegistrationContext::didResolveElement(CustomElementDefinition
void CustomElementRegistrationContext::didCreateUnresolvedElement(const CustomElementDescriptor& descriptor, Element* element)
{
ASSERT(element->customElementState() == Element::WaitingForUpgrade);
+ CustomElementCallbackScheduler::scheduleResolutionCallback(descriptor, element);
+}
+
+void CustomElementRegistrationContext::didFailResolution(const CustomElementDescriptor& descriptor, Element* element)
+{
+ ASSERT(element->customElementState() == Element::WaitingForUpgrade);
m_candidates.add(descriptor, element);
}

Powered by Google App Engine
This is Rietveld 408576698