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, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 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) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 5725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5736 if (!m_fullScreenRenderer) | 5736 if (!m_fullScreenRenderer) |
5737 return; | 5737 return; |
5738 | 5738 |
5739 RefPtr<RenderStyle> newStyle = RenderStyle::clone(m_fullScreenRenderer->styl
e()); | 5739 RefPtr<RenderStyle> newStyle = RenderStyle::clone(m_fullScreenRenderer->styl
e()); |
5740 newStyle->setBackgroundColor(backgroundColor); | 5740 newStyle->setBackgroundColor(backgroundColor); |
5741 m_fullScreenRenderer->setStyle(newStyle); | 5741 m_fullScreenRenderer->setStyle(newStyle); |
5742 } | 5742 } |
5743 | 5743 |
5744 void Document::fullScreenChangeDelayTimerFired(Timer<Document>*) | 5744 void Document::fullScreenChangeDelayTimerFired(Timer<Document>*) |
5745 { | 5745 { |
| 5746 // Since we dispatch events in this function, it's possible that the |
| 5747 // document will be detached and GC'd. We protect it here to make sure we |
| 5748 // can finish the function successfully. |
| 5749 RefPtr<Document> protectDocument(this); |
5746 Deque<RefPtr<Node> > changeQueue; | 5750 Deque<RefPtr<Node> > changeQueue; |
5747 m_fullScreenChangeEventTargetQueue.swap(changeQueue); | 5751 m_fullScreenChangeEventTargetQueue.swap(changeQueue); |
5748 | 5752 |
5749 while (!changeQueue.isEmpty()) { | 5753 while (!changeQueue.isEmpty()) { |
5750 RefPtr<Node> node = changeQueue.takeFirst(); | 5754 RefPtr<Node> node = changeQueue.takeFirst(); |
5751 if (!node) | 5755 if (!node) |
5752 node = documentElement(); | 5756 node = documentElement(); |
| 5757 // The dispatchEvent below may have blown away our documentElement. |
| 5758 if (!node) |
| 5759 continue; |
5753 | 5760 |
5754 // If the element was removed from our tree, also message the documentEl
ement. Since we may | 5761 // If the element was removed from our tree, also message the documentEl
ement. Since we may |
5755 // have a document hierarchy, check that node isn't in another document. | 5762 // have a document hierarchy, check that node isn't in another document. |
5756 if (!contains(node.get()) && !node->inDocument()) | 5763 if (!contains(node.get()) && !node->inDocument()) |
5757 changeQueue.append(documentElement()); | 5764 changeQueue.append(documentElement()); |
5758 | 5765 |
5759 node->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEve
nt, true, false)); | 5766 node->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEve
nt, true, false)); |
5760 } | 5767 } |
5761 | 5768 |
5762 Deque<RefPtr<Node> > errorQueue; | 5769 Deque<RefPtr<Node> > errorQueue; |
5763 m_fullScreenErrorEventTargetQueue.swap(errorQueue); | 5770 m_fullScreenErrorEventTargetQueue.swap(errorQueue); |
5764 | 5771 |
5765 while (!errorQueue.isEmpty()) { | 5772 while (!errorQueue.isEmpty()) { |
5766 RefPtr<Node> node = errorQueue.takeFirst(); | 5773 RefPtr<Node> node = errorQueue.takeFirst(); |
5767 if (!node) | 5774 if (!node) |
5768 node = documentElement(); | 5775 node = documentElement(); |
| 5776 // The dispatchEvent below may have blown away our documentElement. |
| 5777 if (!node) |
| 5778 continue; |
5769 | 5779 |
5770 // If the element was removed from our tree, also message the documentEl
ement. Since we may | 5780 // If the element was removed from our tree, also message the documentEl
ement. Since we may |
5771 // have a document hierarchy, check that node isn't in another document. | 5781 // have a document hierarchy, check that node isn't in another document. |
5772 if (!contains(node.get()) && !node->inDocument()) | 5782 if (!contains(node.get()) && !node->inDocument()) |
5773 errorQueue.append(documentElement()); | 5783 errorQueue.append(documentElement()); |
5774 | 5784 |
5775 node->dispatchEvent(Event::create(eventNames().webkitfullscreenerrorEven
t, true, false)); | 5785 node->dispatchEvent(Event::create(eventNames().webkitfullscreenerrorEven
t, true, false)); |
5776 } | 5786 } |
5777 } | 5787 } |
5778 | 5788 |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6152 #if ENABLE(UNDO_MANAGER) | 6162 #if ENABLE(UNDO_MANAGER) |
6153 PassRefPtr<UndoManager> Document::undoManager() | 6163 PassRefPtr<UndoManager> Document::undoManager() |
6154 { | 6164 { |
6155 if (!m_undoManager) | 6165 if (!m_undoManager) |
6156 m_undoManager = UndoManager::create(this); | 6166 m_undoManager = UndoManager::create(this); |
6157 return m_undoManager; | 6167 return m_undoManager; |
6158 } | 6168 } |
6159 #endif | 6169 #endif |
6160 | 6170 |
6161 } // namespace WebCore | 6171 } // namespace WebCore |
OLD | NEW |