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

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

Issue 2170383002: CustomElements: adopt node (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: layout test went from bad to good, deleting failure expectation Created 4 years, 4 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: 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 6e2242b3a7aebbb1310e4bc0fc4185ce2e7bd8f1..19a2847120b20c412afc5237bb20152ae6dac8b6 100644
--- a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
@@ -5,6 +5,7 @@
#include "core/dom/custom/CustomElement.h"
#include "core/dom/Document.h"
+#include "core/dom/ElementRareData.h"
dominicc (has gone to gerrit) 2016/08/03 07:56:56 Why is this necessary here?
#include "core/dom/QualifiedName.h"
#include "core/dom/custom/CEReactionsScope.h"
#include "core/dom/custom/CustomElementDefinition.h"
@@ -25,7 +26,6 @@ CustomElementsRegistry* CustomElement::registry(const Element& element)
{
return registry(element.document());
}
-
CustomElementsRegistry* CustomElement::registry(const Document& document)
{
if (LocalDOMWindow* window = document.domWindow())
@@ -36,9 +36,7 @@ CustomElementsRegistry* CustomElement::registry(const Document& document)
static CustomElementDefinition* definitionForElementWithoutCheck(const Element& element)
{
DCHECK_EQ(element.getCustomElementState(), CustomElementState::Custom);
- if (CustomElementsRegistry* registry = CustomElement::registry(element))
- return registry->definitionForName(element.localName());
- return nullptr;
+ return element.customElementDefinition();
}
CustomElementDefinition* CustomElement::definitionForElement(const Element* element)
@@ -218,6 +216,13 @@ void CustomElement::enqueueDisconnectedCallback(Element* element)
definition->enqueueDisconnectedCallback(element);
}
+void CustomElement::enqueueAdoptedCallback(Element* element)
+{
+ DCHECK_EQ(element->getCustomElementState(), CustomElementState::Custom);
+ CustomElementDefinition* definition = definitionForElementWithoutCheck(*element);
+ if (definition->hasAdoptedCallback())
+ definition->enqueueAdoptedCallback(element);
+}
void CustomElement::enqueueAttributeChangedCallback(Element* element,
const QualifiedName& name,

Powered by Google App Engine
This is Rietveld 408576698