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 4ae2e5d3a125ab92f99efd46fe859e6352e0f4ae..a8c4f22deedc3affe8824223d999c0eb9b0b6174 100644 |
--- a/third_party/WebKit/Source/core/dom/Element.cpp |
+++ b/third_party/WebKit/Source/core/dom/Element.cpp |
@@ -3059,7 +3059,22 @@ void Element::setContainsFullScreenElement(bool flag) |
static Element* parentCrossingFrameBoundaries(Element* element) |
{ |
DCHECK(element); |
- return element->parentElement() ? element->parentElement() : element->document().localOwner(); |
+ if (element->parentElement()) |
+ return element->parentElement(); |
+ |
+ Frame* frame = element->document().frame(); |
+ if (!frame || !frame->owner()) |
+ return nullptr; |
+ |
+ // Find the next LocalFrame on the ancestor chain, and return the |
+ // corresponding <iframe> element for the remote child if it exists. |
+ while (frame->tree().parent() && frame->tree().parent()->isRemoteFrame()) |
+ frame = frame->tree().parent(); |
+ |
+ if (frame->owner() && frame->owner()->isLocal()) |
+ return toHTMLFrameOwnerElement(frame->owner()); |
+ |
+ return nullptr; |
} |
void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(bool flag) |