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

Side by Side Diff: Source/core/dom/Fullscreen.cpp

Issue 485443002: Prevent mis-nested fullscreen in iframes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: set_commit Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fullscreen/api/element-ready-check-containing-iframe.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2013 Google Inc. All rights reserved. 9 * Copyright (C) 2013 Google Inc. All rights reserved.
10 * 10 *
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 // |element|'s node document's fullscreen enabled flag is set. 179 // |element|'s node document's fullscreen enabled flag is set.
180 if (!fullscreenIsAllowedForAllOwners(element.document())) { 180 if (!fullscreenIsAllowedForAllOwners(element.document())) {
181 if (requestType == PrefixedVideoRequest) 181 if (requestType == PrefixedVideoRequest)
182 UseCounter::count(element.document(), UseCounter::VideoFullscreenAll owedExemption); 182 UseCounter::count(element.document(), UseCounter::VideoFullscreenAll owedExemption);
183 else 183 else
184 return false; 184 return false;
185 } 185 }
186 186
187 // |element|'s node document's fullscreen element stack is either empty or i ts top element is an 187 // |element|'s node document's fullscreen element stack is either empty or i ts top element is an
188 // ancestor of |element|. 188 // inclusive ancestor of |element|.
189 if (Element* topElement = fullscreenElementFrom(element.document())) { 189 if (Element* topElement = fullscreenElementFrom(element.document())) {
190 if (!element.isDescendantOf(topElement)) 190 if (!topElement->contains(&element))
191 return false; 191 return false;
192 } 192 }
193 193
194 // |element| has no ancestor element whose local name is iframe and namespac e is the HTML 194 // |element| has no ancestor element whose local name is iframe and namespac e is the HTML
195 // namespace. 195 // namespace.
196 if (Traversal<HTMLIFrameElement>::firstAncestor(element)) 196 if (Traversal<HTMLIFrameElement>::firstAncestor(element))
197 return false; 197 return false;
198 198
199 // |element|'s node document's browsing context either has a browsing contex t container and the
200 // fullscreen element ready check returns true for |element|'s node document 's browsing
201 // context's browsing context container, or it has no browsing context conta iner.
202 if (HTMLFrameOwnerElement* container = element.document().ownerElement()) {
203 if (!elementReady(*container, requestType))
204 return false;
205 }
206
199 return true; 207 return true;
200 } 208 }
201 209
202 void Fullscreen::requestFullscreen(Element& element, RequestType requestType) 210 void Fullscreen::requestFullscreen(Element& element, RequestType requestType)
203 { 211 {
204 // Ignore this request if the document is not in a live frame. 212 // Ignore this request if the document is not in a live frame.
205 if (!document()->isActive()) 213 if (!document()->isActive())
206 return; 214 return;
207 215
208 // If |element| is on top of |doc|'s fullscreen element stack, terminate the se substeps. 216 // If |element| is on top of |doc|'s fullscreen element stack, terminate the se substeps.
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 void Fullscreen::trace(Visitor* visitor) 610 void Fullscreen::trace(Visitor* visitor)
603 { 611 {
604 visitor->trace(m_fullScreenElement); 612 visitor->trace(m_fullScreenElement);
605 visitor->trace(m_fullScreenElementStack); 613 visitor->trace(m_fullScreenElementStack);
606 visitor->trace(m_fullScreenRenderer); 614 visitor->trace(m_fullScreenRenderer);
607 visitor->trace(m_eventQueue); 615 visitor->trace(m_eventQueue);
608 DocumentSupplement::trace(visitor); 616 DocumentSupplement::trace(visitor);
609 } 617 }
610 618
611 } // namespace blink 619 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fullscreen/api/element-ready-check-containing-iframe.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698