OLD | NEW |
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 return true; | 58 return true; |
59 } | 59 } |
60 | 60 |
61 static bool fullscreenIsSupported(const Document& document) | 61 static bool fullscreenIsSupported(const Document& document) |
62 { | 62 { |
63 // Fullscreen is supported if there is no previously-established user prefer
ence, | 63 // Fullscreen is supported if there is no previously-established user prefer
ence, |
64 // security risk, or platform limitation. | 64 // security risk, or platform limitation. |
65 return !document.settings() || document.settings()->fullscreenSupported(); | 65 return !document.settings() || document.settings()->fullscreenSupported(); |
66 } | 66 } |
67 | 67 |
68 static bool fullscreenIsSupported(const Document& document, const Element& eleme
nt) | |
69 { | |
70 if (!document.settings() || (document.settings()->disallowFullscreenForNonMe
diaElements() && !isHTMLMediaElement(element))) | |
71 return false; | |
72 return fullscreenIsSupported(document); | |
73 } | |
74 | |
75 static bool fullscreenElementReady(const Element& element, Fullscreen::RequestTy
pe requestType) | 68 static bool fullscreenElementReady(const Element& element, Fullscreen::RequestTy
pe requestType) |
76 { | 69 { |
77 // A fullscreen element ready check for an element |element| returns true if
all of the | 70 // A fullscreen element ready check for an element |element| returns true if
all of the |
78 // following are true, and false otherwise: | 71 // following are true, and false otherwise: |
79 | 72 |
80 // |element| is in a document. | 73 // |element| is in a document. |
81 if (!element.inDocument()) | 74 if (!element.inDocument()) |
82 return false; | 75 return false; |
83 | 76 |
84 // |element|'s node document's fullscreen enabled flag is set. | 77 // |element|'s node document's fullscreen enabled flag is set. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // - the event listener for a trusted click event is being handled. | 226 // - the event listener for a trusted click event is being handled. |
234 if (!UserGestureIndicator::processingUserGesture()) { | 227 if (!UserGestureIndicator::processingUserGesture()) { |
235 String message = ExceptionMessages::failedToExecute("requestFullScre
en", | 228 String message = ExceptionMessages::failedToExecute("requestFullScre
en", |
236 "Element", "API can only be initiated by a user gesture."); | 229 "Element", "API can only be initiated by a user gesture."); |
237 document()->executionContext()->addConsoleMessage( | 230 document()->executionContext()->addConsoleMessage( |
238 ConsoleMessage::create(JSMessageSource, WarningMessageLevel, mes
sage)); | 231 ConsoleMessage::create(JSMessageSource, WarningMessageLevel, mes
sage)); |
239 break; | 232 break; |
240 } | 233 } |
241 | 234 |
242 // Fullscreen is not supported. | 235 // Fullscreen is not supported. |
243 if (!fullscreenIsSupported(element.document(), element)) | 236 if (!fullscreenIsSupported(element.document())) |
244 break; | 237 break; |
245 | 238 |
246 // 2. Let doc be element's node document. (i.e. "this") | 239 // 2. Let doc be element's node document. (i.e. "this") |
247 Document* currentDoc = document(); | 240 Document* currentDoc = document(); |
248 | 241 |
249 // 3. Let docs be all doc's ancestor browsing context's documents (if an
y) and doc. | 242 // 3. Let docs be all doc's ancestor browsing context's documents (if an
y) and doc. |
250 Deque<Document*> docs; | 243 Deque<Document*> docs; |
251 | 244 |
252 do { | 245 do { |
253 docs.prepend(currentDoc); | 246 docs.prepend(currentDoc); |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 void Fullscreen::trace(Visitor* visitor) | 601 void Fullscreen::trace(Visitor* visitor) |
609 { | 602 { |
610 visitor->trace(m_fullScreenElement); | 603 visitor->trace(m_fullScreenElement); |
611 visitor->trace(m_fullScreenElementStack); | 604 visitor->trace(m_fullScreenElementStack); |
612 visitor->trace(m_fullScreenRenderer); | 605 visitor->trace(m_fullScreenRenderer); |
613 visitor->trace(m_eventQueue); | 606 visitor->trace(m_eventQueue); |
614 DocumentSupplement::trace(visitor); | 607 DocumentSupplement::trace(visitor); |
615 } | 608 } |
616 | 609 |
617 } // namespace blink | 610 } // namespace blink |
OLD | NEW |