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

Unified Diff: Source/core/dom/CustomElementRegistry.cpp

Issue 17707002: Implement Custom Elements inserted and removed callbacks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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: Source/core/dom/CustomElementRegistry.cpp
diff --git a/Source/core/dom/CustomElementRegistry.cpp b/Source/core/dom/CustomElementRegistry.cpp
index da3dff370b898eeb32951a16936ffb5a94f9087e..6d8517bf6bba8041611c8ebb4f8746a8e599493d 100644
--- a/Source/core/dom/CustomElementRegistry.cpp
+++ b/Source/core/dom/CustomElementRegistry.cpp
@@ -138,7 +138,7 @@ void CustomElementRegistry::registerElement(CustomElementConstructorBuilder* con
for (CustomElementUpgradeCandidateMap::ElementSet::iterator it = upgradeCandidates.begin(); it != upgradeCandidates.end(); ++it) {
(*it)->setNeedsStyleRecalc(); // :unresolved has changed
- CustomElementCallbackDispatcher::instance().enqueueReadyCallback(lifecycleCallbacks.get(), *it);
+ CustomElementCallbackDispatcher::instance().enqueueCreationCallbacks(lifecycleCallbacks.get(), *it, false);
}
}
@@ -182,7 +182,7 @@ PassRefPtr<CustomElementDefinition> CustomElementRegistry::findAndCheckNamespace
return it->value;
}
-PassRefPtr<Element> CustomElementRegistry::createCustomTagElement(const QualifiedName& tagName)
+PassRefPtr<Element> CustomElementRegistry::createCustomTagElement(const QualifiedName& tagName, bool createdByParser)
{
if (!document())
return 0;
@@ -206,13 +206,13 @@ PassRefPtr<Element> CustomElementRegistry::createCustomTagElement(const Qualifie
// custom tag element will be unresolved in perpetuity.
didCreateUnresolvedElement(CustomElementDefinition::CustomTag, tagName.localName(), element.get());
} else {
- didCreateCustomTagElement(definition.get(), element.get());
+ didCreateCustomTagElement(definition.get(), element.get(), createdByParser);
}
return element.release();
}
-void CustomElementRegistry::didGiveTypeExtension(Element* element, const AtomicString& type)
+void CustomElementRegistry::didGiveTypeExtension(Element* element, const AtomicString& type, bool byParser)
dglazkov 2013/06/25 18:04:31 givenByParser? or just createdByParser for consist
{
if (!element->isHTMLElement() && !element->isSVGElement())
return;
@@ -223,13 +223,13 @@ void CustomElementRegistry::didGiveTypeExtension(Element* element, const AtomicS
// extension element will be unresolved in perpetuity.
didCreateUnresolvedElement(CustomElementDefinition::TypeExtension, type, element);
} else {
- CustomElementCallbackDispatcher::instance().enqueueReadyCallback(definition->callback(), element);
+ CustomElementCallbackDispatcher::instance().enqueueCreationCallbacks(definition->callback(), element, byParser);
}
}
-void CustomElementRegistry::didCreateCustomTagElement(CustomElementDefinition* definition, Element* element)
+void CustomElementRegistry::didCreateCustomTagElement(CustomElementDefinition* definition, Element* element, bool createdByParser)
{
- CustomElementCallbackDispatcher::instance().enqueueReadyCallback(definition->callback(), element);
+ CustomElementCallbackDispatcher::instance().enqueueCreationCallbacks(definition->callback(), element, createdByParser);
}
void CustomElementRegistry::didCreateUnresolvedElement(CustomElementDefinition::CustomElementKind kind, const AtomicString& type, Element* element)
@@ -237,6 +237,24 @@ void CustomElementRegistry::didCreateUnresolvedElement(CustomElementDefinition::
m_candidates.add(kind, type, element);
}
+void CustomElementRegistry::customElementWasInsertedIntoDocument(Element* element)
+{
+ ASSERT(element->isCustomElement());
+ ASSERT(element->inDocument());
+
+ if (RefPtr<CustomElementDefinition> definition = findFor(element))
+ CustomElementCallbackDispatcher::instance().enqueueInsertedCallback(definition->callback(), element);
+}
+
+void CustomElementRegistry::customElementWasRemovedFromDocument(Element* element)
+{
+ ASSERT(element->isCustomElement());
+ ASSERT(!element->inDocument());
+
+ if (RefPtr<CustomElementDefinition> definition = findFor(element))
+ CustomElementCallbackDispatcher::instance().enqueueRemovedCallback(definition->callback(), element);
+}
+
void CustomElementRegistry::customElementWasDestroyed(Element* element)
{
ASSERT(element->isCustomElement());

Powered by Google App Engine
This is Rietveld 408576698