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

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

Issue 2023093003: Upgrade in-document custom elements when an element is defined. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ASAN failure in test helper. Created 4 years, 7 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/Element.cpp
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index 6c7a4d1b5581b2799541bac69866ec108d4f9994..b51a9c12514140d341f19635aca90a627b042c36 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -73,6 +73,8 @@
#include "core/dom/StyleChangeReason.h"
#include "core/dom/StyleEngine.h"
#include "core/dom/Text.h"
+#include "core/dom/custom/CustomElement.h"
+#include "core/dom/custom/CustomElementsRegistry.h"
#include "core/dom/custom/V0CustomElement.h"
#include "core/dom/custom/V0CustomElementRegistrationContext.h"
#include "core/dom/shadow/InsertionPoint.h"
@@ -1421,8 +1423,14 @@ Node::InsertionNotificationRequest Element::insertedInto(ContainerNode* insertio
rareData->intersectionObserverData()->activateValidIntersectionObservers(*this);
}
- if (isUpgradedV0CustomElement() && inShadowIncludingDocument())
- V0CustomElement::didAttach(this, document());
+ if (inShadowIncludingDocument()) {
+ if (getCustomElementState() != CustomElementState::Custom && CustomElement::descriptorMayMatch(*this)) {
+ if (CustomElementsRegistry* registry = CustomElement::registry(*this))
+ registry->addCandidate(this);
+ }
+ if (isUpgradedV0CustomElement())
+ V0CustomElement::didAttach(this, document());
+ }
TreeScope& scope = insertionPoint->treeScope();
if (scope != treeScope())
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/dom/custom/CEReactionsScope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698