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 15c15451b2df73ca1b29a9169639cffaaf911047..36bb5f23bfea61d31c9ca91ebd9634e86d8526a1 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) |
dcheng
2016/05/18 01:04:34
This function should probably be renamed, it's not
alexmos
2016/05/18 15:08:33
I agree the name isn't great, but it was hard to c
dcheng
2016/05/19 00:21:34
Ehh.... maybe? I'm not too thrilled with either na
alexmos
2016/05/19 01:08:25
OK, done.
|
{ |
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) |