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 22 matching lines...) Expand all Loading... | |
33 #include "core/dom/Element.h" | 33 #include "core/dom/Element.h" |
34 #include "platform/Supplementable.h" | 34 #include "platform/Supplementable.h" |
35 #include "platform/Timer.h" | 35 #include "platform/Timer.h" |
36 #include "platform/geometry/LayoutRect.h" | 36 #include "platform/geometry/LayoutRect.h" |
37 #include "wtf/Deque.h" | 37 #include "wtf/Deque.h" |
38 #include "wtf/RefPtr.h" | 38 #include "wtf/RefPtr.h" |
39 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 class RenderFullScreen; | |
44 class RenderStyle; | 43 class RenderStyle; |
45 | 44 |
46 class Fullscreen final | 45 class Fullscreen final |
47 : public NoBaseWillBeGarbageCollectedFinalized<Fullscreen> | 46 : public NoBaseWillBeGarbageCollectedFinalized<Fullscreen> |
48 , public DocumentSupplement | 47 , public DocumentSupplement |
49 , public DocumentLifecycleObserver { | 48 , public DocumentLifecycleObserver { |
50 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Fullscreen); | 49 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Fullscreen); |
51 public: | 50 public: |
52 virtual ~Fullscreen(); | 51 virtual ~Fullscreen(); |
53 static const char* supplementName(); | 52 static const char* supplementName(); |
(...skipping 13 matching lines...) Expand all Loading... | |
67 void requestFullscreen(Element&, RequestType); | 66 void requestFullscreen(Element&, RequestType); |
68 static void fullyExitFullscreen(Document&); | 67 static void fullyExitFullscreen(Document&); |
69 void exitFullscreen(); | 68 void exitFullscreen(); |
70 | 69 |
71 static bool fullscreenEnabled(Document&); | 70 static bool fullscreenEnabled(Document&); |
72 Element* fullscreenElement() const { return !m_fullScreenElementStack.isEmpt y() ? m_fullScreenElementStack.last().first.get() : 0; } | 71 Element* fullscreenElement() const { return !m_fullScreenElementStack.isEmpt y() ? m_fullScreenElementStack.last().first.get() : 0; } |
73 | 72 |
74 void didEnterFullScreenForElement(Element*); | 73 void didEnterFullScreenForElement(Element*); |
75 void didExitFullScreenForElement(Element*); | 74 void didExitFullScreenForElement(Element*); |
76 | 75 |
77 void setFullScreenRenderer(RenderFullScreen*); | |
78 RenderFullScreen* fullScreenRenderer() const { return m_fullScreenRenderer; } | |
79 void fullScreenRendererDestroyed(); | |
80 | |
81 void elementRemoved(Element&); | 76 void elementRemoved(Element&); |
82 | 77 |
83 // Mozilla API | 78 // Mozilla API |
84 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement .get(); } | 79 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement .get(); } |
85 | 80 |
86 virtual void documentWasDetached() override; | 81 virtual void documentWasDetached() override; |
87 #if !ENABLE(OILPAN) | 82 #if !ENABLE(OILPAN) |
88 virtual void documentWasDisposed() override; | 83 virtual void documentWasDisposed() override; |
89 #endif | 84 #endif |
90 | 85 |
91 virtual void trace(Visitor*) override; | 86 virtual void trace(Visitor*) override; |
92 | 87 |
88 const WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>, RequestType> > & fullScreenElementStack() { return m_fullScreenElementStack; } | |
philipj_slow
2015/02/12 08:19:16
Can you comment that this is exposed for tests onl
esprehn
2015/02/20 06:23:45
Just name it fullScreenElementStackForTesting()
| |
89 | |
93 private: | 90 private: |
94 static Fullscreen* fromIfExistsSlow(Document&); | 91 static Fullscreen* fromIfExistsSlow(Document&); |
95 | 92 |
96 explicit Fullscreen(Document&); | 93 explicit Fullscreen(Document&); |
97 | 94 |
98 Document* document(); | 95 Document* document(); |
99 | 96 |
100 void clearFullscreenElementStack(); | 97 void clearFullscreenElementStack(); |
101 void popFullscreenElementStack(); | 98 void popFullscreenElementStack(); |
102 void pushFullscreenElementStack(Element&, RequestType); | 99 void pushFullscreenElementStack(Element&, RequestType); |
103 | 100 |
104 void enqueueChangeEvent(Document&, RequestType); | 101 void enqueueChangeEvent(Document&, RequestType); |
105 void enqueueErrorEvent(Element&, RequestType); | 102 void enqueueErrorEvent(Element&, RequestType); |
106 void eventQueueTimerFired(Timer<Fullscreen>*); | 103 void eventQueueTimerFired(Timer<Fullscreen>*); |
107 | 104 |
108 RefPtrWillBeMember<Element> m_fullScreenElement; | 105 RefPtrWillBeMember<Element> m_fullScreenElement; |
109 WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>, RequestType> > m_ful lScreenElementStack; | 106 WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>, RequestType> > m_ful lScreenElementStack; |
110 RawPtrWillBeMember<RenderFullScreen> m_fullScreenRenderer; | |
111 Timer<Fullscreen> m_eventQueueTimer; | 107 Timer<Fullscreen> m_eventQueueTimer; |
112 WillBeHeapDeque<RefPtrWillBeMember<Event> > m_eventQueue; | 108 WillBeHeapDeque<RefPtrWillBeMember<Event> > m_eventQueue; |
113 LayoutRect m_savedPlaceholderFrameRect; | 109 LayoutRect m_savedPlaceholderFrameRect; |
114 RefPtr<RenderStyle> m_savedPlaceholderRenderStyle; | 110 RefPtr<RenderStyle> m_savedPlaceholderRenderStyle; |
115 }; | 111 }; |
116 | 112 |
117 inline bool Fullscreen::isActiveFullScreenElement(const Element& element) | 113 inline bool Fullscreen::isActiveFullScreenElement(const Element& element) |
118 { | 114 { |
119 Fullscreen* fullscreen = fromIfExists(element.document()); | 115 Fullscreen* fullscreen = fromIfExists(element.document()); |
120 if (!fullscreen) | 116 if (!fullscreen) |
121 return false; | 117 return false; |
122 return fullscreen->webkitCurrentFullScreenElement() == &element; | 118 return fullscreen->webkitCurrentFullScreenElement() == &element; |
123 } | 119 } |
124 | 120 |
125 inline Fullscreen* Fullscreen::fromIfExists(Document& document) | 121 inline Fullscreen* Fullscreen::fromIfExists(Document& document) |
126 { | 122 { |
127 if (!document.hasFullscreenSupplement()) | 123 if (!document.hasFullscreenSupplement()) |
128 return 0; | 124 return 0; |
129 return fromIfExistsSlow(document); | 125 return fromIfExistsSlow(document); |
130 } | 126 } |
131 | 127 |
132 } // namespace blink | 128 } // namespace blink |
133 | 129 |
134 #endif // Fullscreen_h | 130 #endif // Fullscreen_h |
OLD | NEW |