| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 // This algorithm is not allowed to request fullscreen. | 256 // This algorithm is not allowed to request fullscreen. |
| 257 // An algorithm is allowed to request fullscreen if one of the following | 257 // An algorithm is allowed to request fullscreen if one of the following |
| 258 // is true: | 258 // is true: |
| 259 // - the algorithm is triggered by a user activation. | 259 // - the algorithm is triggered by a user activation. |
| 260 // - the algorithm is triggered by a user generated orientation change. | 260 // - the algorithm is triggered by a user generated orientation change. |
| 261 // | 261 // |
| 262 // If |forCrossProcessDescendant| is true, requestFullscreen | 262 // If |forCrossProcessDescendant| is true, requestFullscreen |
| 263 // was already called on a descendant element in another process, and | 263 // was already called on a descendant element in another process, and |
| 264 // getting here means that it already passed the user gesture check. | 264 // getting here means that it already passed the user gesture check. |
| 265 if (!UserGestureIndicator::utilizeUserGesture() && !ScopedOrientationCha
ngeIndicator::processingOrientationChange() && !forCrossProcessDescendant) { | 265 if (!UserGestureIndicator::utilizeUserGesture() && !ScopedOrientationCha
ngeIndicator::processingOrientationChange() && !forCrossProcessDescendant) { |
| 266 String message = ExceptionMessages::failedToExecute("requestFullScre
en", | 266 String message = ExceptionMessages::failedToExecute("requestFullscre
en", |
| 267 "Element", "API can only be initiated by a user gesture."); | 267 "Element", "API can only be initiated by a user gesture."); |
| 268 document()->addConsoleMessage( | 268 document()->addConsoleMessage( |
| 269 ConsoleMessage::create(JSMessageSource, WarningMessageLevel, mes
sage)); | 269 ConsoleMessage::create(JSMessageSource, WarningMessageLevel, mes
sage)); |
| 270 break; | 270 break; |
| 271 } | 271 } |
| 272 | 272 |
| 273 // 2. Let doc be element's node document. (i.e. "this") | 273 // 2. Let doc be element's node document. (i.e. "this") |
| 274 Document* currentDoc = document(); | 274 Document* currentDoc = document(); |
| 275 | 275 |
| 276 // 3. Let docs be all doc's ancestor browsing context's documents (if an
y) and doc. | 276 // 3. Let docs be all doc's ancestor browsing context's documents (if an
y) and doc. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 continue; | 324 continue; |
| 325 } | 325 } |
| 326 | 326 |
| 327 // 4. Otherwise, do nothing for this document. It stays the same. | 327 // 4. Otherwise, do nothing for this document. It stays the same. |
| 328 } while (++current != docs.end()); | 328 } while (++current != docs.end()); |
| 329 | 329 |
| 330 m_forCrossProcessDescendant = forCrossProcessDescendant; | 330 m_forCrossProcessDescendant = forCrossProcessDescendant; |
| 331 | 331 |
| 332 // 5. Return, and run the remaining steps asynchronously. | 332 // 5. Return, and run the remaining steps asynchronously. |
| 333 // 6. Optionally, perform some animation. | 333 // 6. Optionally, perform some animation. |
| 334 document()->frameHost()->chromeClient().enterFullScreenForElement(&eleme
nt); | 334 document()->frameHost()->chromeClient().enterFullscreenForElement(&eleme
nt); |
| 335 | 335 |
| 336 // 7. Optionally, display a message indicating how the user can exit dis
playing the context object fullscreen. | 336 // 7. Optionally, display a message indicating how the user can exit dis
playing the context object fullscreen. |
| 337 return; | 337 return; |
| 338 } while (false); | 338 } while (false); |
| 339 | 339 |
| 340 enqueueErrorEvent(element, requestType); | 340 enqueueErrorEvent(element, requestType); |
| 341 } | 341 } |
| 342 | 342 |
| 343 void Fullscreen::fullyExitFullscreen(Document& document) | 343 void Fullscreen::fullyExitFullscreen(Document& document) |
| 344 { | 344 { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 | 454 |
| 455 // Only exit out of full screen window mode if there are no remaining elemen
ts in the | 455 // Only exit out of full screen window mode if there are no remaining elemen
ts in the |
| 456 // full screen stack. | 456 // full screen stack. |
| 457 if (!newTop) { | 457 if (!newTop) { |
| 458 // FIXME: if the frame exiting fullscreen is not the frame that entered | 458 // FIXME: if the frame exiting fullscreen is not the frame that entered |
| 459 // fullscreen (but a parent frame for example), | 459 // fullscreen (but a parent frame for example), |
| 460 // m_currentFullScreenElement might be null. We want to pass an element | 460 // m_currentFullScreenElement might be null. We want to pass an element |
| 461 // that is part of the document so we will pass the documentElement in | 461 // that is part of the document so we will pass the documentElement in |
| 462 // that case. This should be fix by exiting fullscreen for a frame | 462 // that case. This should be fix by exiting fullscreen for a frame |
| 463 // instead of an element, see https://crbug.com/441259 | 463 // instead of an element, see https://crbug.com/441259 |
| 464 host->chromeClient().exitFullScreenForElement( | 464 host->chromeClient().exitFullscreenForElement( |
| 465 m_currentFullScreenElement ? m_currentFullScreenElement.get() : docu
ment()->documentElement()); | 465 m_currentFullScreenElement ? m_currentFullScreenElement.get() : docu
ment()->documentElement()); |
| 466 return; | 466 return; |
| 467 } | 467 } |
| 468 | 468 |
| 469 // Otherwise, notify the chrome of the new full screen element. | 469 // Otherwise, notify the chrome of the new full screen element. |
| 470 host->chromeClient().enterFullScreenForElement(newTop); | 470 host->chromeClient().enterFullscreenForElement(newTop); |
| 471 } | 471 } |
| 472 | 472 |
| 473 bool Fullscreen::fullscreenEnabled(Document& document) | 473 bool Fullscreen::fullscreenEnabled(Document& document) |
| 474 { | 474 { |
| 475 // 4. The fullscreenEnabled attribute must return true if the context object
has its | 475 // 4. The fullscreenEnabled attribute must return true if the context object
has its |
| 476 // fullscreen enabled flag set and fullscreen is supported, and false oth
erwise. | 476 // fullscreen enabled flag set and fullscreen is supported, and false oth
erwise. |
| 477 | 477 |
| 478 // Top-level browsing contexts are implied to have their allowFullScreen att
ribute set. | 478 // Top-level browsing contexts are implied to have their allowfullscreen att
ribute set. |
| 479 return fullscreenIsAllowedForAllOwners(document) && fullscreenIsSupported(do
cument); | 479 return fullscreenIsAllowedForAllOwners(document) && fullscreenIsSupported(do
cument); |
| 480 } | 480 } |
| 481 | 481 |
| 482 void Fullscreen::didEnterFullscreenForElement(Element* element) | 482 void Fullscreen::didEnterFullscreenForElement(Element* element) |
| 483 { | 483 { |
| 484 DCHECK(element); | 484 DCHECK(element); |
| 485 if (!document()->isActive()) | 485 if (!document()->isActive()) |
| 486 return; | 486 return; |
| 487 | 487 |
| 488 if (m_fullScreenLayoutObject) | 488 if (m_fullScreenLayoutObject) |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 DEFINE_TRACE(Fullscreen) | 688 DEFINE_TRACE(Fullscreen) |
| 689 { | 689 { |
| 690 visitor->trace(m_currentFullScreenElement); | 690 visitor->trace(m_currentFullScreenElement); |
| 691 visitor->trace(m_fullscreenElementStack); | 691 visitor->trace(m_fullscreenElementStack); |
| 692 visitor->trace(m_eventQueue); | 692 visitor->trace(m_eventQueue); |
| 693 Supplement<Document>::trace(visitor); | 693 Supplement<Document>::trace(visitor); |
| 694 ContextLifecycleObserver::trace(visitor); | 694 ContextLifecycleObserver::trace(visitor); |
| 695 } | 695 } |
| 696 | 696 |
| 697 } // namespace blink | 697 } // namespace blink |
| OLD | NEW |