Chromium Code Reviews| 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 // document will be detached and GC'd. We protect it here to make sure we | 489 // document will be detached and GC'd. We protect it here to make sure we |
| 490 // can finish the function successfully. | 490 // can finish the function successfully. |
| 491 RefPtrWillBeRawPtr<Document> protectDocument(document()); | 491 RefPtrWillBeRawPtr<Document> protectDocument(document()); |
| 492 WillBeHeapDeque<RefPtrWillBeMember<Node> > changeQueue; | 492 WillBeHeapDeque<RefPtrWillBeMember<Node> > changeQueue; |
| 493 m_fullScreenChangeEventTargetQueue.swap(changeQueue); | 493 m_fullScreenChangeEventTargetQueue.swap(changeQueue); |
| 494 WillBeHeapDeque<RefPtrWillBeMember<Node> > errorQueue; | 494 WillBeHeapDeque<RefPtrWillBeMember<Node> > errorQueue; |
| 495 m_fullScreenErrorEventTargetQueue.swap(errorQueue); | 495 m_fullScreenErrorEventTargetQueue.swap(errorQueue); |
| 496 | 496 |
| 497 while (!changeQueue.isEmpty()) { | 497 while (!changeQueue.isEmpty()) { |
| 498 RefPtrWillBeRawPtr<Node> node = changeQueue.takeFirst(); | 498 RefPtrWillBeRawPtr<Node> node = changeQueue.takeFirst(); |
| 499 if (!node) | |
| 500 node = document()->documentElement(); | |
| 501 // The dispatchEvent below may have blown away our documentElement. | |
|
falken
2014/07/03 01:51:42
Hmm, why is this no longer possible? Can we add do
philipj_slow
2014/07/03 13:53:00
Since we never push null to the queue and the queu
falken
2014/07/03 14:48:38
OK I see. lgtm
| |
| 502 if (!node) | |
| 503 continue; | |
| 504 | 499 |
| 505 // If the element was removed from our tree, also message the documentEl ement. Since we may | 500 // If the element was removed from our tree, also message the documentEl ement. |
| 506 // have a document hierarchy, check that node isn't in another document. | 501 if (!node->inDocument() && document()->documentElement()) |
| 507 if (!document()->contains(node.get()) && !node->inDocument()) | |
|
falken
2014/07/03 01:51:42
nice catch!
| |
| 508 changeQueue.append(document()->documentElement()); | 502 changeQueue.append(document()->documentElement()); |
| 509 | 503 |
| 510 node->dispatchEvent(Event::createBubble(EventTypeNames::webkitfullscreen change)); | 504 node->dispatchEvent(Event::createBubble(EventTypeNames::webkitfullscreen change)); |
| 511 } | 505 } |
| 512 | 506 |
| 513 while (!errorQueue.isEmpty()) { | 507 while (!errorQueue.isEmpty()) { |
| 514 RefPtrWillBeRawPtr<Node> node = errorQueue.takeFirst(); | 508 RefPtrWillBeRawPtr<Node> node = errorQueue.takeFirst(); |
| 515 if (!node) | |
| 516 node = document()->documentElement(); | |
| 517 // The dispatchEvent below may have blown away our documentElement. | |
| 518 if (!node) | |
| 519 continue; | |
| 520 | 509 |
| 521 // 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. |
| 522 // have a document hierarchy, check that node isn't in another document. | 511 if (!node->inDocument() && document()->documentElement()) |
| 523 if (!document()->contains(node.get()) && !node->inDocument()) | |
| 524 errorQueue.append(document()->documentElement()); | 512 errorQueue.append(document()->documentElement()); |
| 525 | 513 |
| 526 node->dispatchEvent(Event::createBubble(EventTypeNames::webkitfullscreen error)); | 514 node->dispatchEvent(Event::createBubble(EventTypeNames::webkitfullscreen error)); |
| 527 } | 515 } |
| 528 } | 516 } |
| 529 | 517 |
| 530 void FullscreenElementStack::fullScreenElementRemoved() | 518 void FullscreenElementStack::fullScreenElementRemoved() |
| 531 { | 519 { |
| 532 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false); | 520 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false); |
| 533 webkitCancelFullScreen(); | 521 webkitCancelFullScreen(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 void FullscreenElementStack::trace(Visitor* visitor) | 574 void FullscreenElementStack::trace(Visitor* visitor) |
| 587 { | 575 { |
| 588 visitor->trace(m_fullScreenElement); | 576 visitor->trace(m_fullScreenElement); |
| 589 visitor->trace(m_fullScreenElementStack); | 577 visitor->trace(m_fullScreenElementStack); |
| 590 visitor->trace(m_fullScreenChangeEventTargetQueue); | 578 visitor->trace(m_fullScreenChangeEventTargetQueue); |
| 591 visitor->trace(m_fullScreenErrorEventTargetQueue); | 579 visitor->trace(m_fullScreenErrorEventTargetQueue); |
| 592 DocumentSupplement::trace(visitor); | 580 DocumentSupplement::trace(visitor); |
| 593 } | 581 } |
| 594 | 582 |
| 595 } // namespace WebCore | 583 } // namespace WebCore |
| OLD | NEW |