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

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

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 23 matching lines...) Expand all
34 #include "platform/Timer.h" 34 #include "platform/Timer.h"
35 #include "platform/geometry/LayoutRect.h" 35 #include "platform/geometry/LayoutRect.h"
36 #include "wtf/Deque.h" 36 #include "wtf/Deque.h"
37 #include "wtf/RefPtr.h" 37 #include "wtf/RefPtr.h"
38 #include "wtf/Vector.h" 38 #include "wtf/Vector.h"
39 39
40 namespace WebCore { 40 namespace WebCore {
41 41
42 class Document; 42 class Document;
43 class Element; 43 class Element;
44 class ExecutionContext;
45 class FullscreenObserver;
44 class Node; 46 class Node;
45 class RenderFullScreen; 47 class RenderFullScreen;
46 class RenderStyle; 48 class RenderStyle;
47 class ExecutionContext;
48 49
49 class FullscreenElementStack FINAL 50 class FullscreenElementStack FINAL
50 : public NoBaseWillBeGarbageCollectedFinalized<FullscreenElementStack> 51 : public NoBaseWillBeGarbageCollectedFinalized<FullscreenElementStack>
51 , public DocumentSupplement 52 , public DocumentSupplement
52 , public DocumentLifecycleObserver { 53 , public DocumentLifecycleObserver {
53 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FullscreenElementStack); 54 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FullscreenElementStack);
54 public: 55 public:
55 virtual ~FullscreenElementStack(); 56 virtual ~FullscreenElementStack();
56 static const char* supplementName(); 57 static const char* supplementName();
57 static FullscreenElementStack& from(Document&); 58 static FullscreenElementStack& from(Document&);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 95
95 bool webkitIsFullScreen() const { return m_fullScreenElement.get(); } 96 bool webkitIsFullScreen() const { return m_fullScreenElement.get(); }
96 bool webkitFullScreenKeyboardInputAllowed() const { return m_fullScreenEleme nt.get() && m_areKeysEnabledInFullScreen; } 97 bool webkitFullScreenKeyboardInputAllowed() const { return m_fullScreenEleme nt.get() && m_areKeysEnabledInFullScreen; }
97 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement .get(); } 98 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement .get(); }
98 99
99 virtual void documentWasDetached() OVERRIDE; 100 virtual void documentWasDetached() OVERRIDE;
100 virtual void documentWasDisposed() OVERRIDE; 101 virtual void documentWasDisposed() OVERRIDE;
101 102
102 virtual void trace(Visitor*) OVERRIDE; 103 virtual void trace(Visitor*) OVERRIDE;
103 104
105 void addObserver(FullscreenObserver*);
106 void removeObserver(FullscreenObserver*);
107
104 private: 108 private:
105 static FullscreenElementStack* fromIfExistsSlow(Document&); 109 static FullscreenElementStack* fromIfExistsSlow(Document&);
106 110
107 explicit FullscreenElementStack(Document&); 111 explicit FullscreenElementStack(Document&);
108 112
109 Document* document(); 113 Document* document();
110 void fullScreenChangeDelayTimerFired(Timer<FullscreenElementStack>*); 114 void fullScreenChangeDelayTimerFired(Timer<FullscreenElementStack>*);
111 115
116 void notifyObserversDidFullyExitFullScreen();
117
112 bool m_areKeysEnabledInFullScreen; 118 bool m_areKeysEnabledInFullScreen;
113 RefPtrWillBeMember<Element> m_fullScreenElement; 119 RefPtrWillBeMember<Element> m_fullScreenElement;
114 WillBeHeapVector<RefPtrWillBeMember<Element> > m_fullScreenElementStack; 120 WillBeHeapVector<RefPtrWillBeMember<Element> > m_fullScreenElementStack;
115 RenderFullScreen* m_fullScreenRenderer; 121 RenderFullScreen* m_fullScreenRenderer;
116 Timer<FullscreenElementStack> m_fullScreenChangeDelayTimer; 122 Timer<FullscreenElementStack> m_fullScreenChangeDelayTimer;
117 WillBeHeapDeque<RefPtrWillBeMember<Node> > m_fullScreenChangeEventTargetQueu e; 123 WillBeHeapDeque<RefPtrWillBeMember<Node> > m_fullScreenChangeEventTargetQueu e;
118 WillBeHeapDeque<RefPtrWillBeMember<Node> > m_fullScreenErrorEventTargetQueue ; 124 WillBeHeapDeque<RefPtrWillBeMember<Node> > m_fullScreenErrorEventTargetQueue ;
119 LayoutRect m_savedPlaceholderFrameRect; 125 LayoutRect m_savedPlaceholderFrameRect;
120 RefPtr<RenderStyle> m_savedPlaceholderRenderStyle; 126 RefPtr<RenderStyle> m_savedPlaceholderRenderStyle;
127 typedef HashSet<FullscreenObserver*> FullscreenObserverSet;
128 FullscreenObserverSet m_fullscreenObservers;
121 }; 129 };
122 130
123 inline bool FullscreenElementStack::isActiveFullScreenElement(const Element* ele ment) 131 inline bool FullscreenElementStack::isActiveFullScreenElement(const Element* ele ment)
124 { 132 {
125 FullscreenElementStack* controller = fromIfExists(element->document()); 133 FullscreenElementStack* controller = fromIfExists(element->document());
126 if (!controller) 134 if (!controller)
127 return false; 135 return false;
128 return controller->webkitIsFullScreen() && controller->webkitCurrentFullScre enElement() == element; 136 return controller->webkitIsFullScreen() && controller->webkitCurrentFullScre enElement() == element;
129 } 137 }
130 138
131 inline FullscreenElementStack* FullscreenElementStack::fromIfExists(Document& do cument) 139 inline FullscreenElementStack* FullscreenElementStack::fromIfExists(Document& do cument)
132 { 140 {
133 if (!document.hasFullscreenElementStack()) 141 if (!document.hasFullscreenElementStack())
134 return 0; 142 return 0;
135 return fromIfExistsSlow(document); 143 return fromIfExistsSlow(document);
136 } 144 }
137 145
138 } // namespace WebCore 146 } // namespace WebCore
139 147
140 #endif // FullscreenElementStack_h 148 #endif // FullscreenElementStack_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698