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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // 7. Optionally, display a message indicating how the user can exit dis
playing the context object fullscreen. | 250 // 7. Optionally, display a message indicating how the user can exit dis
playing the context object fullscreen. |
251 return; | 251 return; |
252 } while (0); | 252 } while (0); |
253 | 253 |
254 m_fullScreenErrorEventTargetQueue.append(element ? element : document()->doc
umentElement()); | 254 m_fullScreenErrorEventTargetQueue.append(element ? element : document()->doc
umentElement()); |
255 m_fullScreenChangeDelayTimer.startOneShot(0); | 255 m_fullScreenChangeDelayTimer.startOneShot(0); |
256 } | 256 } |
257 | 257 |
258 void FullscreenElementStack::webkitCancelFullScreen() | 258 void FullscreenElementStack::webkitCancelFullScreen() |
259 { | 259 { |
260 ASSERT(document()->topDocument()); | |
261 // The Mozilla "cancelFullScreen()" API behaves like the W3C "fully exit ful
lscreen" behavior, which | 260 // The Mozilla "cancelFullScreen()" API behaves like the W3C "fully exit ful
lscreen" behavior, which |
262 // is defined as: | 261 // is defined as: |
263 // "To fully exit fullscreen act as if the exitFullscreen() method was invok
ed on the top-level browsing | 262 // "To fully exit fullscreen act as if the exitFullscreen() method was invok
ed on the top-level browsing |
264 // context's document and subsequently empty that document's fullscreen elem
ent stack." | 263 // context's document and subsequently empty that document's fullscreen elem
ent stack." |
265 if (!fullscreenElementFrom(*document()->topDocument())) | 264 if (!fullscreenElementFrom(document()->topDocument())) |
266 return; | 265 return; |
267 | 266 |
268 // To achieve that aim, remove all the elements from the top document's stac
k except for the first before | 267 // To achieve that aim, remove all the elements from the top document's stac
k except for the first before |
269 // calling webkitExitFullscreen(): | 268 // calling webkitExitFullscreen(): |
270 Vector<RefPtr<Element> > replacementFullscreenElementStack; | 269 Vector<RefPtr<Element> > replacementFullscreenElementStack; |
271 replacementFullscreenElementStack.append(fullscreenElementFrom(*document()->
topDocument())); | 270 replacementFullscreenElementStack.append(fullscreenElementFrom(document()->t
opDocument())); |
272 FullscreenElementStack& topFullscreenElementStack = from(*document()->topDoc
ument()); | 271 FullscreenElementStack& topFullscreenElementStack = from(document()->topDocu
ment()); |
273 topFullscreenElementStack.m_fullScreenElementStack.swap(replacementFullscree
nElementStack); | 272 topFullscreenElementStack.m_fullScreenElementStack.swap(replacementFullscree
nElementStack); |
274 topFullscreenElementStack.webkitExitFullscreen(); | 273 topFullscreenElementStack.webkitExitFullscreen(); |
275 } | 274 } |
276 | 275 |
277 void FullscreenElementStack::webkitExitFullscreen() | 276 void FullscreenElementStack::webkitExitFullscreen() |
278 { | 277 { |
279 // The exitFullscreen() method must run these steps: | 278 // The exitFullscreen() method must run these steps: |
280 | 279 |
281 // 1. Let doc be the context object. (i.e. "this") | 280 // 1. Let doc be the context object. (i.e. "this") |
282 Document* currentDoc = document(); | 281 Document* currentDoc = document(); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 m_fullScreenRenderer->unwrapRenderer(); | 437 m_fullScreenRenderer->unwrapRenderer(); |
439 | 438 |
440 m_fullScreenElement = nullptr; | 439 m_fullScreenElement = nullptr; |
441 document()->setNeedsStyleRecalc(SubtreeStyleChange); | 440 document()->setNeedsStyleRecalc(SubtreeStyleChange); |
442 | 441 |
443 // When webkitCancelFullScreen is called, we call webkitExitFullScreen on th
e topDocument(). That | 442 // When webkitCancelFullScreen is called, we call webkitExitFullScreen on th
e topDocument(). That |
444 // means that the events will be queued there. So if we have no events here,
start the timer on | 443 // means that the events will be queued there. So if we have no events here,
start the timer on |
445 // the exiting document. | 444 // the exiting document. |
446 Document* exitingDocument = document(); | 445 Document* exitingDocument = document(); |
447 if (m_fullScreenChangeEventTargetQueue.isEmpty() && m_fullScreenErrorEventTa
rgetQueue.isEmpty()) | 446 if (m_fullScreenChangeEventTargetQueue.isEmpty() && m_fullScreenErrorEventTa
rgetQueue.isEmpty()) |
448 exitingDocument = document()->topDocument(); | 447 exitingDocument = &document()->topDocument(); |
449 ASSERT(exitingDocument); | 448 ASSERT(exitingDocument); |
450 from(*exitingDocument).m_fullScreenChangeDelayTimer.startOneShot(0); | 449 from(*exitingDocument).m_fullScreenChangeDelayTimer.startOneShot(0); |
451 } | 450 } |
452 | 451 |
453 void FullscreenElementStack::setFullScreenRenderer(RenderFullScreen* renderer) | 452 void FullscreenElementStack::setFullScreenRenderer(RenderFullScreen* renderer) |
454 { | 453 { |
455 if (renderer == m_fullScreenRenderer) | 454 if (renderer == m_fullScreenRenderer) |
456 return; | 455 return; |
457 | 456 |
458 if (renderer && m_savedPlaceholderRenderStyle) { | 457 if (renderer && m_savedPlaceholderRenderStyle) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 if (!target) | 570 if (!target) |
572 target = fullscreen->webkitCurrentFullScreenElement(); | 571 target = fullscreen->webkitCurrentFullScreenElement(); |
573 } | 572 } |
574 | 573 |
575 if (!target) | 574 if (!target) |
576 target = doc; | 575 target = doc; |
577 m_fullScreenChangeEventTargetQueue.append(target); | 576 m_fullScreenChangeEventTargetQueue.append(target); |
578 } | 577 } |
579 | 578 |
580 } // namespace WebCore | 579 } // namespace WebCore |
OLD | NEW |