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

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

Issue 426593010: Set fullscreenEnabled to false when fullscreen is not supported. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 { 50 {
51 for (const HTMLFrameOwnerElement* owner = document.ownerElement(); owner; ow ner = owner->document().ownerElement()) { 51 for (const HTMLFrameOwnerElement* owner = document.ownerElement(); owner; ow ner = owner->document().ownerElement()) {
52 if (!isHTMLIFrameElement(owner)) 52 if (!isHTMLIFrameElement(owner))
53 return false; 53 return false;
54 if (!owner->hasAttribute(allowfullscreenAttr)) 54 if (!owner->hasAttribute(allowfullscreenAttr))
55 return false; 55 return false;
56 } 56 }
57 return true; 57 return true;
58 } 58 }
59 59
60 static bool fullscreenIsSupported(const Document& document, const Element* eleme nt)
philipj_slow 2014/08/04 09:24:13 I think this would be slightly nicer with separate
Ignacio Solla 2014/08/04 11:43:33 Done.
61 {
62 // Fullscreen is supported if there is no previously-established user prefer ence,
63 // security risk, or platform limitation.
64 if (element && document.settings()->disallowFullscreenForNonMediaElements() && !isHTMLMediaElement(*element))
65 return false;
66 return document.settings()->fullscreenEnabled();
67 }
68
60 static PassRefPtrWillBeRawPtr<Event> createEvent(const AtomicString& type, Event Target& target) 69 static PassRefPtrWillBeRawPtr<Event> createEvent(const AtomicString& type, Event Target& target)
61 { 70 {
62 RefPtrWillBeRawPtr<Event> event = Event::createBubble(type); 71 RefPtrWillBeRawPtr<Event> event = Event::createBubble(type);
63 event->setTarget(&target); 72 event->setTarget(&target);
64 return event; 73 return event;
65 } 74 }
66 75
67 const char* FullscreenElementStack::supplementName() 76 const char* FullscreenElementStack::supplementName()
68 { 77 {
69 return "FullscreenElementStack"; 78 return "FullscreenElementStack";
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 break; 215 break;
207 } 216 }
208 217
209 // This algorithm is not allowed to show a pop-up: 218 // This algorithm is not allowed to show a pop-up:
210 // An algorithm is allowed to show a pop-up if, in the task in which t he algorithm is running, either: 219 // An algorithm is allowed to show a pop-up if, in the task in which t he algorithm is running, either:
211 // - an activation behavior is currently being processed whose click e vent was trusted, or 220 // - an activation behavior is currently being processed whose click e vent was trusted, or
212 // - the event listener for a trusted click event is being handled. 221 // - the event listener for a trusted click event is being handled.
213 if (!UserGestureIndicator::processingUserGesture()) 222 if (!UserGestureIndicator::processingUserGesture())
214 break; 223 break;
215 224
216 // There is a previously-established user preference, security risk, or platform limitation. 225 // Fullscreen is not supported.
217 if (!document()->settings()->fullscreenEnabled()) 226 if (!fullscreenIsSupported(element.document(), &element))
218 break;
219 if (document()->settings()->disallowFullscreenForNonMediaElements() && ! isHTMLMediaElement(element))
220 break; 227 break;
221 228
222 // 2. Let doc be element's node document. (i.e. "this") 229 // 2. Let doc be element's node document. (i.e. "this")
223 Document* currentDoc = document(); 230 Document* currentDoc = document();
224 231
225 // 3. Let docs be all doc's ancestor browsing context's documents (if an y) and doc. 232 // 3. Let docs be all doc's ancestor browsing context's documents (if an y) and doc.
226 Deque<Document*> docs; 233 Deque<Document*> docs;
227 234
228 do { 235 do {
229 docs.prepend(currentDoc); 236 docs.prepend(currentDoc);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 host->chrome().client().exitFullScreenForElement(m_fullScreenElement.get ()); 377 host->chrome().client().exitFullScreenForElement(m_fullScreenElement.get ());
371 return; 378 return;
372 } 379 }
373 380
374 // Otherwise, notify the chrome of the new full screen element. 381 // Otherwise, notify the chrome of the new full screen element.
375 host->chrome().client().enterFullScreenForElement(newTop); 382 host->chrome().client().enterFullScreenForElement(newTop);
376 } 383 }
377 384
378 bool FullscreenElementStack::fullscreenEnabled(Document& document) 385 bool FullscreenElementStack::fullscreenEnabled(Document& document)
379 { 386 {
380 // 4. The fullscreenEnabled attribute must return true if the context object and all ancestor 387 // 4. The fullscreenEnabled attribute must return true if the context object has its
381 // browsing context's documents have their fullscreen enabled flag set, or f alse otherwise. 388 // fullscreen enabled flag set and fullscreen is supported, and false oth erwise.
382 389
383 // Top-level browsing contexts are implied to have their allowFullScreen att ribute set. 390 // Top-level browsing contexts are implied to have their allowFullScreen att ribute set.
384 return fullscreenIsAllowedForAllOwners(document); 391 return fullscreenIsAllowedForAllOwners(document) && fullscreenIsSupported(do cument, 0);
385 } 392 }
386 393
387 void FullscreenElementStack::willEnterFullScreenForElement(Element* element) 394 void FullscreenElementStack::willEnterFullScreenForElement(Element* element)
388 { 395 {
389 ASSERT(element); 396 ASSERT(element);
390 if (!document()->isActive()) 397 if (!document()->isActive())
391 return; 398 return;
392 399
393 if (m_fullScreenRenderer) 400 if (m_fullScreenRenderer)
394 m_fullScreenRenderer->unwrapRenderer(); 401 m_fullScreenRenderer->unwrapRenderer();
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 585
579 void FullscreenElementStack::trace(Visitor* visitor) 586 void FullscreenElementStack::trace(Visitor* visitor)
580 { 587 {
581 visitor->trace(m_fullScreenElement); 588 visitor->trace(m_fullScreenElement);
582 visitor->trace(m_fullScreenElementStack); 589 visitor->trace(m_fullScreenElementStack);
583 visitor->trace(m_eventQueue); 590 visitor->trace(m_eventQueue);
584 DocumentSupplement::trace(visitor); 591 DocumentSupplement::trace(visitor);
585 } 592 }
586 593
587 } // namespace blink 594 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698