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

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

Issue 2242743002: Make custom elements work in HTML imports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase wip 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 282fa462f1cec75149c5b5725d8acbb0f682adb5..736513fb7040e1cdb7afa26a6f588a634de3e694 100644
--- a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
@@ -24,10 +24,13 @@ CustomElementsRegistry* CustomElement::registry(const Element& element)
{
return registry(element.document());
}
+
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;
}
@@ -81,6 +84,7 @@ bool CustomElement::isValidName(const AtomicString& name)
bool CustomElement::shouldCreateCustomElement(Document& document, const AtomicString& localName)
{
return RuntimeEnabledFeatures::customElementsV1Enabled()
+ && document.contextDocument() && document.contextDocument()->frame()
&& isValidName(localName);
}

Powered by Google App Engine
This is Rietveld 408576698