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

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

Issue 18167006: Implement Custom Elements' entered and left document callbacks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Feedback. Created 7 years, 5 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
« no previous file with comments | « Source/core/dom/CustomElementLifecycleCallbacks.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 2d21a43b0d8f3cea956828f9ca8b3e6aac3ebc79..5007525401807cff52d79cd8a586c98c911a2b53 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -1268,6 +1268,11 @@ Node::InsertionNotificationRequest Element::insertedInto(ContainerNode* insertio
if (scope != treeScope())
return InsertionDone;
+ if (isUpgradedCustomElement()) {
+ RefPtr<CustomElementDefinition> definition = document()->registry()->findFor(this);
+ CustomElementCallbackDispatcher::instance().enqueueEnteredDocumentCallback(definition->callbacks(), this);
+ }
+
const AtomicString& idValue = getIdAttribute();
if (!idValue.isNull())
updateId(scope, nullAtom, idValue);
@@ -1323,8 +1328,17 @@ void Element::removedFrom(ContainerNode* insertionPoint)
}
ContainerNode::removedFrom(insertionPoint);
- if (wasInDocument && hasPendingResources())
- document()->accessSVGExtensions()->removeElementFromPendingResources(this);
+ if (wasInDocument) {
+ if (hasPendingResources())
+ document()->accessSVGExtensions()->removeElementFromPendingResources(this);
+
+ if (isUpgradedCustomElement()) {
+ if (CustomElementRegistry* registry = document()->registry()) {
+ RefPtr<CustomElementDefinition> definition = registry->findFor(this);
+ CustomElementCallbackDispatcher::instance().enqueueLeftDocumentCallback(definition->callbacks(), this);
+ }
+ }
+ }
}
void Element::createRendererIfNeeded(const AttachContext& context)
« no previous file with comments | « Source/core/dom/CustomElementLifecycleCallbacks.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698