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

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

Issue 144023016: Separate Custom Element resolution and upgrade/createdCallback. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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/custom/CustomElementCallbackInvocation.cpp
diff --git a/Source/core/dom/custom/CustomElementCallbackInvocation.cpp b/Source/core/dom/custom/CustomElementCallbackInvocation.cpp
index a033323c759508d76658106768cb6cdb77f3d0d4..b7eb8e4d0d751e96b91eb0067b2efe6de5ec4e0a 100644
--- a/Source/core/dom/custom/CustomElementCallbackInvocation.cpp
+++ b/Source/core/dom/custom/CustomElementCallbackInvocation.cpp
@@ -92,9 +92,31 @@ void AttributeChangedInvocation::dispatch(Element* element)
callbacks()->attributeChanged(element, m_name, m_oldValue, m_newValue);
}
+class CreatedInvocation : public CustomElementCallbackInvocation {
+public:
+ CreatedInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks)
+ : CustomElementCallbackInvocation(callbacks)
+ {
+ }
+
+private:
+ virtual void dispatch(Element*) OVERRIDE;
+ virtual bool isCreated() const OVERRIDE { return true; }
+};
+
+void CreatedInvocation::dispatch(Element* element)
+{
+ if (element->inDocument() && element->document().domWindow())
+ CustomElementScheduler::scheduleAttachedCallback(callbacks(), element);
+ callbacks()->created(element);
+}
+
PassOwnPtr<CustomElementCallbackInvocation> CustomElementCallbackInvocation::createInvocation(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, CustomElementLifecycleCallbacks::CallbackType which)
{
switch (which) {
+ case CustomElementLifecycleCallbacks::Created:
+ return adoptPtr(new CreatedInvocation(callbacks));
+
case CustomElementLifecycleCallbacks::Attached:
case CustomElementLifecycleCallbacks::Detached:
return adoptPtr(new AttachedDetachedInvocation(callbacks, which));
« no previous file with comments | « Source/core/dom/custom/CustomElementCallbackInvocation.h ('k') | Source/core/dom/custom/CustomElementMicrotaskDispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698