Chromium Code Reviews| 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()) { |
|
dominicc (has gone to gerrit)
2016/07/13 06:12:30
FYI haraken says in Q4 that Blink will be able to
|
| + 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); |
| } |