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

Side by Side Diff: Source/core/dom/FullscreenElementStack.cpp

Issue 261983005: Stop firing orientationchange events at pages that are not visible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Simplify test case Created 6 years, 7 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 | Annotate | Revision Log
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, 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 12 matching lines...) Expand all
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA. 24 * Boston, MA 02110-1301, USA.
25 * 25 *
26 */ 26 */
27 27
28 #include "config.h" 28 #include "config.h"
29 #include "core/dom/FullscreenElementStack.h" 29 #include "core/dom/FullscreenElementStack.h"
30 30
31 #include "HTMLNames.h" 31 #include "HTMLNames.h"
32 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
33 #include "core/dom/FullscreenObserver.h"
33 #include "core/events/Event.h" 34 #include "core/events/Event.h"
34 #include "core/frame/FrameHost.h" 35 #include "core/frame/FrameHost.h"
35 #include "core/frame/LocalFrame.h" 36 #include "core/frame/LocalFrame.h"
36 #include "core/frame/UseCounter.h" 37 #include "core/frame/UseCounter.h"
37 #include "core/html/HTMLFrameOwnerElement.h" 38 #include "core/html/HTMLFrameOwnerElement.h"
38 #include "core/page/Chrome.h" 39 #include "core/page/Chrome.h"
39 #include "core/page/ChromeClient.h" 40 #include "core/page/ChromeClient.h"
40 #include "core/rendering/RenderFullScreen.h" 41 #include "core/rendering/RenderFullScreen.h"
41 #include "platform/UserGestureIndicator.h" 42 #include "platform/UserGestureIndicator.h"
42 43
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 if (m_fullScreenRenderer) 129 if (m_fullScreenRenderer)
129 setFullScreenRenderer(0); 130 setFullScreenRenderer(0);
130 } 131 }
131 132
132 void FullscreenElementStack::documentWasDisposed() 133 void FullscreenElementStack::documentWasDisposed()
133 { 134 {
134 m_fullScreenElement = nullptr; 135 m_fullScreenElement = nullptr;
135 m_fullScreenElementStack.clear(); 136 m_fullScreenElementStack.clear();
136 } 137 }
137 138
139 void FullscreenElementStack::addObserver(FullscreenObserver* observer)
140 {
141 m_fullscreenObservers.add(observer);
142 }
143
144 void FullscreenElementStack::removeObserver(FullscreenObserver* observer)
145 {
146 m_fullscreenObservers.remove(observer);
147 }
148
138 bool FullscreenElementStack::fullScreenIsAllowedForElement(Element* element) con st 149 bool FullscreenElementStack::fullScreenIsAllowedForElement(Element* element) con st
139 { 150 {
140 ASSERT(element); 151 ASSERT(element);
141 return fullscreenIsAllowedForAllOwners(element->document()); 152 return fullscreenIsAllowedForAllOwners(element->document());
142 } 153 }
143 154
144 void FullscreenElementStack::requestFullScreenForElement(Element* element, unsig ned short flags, FullScreenCheckType checkType) 155 void FullscreenElementStack::requestFullScreenForElement(Element* element, unsig ned short flags, FullScreenCheckType checkType)
145 { 156 {
146 // Ignore this request if the document is not in a live frame. 157 // Ignore this request if the document is not in a live frame.
147 if (!document()->isActive()) 158 if (!document()->isActive())
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 // Speculative fix for engaget.com/videos per crbug.com/336239. 352 // Speculative fix for engaget.com/videos per crbug.com/336239.
342 // FIXME: This check is wrong. We ASSERT(document->isActive()) above 353 // FIXME: This check is wrong. We ASSERT(document->isActive()) above
343 // so this should be redundant and should be removed! 354 // so this should be redundant and should be removed!
344 if (!host) 355 if (!host)
345 return; 356 return;
346 357
347 // Only exit out of full screen window mode if there are no remaining elemen ts in the 358 // Only exit out of full screen window mode if there are no remaining elemen ts in the
348 // full screen stack. 359 // full screen stack.
349 if (!newTop) { 360 if (!newTop) {
350 host->chrome().client().exitFullScreenForElement(m_fullScreenElement.get ()); 361 host->chrome().client().exitFullScreenForElement(m_fullScreenElement.get ());
362 notifyObserversDidFullyExitFullScreen();
351 return; 363 return;
352 } 364 }
353 365
354 // Otherwise, notify the chrome of the new full screen element. 366 // Otherwise, notify the chrome of the new full screen element.
355 host->chrome().client().enterFullScreenForElement(newTop); 367 host->chrome().client().enterFullScreenForElement(newTop);
356 } 368 }
357 369
358 bool FullscreenElementStack::webkitFullscreenEnabled(Document& document) 370 bool FullscreenElementStack::webkitFullscreenEnabled(Document& document)
359 { 371 {
360 // 4. The fullscreenEnabled attribute must return true if the context object and all ancestor 372 // 4. The fullscreenEnabled attribute must return true if the context object and all ancestor
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 521
510 // If the element was removed from our tree, also message the documentEl ement. Since we may 522 // 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. 523 // have a document hierarchy, check that node isn't in another document.
512 if (!document()->contains(node.get()) && !node->inDocument()) 524 if (!document()->contains(node.get()) && !node->inDocument())
513 errorQueue.append(document()->documentElement()); 525 errorQueue.append(document()->documentElement());
514 526
515 node->dispatchEvent(Event::createBubble(EventTypeNames::webkitfullscreen error)); 527 node->dispatchEvent(Event::createBubble(EventTypeNames::webkitfullscreen error));
516 } 528 }
517 } 529 }
518 530
531 void FullscreenElementStack::notifyObserversDidFullyExitFullScreen()
532 {
533 Vector<FullscreenObserver*> copy;
534 copyToVector(m_fullscreenObservers, copy);
535 for (Vector<FullscreenObserver*>::const_iterator it = copy.begin(); it != co py.end(); ++it)
536 (*it)->didFullyExitFullscreen();
537 }
538
519 void FullscreenElementStack::fullScreenElementRemoved() 539 void FullscreenElementStack::fullScreenElementRemoved()
520 { 540 {
521 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false); 541 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false);
522 webkitCancelFullScreen(); 542 webkitCancelFullScreen();
523 } 543 }
524 544
525 void FullscreenElementStack::removeFullScreenElementOfSubtree(Node* node, bool a mongChildrenOnly) 545 void FullscreenElementStack::removeFullScreenElementOfSubtree(Node* node, bool a mongChildrenOnly)
526 { 546 {
527 if (!m_fullScreenElement) 547 if (!m_fullScreenElement)
528 return; 548 return;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 void FullscreenElementStack::trace(Visitor* visitor) 598 void FullscreenElementStack::trace(Visitor* visitor)
579 { 599 {
580 visitor->trace(m_fullScreenElement); 600 visitor->trace(m_fullScreenElement);
581 visitor->trace(m_fullScreenElementStack); 601 visitor->trace(m_fullScreenElementStack);
582 visitor->trace(m_fullScreenChangeEventTargetQueue); 602 visitor->trace(m_fullScreenChangeEventTargetQueue);
583 visitor->trace(m_fullScreenErrorEventTargetQueue); 603 visitor->trace(m_fullScreenErrorEventTargetQueue);
584 DocumentSupplement::trace(visitor); 604 DocumentSupplement::trace(visitor);
585 } 605 }
586 606
587 } // namespace WebCore 607 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698