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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 { | 261 { |
262 // The Mozilla "cancelFullScreen()" API behaves like the W3C "fully exit ful
lscreen" behavior, which | 262 // The Mozilla "cancelFullScreen()" API behaves like the W3C "fully exit ful
lscreen" behavior, which |
263 // is defined as: | 263 // is defined as: |
264 // "To fully exit fullscreen act as if the exitFullscreen() method was invok
ed on the top-level browsing | 264 // "To fully exit fullscreen act as if the exitFullscreen() method was invok
ed on the top-level browsing |
265 // context's document and subsequently empty that document's fullscreen elem
ent stack." | 265 // context's document and subsequently empty that document's fullscreen elem
ent stack." |
266 if (!fullscreenElementFrom(document()->topDocument())) | 266 if (!fullscreenElementFrom(document()->topDocument())) |
267 return; | 267 return; |
268 | 268 |
269 // To achieve that aim, remove all the elements from the top document's stac
k except for the first before | 269 // To achieve that aim, remove all the elements from the top document's stac
k except for the first before |
270 // calling webkitExitFullscreen(): | 270 // calling webkitExitFullscreen(): |
271 Vector<RefPtr<Element> > replacementFullscreenElementStack; | 271 WillBeHeapVector<RefPtrWillBeMember<Element> > replacementFullscreenElementS
tack; |
272 replacementFullscreenElementStack.append(fullscreenElementFrom(document()->t
opDocument())); | 272 replacementFullscreenElementStack.append(fullscreenElementFrom(document()->t
opDocument())); |
273 FullscreenElementStack& topFullscreenElementStack = from(document()->topDocu
ment()); | 273 FullscreenElementStack& topFullscreenElementStack = from(document()->topDocu
ment()); |
274 topFullscreenElementStack.m_fullScreenElementStack.swap(replacementFullscree
nElementStack); | 274 topFullscreenElementStack.m_fullScreenElementStack.swap(replacementFullscree
nElementStack); |
275 topFullscreenElementStack.webkitExitFullscreen(); | 275 topFullscreenElementStack.webkitExitFullscreen(); |
276 } | 276 } |
277 | 277 |
278 void FullscreenElementStack::webkitExitFullscreen() | 278 void FullscreenElementStack::webkitExitFullscreen() |
279 { | 279 { |
280 // The exitFullscreen() method must run these steps: | 280 // The exitFullscreen() method must run these steps: |
281 | 281 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 void FullscreenElementStack::fullScreenRendererDestroyed() | 470 void FullscreenElementStack::fullScreenRendererDestroyed() |
471 { | 471 { |
472 m_fullScreenRenderer = 0; | 472 m_fullScreenRenderer = 0; |
473 } | 473 } |
474 | 474 |
475 void FullscreenElementStack::fullScreenChangeDelayTimerFired(Timer<FullscreenEle
mentStack>*) | 475 void FullscreenElementStack::fullScreenChangeDelayTimerFired(Timer<FullscreenEle
mentStack>*) |
476 { | 476 { |
477 // Since we dispatch events in this function, it's possible that the | 477 // Since we dispatch events in this function, it's possible that the |
478 // document will be detached and GC'd. We protect it here to make sure we | 478 // document will be detached and GC'd. We protect it here to make sure we |
479 // can finish the function successfully. | 479 // can finish the function successfully. |
480 RefPtr<Document> protectDocument(document()); | 480 RefPtrWillBeRawPtr<Document> protectDocument(document()); |
481 Deque<RefPtr<Node> > changeQueue; | 481 WillBeHeapDeque<RefPtrWillBeMember<Node> > changeQueue; |
482 m_fullScreenChangeEventTargetQueue.swap(changeQueue); | 482 m_fullScreenChangeEventTargetQueue.swap(changeQueue); |
483 Deque<RefPtr<Node> > errorQueue; | 483 WillBeHeapDeque<RefPtrWillBeMember<Node> > errorQueue; |
484 m_fullScreenErrorEventTargetQueue.swap(errorQueue); | 484 m_fullScreenErrorEventTargetQueue.swap(errorQueue); |
485 | 485 |
486 while (!changeQueue.isEmpty()) { | 486 while (!changeQueue.isEmpty()) { |
487 RefPtr<Node> node = changeQueue.takeFirst(); | 487 RefPtrWillBeRawPtr<Node> node = changeQueue.takeFirst(); |
488 if (!node) | 488 if (!node) |
489 node = document()->documentElement(); | 489 node = document()->documentElement(); |
490 // The dispatchEvent below may have blown away our documentElement. | 490 // The dispatchEvent below may have blown away our documentElement. |
491 if (!node) | 491 if (!node) |
492 continue; | 492 continue; |
493 | 493 |
494 // If the element was removed from our tree, also message the documentEl
ement. Since we may | 494 // If the element was removed from our tree, also message the documentEl
ement. Since we may |
495 // have a document hierarchy, check that node isn't in another document. | 495 // have a document hierarchy, check that node isn't in another document. |
496 if (!document()->contains(node.get()) && !node->inDocument()) | 496 if (!document()->contains(node.get()) && !node->inDocument()) |
497 changeQueue.append(document()->documentElement()); | 497 changeQueue.append(document()->documentElement()); |
498 | 498 |
499 node->dispatchEvent(Event::createBubble(EventTypeNames::webkitfullscreen
change)); | 499 node->dispatchEvent(Event::createBubble(EventTypeNames::webkitfullscreen
change)); |
500 } | 500 } |
501 | 501 |
502 while (!errorQueue.isEmpty()) { | 502 while (!errorQueue.isEmpty()) { |
503 RefPtr<Node> node = errorQueue.takeFirst(); | 503 RefPtrWillBeRawPtr<Node> node = errorQueue.takeFirst(); |
504 if (!node) | 504 if (!node) |
505 node = document()->documentElement(); | 505 node = document()->documentElement(); |
506 // The dispatchEvent below may have blown away our documentElement. | 506 // The dispatchEvent below may have blown away our documentElement. |
507 if (!node) | 507 if (!node) |
508 continue; | 508 continue; |
509 | 509 |
510 // If the element was removed from our tree, also message the documentEl
ement. Since we may | 510 // If the element was removed from our tree, also message the documentEl
ement. Since we may |
511 // have a document hierarchy, check that node isn't in another document. | 511 // have a document hierarchy, check that node isn't in another document. |
512 if (!document()->contains(node.get()) && !node->inDocument()) | 512 if (!document()->contains(node.get()) && !node->inDocument()) |
513 errorQueue.append(document()->documentElement()); | 513 errorQueue.append(document()->documentElement()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 target = fullscreen->webkitFullscreenElement(); | 568 target = fullscreen->webkitFullscreenElement(); |
569 if (!target) | 569 if (!target) |
570 target = fullscreen->webkitCurrentFullScreenElement(); | 570 target = fullscreen->webkitCurrentFullScreenElement(); |
571 } | 571 } |
572 | 572 |
573 if (!target) | 573 if (!target) |
574 target = doc; | 574 target = doc; |
575 m_fullScreenChangeEventTargetQueue.append(target); | 575 m_fullScreenChangeEventTargetQueue.append(target); |
576 } | 576 } |
577 | 577 |
| 578 void FullscreenElementStack::trace(Visitor* visitor) |
| 579 { |
| 580 visitor->trace(m_fullScreenElement); |
| 581 visitor->trace(m_fullScreenElementStack); |
| 582 visitor->trace(m_fullScreenChangeEventTargetQueue); |
| 583 visitor->trace(m_fullScreenErrorEventTargetQueue); |
| 584 } |
| 585 |
578 } // namespace WebCore | 586 } // namespace WebCore |
OLD | NEW |