Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(713)

Side by Side Diff: Source/WebCore/dom/Document.cpp

Issue 10855251: Merge 126043 - webkitfullscreenchange not fired properly in iframe. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1229/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 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.
11 * 11 *
12 * This library is free software; you can redistribute it and/or 12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public 13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either 14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version. 15 * version 2 of the License, or (at your option) any later version.
16 * 16 *
17 * This library is distributed in the hope that it will be useful, 17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 5514 matching lines...) Expand 10 before | Expand all | Expand 10 after
5533 currentDoc->popFullscreenElementStack(); 5533 currentDoc->popFullscreenElementStack();
5534 5534
5535 // If doc's fullscreen element stack is non-empty and the element now at the top is either 5535 // If doc's fullscreen element stack is non-empty and the element now at the top is either
5536 // not in a document or its node document is not doc, repeat this sub step. 5536 // not in a document or its node document is not doc, repeat this sub step.
5537 newTop = currentDoc->webkitFullscreenElement(); 5537 newTop = currentDoc->webkitFullscreenElement();
5538 if (newTop && (!newTop->inDocument() || newTop->document() != currentDoc )) 5538 if (newTop && (!newTop->inDocument() || newTop->document() != currentDoc ))
5539 continue; 5539 continue;
5540 5540
5541 // 2. Queue a task to fire an event named fullscreenchange with its bubb les attribute set to true 5541 // 2. Queue a task to fire an event named fullscreenchange with its bubb les attribute set to true
5542 // on doc. 5542 // on doc.
5543 Node* target = currentDoc->m_fullScreenElement.get();
5544 if (!target)
5545 target = currentDoc;
5546 addDocumentToFullScreenChangeEventQueue(currentDoc); 5543 addDocumentToFullScreenChangeEventQueue(currentDoc);
5547 5544
5548 // 3. If doc's fullscreen element stack is empty and doc's browsing cont ext has a browsing context 5545 // 3. If doc's fullscreen element stack is empty and doc's browsing cont ext has a browsing context
5549 // container, set doc to that browsing context container's node document . 5546 // container, set doc to that browsing context container's node document .
5550 if (!newTop && currentDoc->ownerElement()) 5547 if (!newTop && currentDoc->ownerElement()) {
5551 currentDoc = currentDoc->ownerElement()->document(); 5548 currentDoc = currentDoc->ownerElement()->document();
5549 continue;
5550 }
5552 5551
5553 // 4. Otherwise, set doc to null. 5552 // 4. Otherwise, set doc to null.
5554 currentDoc = 0; 5553 currentDoc = 0;
5555 } 5554 }
5556 5555
5557 // 6. Return, and run the remaining steps asynchronously. 5556 // 6. Return, and run the remaining steps asynchronously.
5558 // 7. Optionally, perform some animation. 5557 // 7. Optionally, perform some animation.
5559 5558
5560 // Only exit out of full screen window mode if there are no remaining elemen ts in the 5559 // Only exit out of full screen window mode if there are no remaining elemen ts in the
5561 // full screen stack. 5560 // full screen stack.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
5654 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false); 5653 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false);
5655 5654
5656 m_areKeysEnabledInFullScreen = false; 5655 m_areKeysEnabledInFullScreen = false;
5657 5656
5658 if (m_fullScreenRenderer) 5657 if (m_fullScreenRenderer)
5659 m_fullScreenRenderer->unwrapRenderer(); 5658 m_fullScreenRenderer->unwrapRenderer();
5660 5659
5661 m_fullScreenElement = 0; 5660 m_fullScreenElement = 0;
5662 scheduleForcedStyleRecalc(); 5661 scheduleForcedStyleRecalc();
5663 5662
5664 m_fullScreenChangeDelayTimer.startOneShot(0); 5663 // When webkitCancelFullScreen is called, we call webkitExitFullScreen on th e topDocument(). That
5664 // means that the events will be queued there. So if we have no events here, start the timer on
5665 // the exiting document.
5666 Document* exitingDocument = this;
5667 if (m_fullScreenChangeEventTargetQueue.isEmpty() && m_fullScreenErrorEventTa rgetQueue.isEmpty())
5668 exitingDocument = topDocument();
5669 exitingDocument->m_fullScreenChangeDelayTimer.startOneShot(0);
5665 } 5670 }
5666 5671
5667 void Document::setFullScreenRenderer(RenderFullScreen* renderer) 5672 void Document::setFullScreenRenderer(RenderFullScreen* renderer)
5668 { 5673 {
5669 if (renderer == m_fullScreenRenderer) 5674 if (renderer == m_fullScreenRenderer)
5670 return; 5675 return;
5671 5676
5672 if (renderer && m_savedPlaceholderRenderStyle) 5677 if (renderer && m_savedPlaceholderRenderStyle)
5673 renderer->createPlaceholder(m_savedPlaceholderRenderStyle.release(), m_s avedPlaceholderFrameRect); 5678 renderer->createPlaceholder(m_savedPlaceholderRenderStyle.release(), m_s avedPlaceholderFrameRect);
5674 else if (renderer && m_fullScreenRenderer && m_fullScreenRenderer->placehold er()) { 5679 else if (renderer && m_fullScreenRenderer && m_fullScreenRenderer->placehold er()) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
5725 void Document::fullScreenChangeDelayTimerFired(Timer<Document>*) 5730 void Document::fullScreenChangeDelayTimerFired(Timer<Document>*)
5726 { 5731 {
5727 Deque<RefPtr<Node> > changeQueue; 5732 Deque<RefPtr<Node> > changeQueue;
5728 m_fullScreenChangeEventTargetQueue.swap(changeQueue); 5733 m_fullScreenChangeEventTargetQueue.swap(changeQueue);
5729 5734
5730 while (!changeQueue.isEmpty()) { 5735 while (!changeQueue.isEmpty()) {
5731 RefPtr<Node> node = changeQueue.takeFirst(); 5736 RefPtr<Node> node = changeQueue.takeFirst();
5732 if (!node) 5737 if (!node)
5733 node = documentElement(); 5738 node = documentElement();
5734 5739
5735 // If the element was removed from our tree, also message the documentEl ement. 5740 // If the element was removed from our tree, also message the documentEl ement. Since we may
5736 if (!contains(node.get())) 5741 // have a document hierarchy, check that node isn't in another document.
5742 if (!contains(node.get()) && !node->inDocument())
5737 changeQueue.append(documentElement()); 5743 changeQueue.append(documentElement());
5738 5744
5739 node->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEve nt, true, false)); 5745 node->dispatchEvent(Event::create(eventNames().webkitfullscreenchangeEve nt, true, false));
5740 } 5746 }
5741 5747
5742 Deque<RefPtr<Node> > errorQueue; 5748 Deque<RefPtr<Node> > errorQueue;
5743 m_fullScreenErrorEventTargetQueue.swap(errorQueue); 5749 m_fullScreenErrorEventTargetQueue.swap(errorQueue);
5744 5750
5745 while (!errorQueue.isEmpty()) { 5751 while (!errorQueue.isEmpty()) {
5746 RefPtr<Node> node = errorQueue.takeFirst(); 5752 RefPtr<Node> node = errorQueue.takeFirst();
5747 if (!node) 5753 if (!node)
5748 node = documentElement(); 5754 node = documentElement();
5749 5755
5750 // If the node was removed from our tree, also message the documentEleme nt. 5756 // If the element was removed from our tree, also message the documentEl ement. Since we may
5751 if (!contains(node.get())) 5757 // have a document hierarchy, check that node isn't in another document.
5758 if (!contains(node.get()) && !node->inDocument())
5752 errorQueue.append(documentElement()); 5759 errorQueue.append(documentElement());
5753 5760
5754 node->dispatchEvent(Event::create(eventNames().webkitfullscreenerrorEven t, true, false)); 5761 node->dispatchEvent(Event::create(eventNames().webkitfullscreenerrorEven t, true, false));
5755 } 5762 }
5756 } 5763 }
5757 5764
5758 void Document::fullScreenElementRemoved() 5765 void Document::fullScreenElementRemoved()
5759 { 5766 {
5760 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false); 5767 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false);
5761 webkitCancelFullScreen(); 5768 webkitCancelFullScreen();
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
6131 #if ENABLE(UNDO_MANAGER) 6138 #if ENABLE(UNDO_MANAGER)
6132 PassRefPtr<UndoManager> Document::undoManager() 6139 PassRefPtr<UndoManager> Document::undoManager()
6133 { 6140 {
6134 if (!m_undoManager) 6141 if (!m_undoManager)
6135 m_undoManager = UndoManager::create(this); 6142 m_undoManager = UndoManager::create(this);
6136 return m_undoManager; 6143 return m_undoManager;
6137 } 6144 }
6138 #endif 6145 #endif
6139 6146
6140 } // namespace WebCore 6147 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698