Chromium Code Reviews| 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..9f821c7e99cb0acc0a059668c2e0dcc5354993e2 100644 |
| --- a/third_party/WebKit/Source/core/dom/Element.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Element.cpp |
| @@ -3056,15 +3056,30 @@ void Element::setContainsFullScreenElement(bool flag) |
| pseudoStateChanged(CSSSelector::PseudoFullScreenAncestor); |
| } |
| -static Element* parentCrossingFrameBoundaries(Element* element) |
| +static Element* nextLocalAncestorElement(Element* element) |
|
dcheng
2016/05/19 22:08:39
Suggestion: nextAncestorElement, since local is re
alexmos
2016/05/19 23:58:19
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) |
| { |
| - for (Element* element = parentCrossingFrameBoundaries(this); element; element = parentCrossingFrameBoundaries(element)) |
| + for (Element* element = nextLocalAncestorElement(this); element; element = nextLocalAncestorElement(element)) |
| element->setContainsFullScreenElement(flag); |
| } |