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

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

Issue 2132343002: Make Custom Elements V1 work in HTML imports documents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: imports-create tests checks the order of constructors Created 4 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
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 bab2bec31f979861f122309a32330b8eedf6d6be..57061b3d7e5af5c49d6b11ad9ac13fae50d45391 100644
--- a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
@@ -27,8 +27,17 @@ CustomElementsRegistry* CustomElement::registry(const Element& element)
CustomElementsRegistry* CustomElement::registry(const Document& document)
{
- if (LocalDOMWindow* window = document.domWindow())
- return window->customElements();
+ if (Document* contextDocument = const_cast<Document&>(document).contextDocument()) {
+ if (LocalDOMWindow* window = contextDocument->domWindow())
+ return window->customElements();
+ }
+ return nullptr;
+}
+
+FrameHost* CustomElement::contextFrameHost(const Element& element)
+{
+ if (Document* contextDocument = element.document().contextDocument())
+ return contextDocument->frameHost();
return nullptr;
}
@@ -78,7 +87,8 @@ bool CustomElement::isValidName(const AtomicString& name)
bool CustomElement::shouldCreateCustomElement(Document& document, const AtomicString& localName)
{
return RuntimeEnabledFeatures::customElementsV1Enabled()
- && document.frame() && isValidName(localName);
+ && document.contextDocument() && document.contextDocument()->frame()
+ && isValidName(localName);
}
bool CustomElement::shouldCreateCustomElement(Document& document, const QualifiedName& tagName)
@@ -176,7 +186,7 @@ void CustomElement::enqueue(Element* element, CustomElementReaction* reaction)
// If the custom element reactions stack is empty, then
// Add element to the backup element queue.
- element->document().frameHost()->customElementReactionStack()
+ contextFrameHost(*element)->customElementReactionStack()
.enqueueToBackupQueue(element, reaction);
}

Powered by Google App Engine
This is Rietveld 408576698