| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) |
| 61 { |
| 62 // Fullscreen is supported if there is no previously-established user prefer
ence, |
| 63 // security risk, or platform limitation. |
| 64 return document.settings()->fullscreenSupported(); |
| 65 } |
| 66 |
| 67 static bool fullscreenIsSupported(const Document& document, const Element& eleme
nt) |
| 68 { |
| 69 if (document.settings()->disallowFullscreenForNonMediaElements() && !isHTMLM
ediaElement(element)) |
| 70 return false; |
| 71 return fullscreenIsSupported(document); |
| 72 } |
| 73 |
| 60 static PassRefPtrWillBeRawPtr<Event> createEvent(const AtomicString& type, Event
Target& target) | 74 static PassRefPtrWillBeRawPtr<Event> createEvent(const AtomicString& type, Event
Target& target) |
| 61 { | 75 { |
| 62 RefPtrWillBeRawPtr<Event> event = Event::createBubble(type); | 76 RefPtrWillBeRawPtr<Event> event = Event::createBubble(type); |
| 63 event->setTarget(&target); | 77 event->setTarget(&target); |
| 64 return event; | 78 return event; |
| 65 } | 79 } |
| 66 | 80 |
| 67 const char* FullscreenElementStack::supplementName() | 81 const char* FullscreenElementStack::supplementName() |
| 68 { | 82 { |
| 69 return "FullscreenElementStack"; | 83 return "FullscreenElementStack"; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 break; | 220 break; |
| 207 } | 221 } |
| 208 | 222 |
| 209 // This algorithm is not allowed to show a pop-up: | 223 // 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: | 224 // 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 | 225 // - 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. | 226 // - the event listener for a trusted click event is being handled. |
| 213 if (!UserGestureIndicator::processingUserGesture()) | 227 if (!UserGestureIndicator::processingUserGesture()) |
| 214 break; | 228 break; |
| 215 | 229 |
| 216 // There is a previously-established user preference, security risk, or
platform limitation. | 230 // Fullscreen is not supported. |
| 217 if (!document()->settings()->fullscreenSupported()) | 231 if (!fullscreenIsSupported(element.document(), element)) |
| 218 break; | |
| 219 if (document()->settings()->disallowFullscreenForNonMediaElements() && !
isHTMLMediaElement(element)) | |
| 220 break; | 232 break; |
| 221 | 233 |
| 222 // 2. Let doc be element's node document. (i.e. "this") | 234 // 2. Let doc be element's node document. (i.e. "this") |
| 223 Document* currentDoc = document(); | 235 Document* currentDoc = document(); |
| 224 | 236 |
| 225 // 3. Let docs be all doc's ancestor browsing context's documents (if an
y) and doc. | 237 // 3. Let docs be all doc's ancestor browsing context's documents (if an
y) and doc. |
| 226 Deque<Document*> docs; | 238 Deque<Document*> docs; |
| 227 | 239 |
| 228 do { | 240 do { |
| 229 docs.prepend(currentDoc); | 241 docs.prepend(currentDoc); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 host->chrome().client().exitFullScreenForElement(m_fullScreenElement.get
()); | 382 host->chrome().client().exitFullScreenForElement(m_fullScreenElement.get
()); |
| 371 return; | 383 return; |
| 372 } | 384 } |
| 373 | 385 |
| 374 // Otherwise, notify the chrome of the new full screen element. | 386 // Otherwise, notify the chrome of the new full screen element. |
| 375 host->chrome().client().enterFullScreenForElement(newTop); | 387 host->chrome().client().enterFullScreenForElement(newTop); |
| 376 } | 388 } |
| 377 | 389 |
| 378 bool FullscreenElementStack::fullscreenEnabled(Document& document) | 390 bool FullscreenElementStack::fullscreenEnabled(Document& document) |
| 379 { | 391 { |
| 380 // 4. The fullscreenEnabled attribute must return true if the context object
and all ancestor | 392 // 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. | 393 // fullscreen enabled flag set and fullscreen is supported, and false oth
erwise. |
| 382 | 394 |
| 383 // Top-level browsing contexts are implied to have their allowFullScreen att
ribute set. | 395 // Top-level browsing contexts are implied to have their allowFullScreen att
ribute set. |
| 384 return fullscreenIsAllowedForAllOwners(document); | 396 return fullscreenIsAllowedForAllOwners(document) && fullscreenIsSupported(do
cument); |
| 385 } | 397 } |
| 386 | 398 |
| 387 void FullscreenElementStack::willEnterFullScreenForElement(Element* element) | 399 void FullscreenElementStack::willEnterFullScreenForElement(Element* element) |
| 388 { | 400 { |
| 389 ASSERT(element); | 401 ASSERT(element); |
| 390 if (!document()->isActive()) | 402 if (!document()->isActive()) |
| 391 return; | 403 return; |
| 392 | 404 |
| 393 if (m_fullScreenRenderer) | 405 if (m_fullScreenRenderer) |
| 394 m_fullScreenRenderer->unwrapRenderer(); | 406 m_fullScreenRenderer->unwrapRenderer(); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 | 590 |
| 579 void FullscreenElementStack::trace(Visitor* visitor) | 591 void FullscreenElementStack::trace(Visitor* visitor) |
| 580 { | 592 { |
| 581 visitor->trace(m_fullScreenElement); | 593 visitor->trace(m_fullScreenElement); |
| 582 visitor->trace(m_fullScreenElementStack); | 594 visitor->trace(m_fullScreenElementStack); |
| 583 visitor->trace(m_eventQueue); | 595 visitor->trace(m_eventQueue); |
| 584 DocumentSupplement::trace(visitor); | 596 DocumentSupplement::trace(visitor); |
| 585 } | 597 } |
| 586 | 598 |
| 587 } // namespace blink | 599 } // namespace blink |
| OLD | NEW |