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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 static const char* supplementName(); | 53 static const char* supplementName(); |
54 static Fullscreen& from(Document&); | 54 static Fullscreen& from(Document&); |
55 static Fullscreen* fromIfExists(Document&); | 55 static Fullscreen* fromIfExists(Document&); |
56 static Element* fullscreenElementFrom(Document&); | 56 static Element* fullscreenElementFrom(Document&); |
57 static Element* currentFullScreenElementFrom(Document&); | 57 static Element* currentFullScreenElementFrom(Document&); |
58 static bool isFullScreen(Document&); | 58 static bool isFullScreen(Document&); |
59 static bool isActiveFullScreenElement(const Element&); | 59 static bool isActiveFullScreenElement(const Element&); |
60 | 60 |
61 enum RequestType { | 61 enum RequestType { |
62 UnprefixedRequest, // Element.requestFullscreen() | 62 UnprefixedRequest, // Element.requestFullscreen() |
63 PrefixedRequest, // Element.webkitRequestFullscreen() | 63 PrefixedRequest, // Element.webkitRequestFullscreen() and webkitRequestF
ullScreen() |
64 PrefixedMozillaRequest, // Element.webkitRequestFullScreen() | |
65 PrefixedMozillaAllowKeyboardInputRequest, // Element.webkitRequestFullSc
reen(Element.ALLOW_KEYBOARD_INPUT) | |
66 PrefixedVideoRequest, // HTMLVideoElement.webkitEnterFullscreen() and we
bkitEnterFullScreen() | 64 PrefixedVideoRequest, // HTMLVideoElement.webkitEnterFullscreen() and we
bkitEnterFullScreen() |
67 }; | 65 }; |
68 | 66 |
69 void requestFullscreen(Element&, RequestType); | 67 void requestFullscreen(Element&, RequestType); |
70 static void fullyExitFullscreen(Document&); | 68 static void fullyExitFullscreen(Document&); |
71 void exitFullscreen(); | 69 void exitFullscreen(); |
72 | 70 |
73 static bool fullscreenEnabled(Document&); | 71 static bool fullscreenEnabled(Document&); |
74 Element* fullscreenElement() const { return !m_fullScreenElementStack.isEmpt
y() ? m_fullScreenElementStack.last().first.get() : 0; } | 72 Element* fullscreenElement() const { return !m_fullScreenElementStack.isEmpt
y() ? m_fullScreenElementStack.last().first.get() : 0; } |
75 | 73 |
76 void didEnterFullScreenForElement(Element*); | 74 void didEnterFullScreenForElement(Element*); |
77 void didExitFullScreenForElement(Element*); | 75 void didExitFullScreenForElement(Element*); |
78 | 76 |
79 void setFullScreenRenderer(RenderFullScreen*); | 77 void setFullScreenRenderer(RenderFullScreen*); |
80 RenderFullScreen* fullScreenRenderer() const { return m_fullScreenRenderer;
} | 78 RenderFullScreen* fullScreenRenderer() const { return m_fullScreenRenderer;
} |
81 void fullScreenRendererDestroyed(); | 79 void fullScreenRendererDestroyed(); |
82 | 80 |
83 void elementRemoved(Element&); | 81 void elementRemoved(Element&); |
84 | 82 |
85 // Mozilla API | 83 // Mozilla API |
86 bool webkitFullScreenKeyboardInputAllowed() const { return m_fullScreenEleme
nt.get() && m_areKeysEnabledInFullScreen; } | |
87 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement
.get(); } | 84 Element* webkitCurrentFullScreenElement() const { return m_fullScreenElement
.get(); } |
88 | 85 |
89 virtual void documentWasDetached() override; | 86 virtual void documentWasDetached() override; |
90 #if !ENABLE(OILPAN) | 87 #if !ENABLE(OILPAN) |
91 virtual void documentWasDisposed() override; | 88 virtual void documentWasDisposed() override; |
92 #endif | 89 #endif |
93 | 90 |
94 virtual void trace(Visitor*) override; | 91 virtual void trace(Visitor*) override; |
95 | 92 |
96 private: | 93 private: |
97 static Fullscreen* fromIfExistsSlow(Document&); | 94 static Fullscreen* fromIfExistsSlow(Document&); |
98 | 95 |
99 explicit Fullscreen(Document&); | 96 explicit Fullscreen(Document&); |
100 | 97 |
101 Document* document(); | 98 Document* document(); |
102 | 99 |
103 void clearFullscreenElementStack(); | 100 void clearFullscreenElementStack(); |
104 void popFullscreenElementStack(); | 101 void popFullscreenElementStack(); |
105 void pushFullscreenElementStack(Element&, RequestType); | 102 void pushFullscreenElementStack(Element&, RequestType); |
106 | 103 |
107 void enqueueChangeEvent(Document&, RequestType); | 104 void enqueueChangeEvent(Document&, RequestType); |
108 void enqueueErrorEvent(Element&, RequestType); | 105 void enqueueErrorEvent(Element&, RequestType); |
109 void eventQueueTimerFired(Timer<Fullscreen>*); | 106 void eventQueueTimerFired(Timer<Fullscreen>*); |
110 | 107 |
111 bool m_areKeysEnabledInFullScreen; | |
112 RefPtrWillBeMember<Element> m_fullScreenElement; | 108 RefPtrWillBeMember<Element> m_fullScreenElement; |
113 WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>, RequestType> > m_ful
lScreenElementStack; | 109 WillBeHeapVector<std::pair<RefPtrWillBeMember<Element>, RequestType> > m_ful
lScreenElementStack; |
114 RawPtrWillBeMember<RenderFullScreen> m_fullScreenRenderer; | 110 RawPtrWillBeMember<RenderFullScreen> m_fullScreenRenderer; |
115 Timer<Fullscreen> m_eventQueueTimer; | 111 Timer<Fullscreen> m_eventQueueTimer; |
116 WillBeHeapDeque<RefPtrWillBeMember<Event> > m_eventQueue; | 112 WillBeHeapDeque<RefPtrWillBeMember<Event> > m_eventQueue; |
117 LayoutRect m_savedPlaceholderFrameRect; | 113 LayoutRect m_savedPlaceholderFrameRect; |
118 RefPtr<RenderStyle> m_savedPlaceholderRenderStyle; | 114 RefPtr<RenderStyle> m_savedPlaceholderRenderStyle; |
119 }; | 115 }; |
120 | 116 |
121 inline bool Fullscreen::isActiveFullScreenElement(const Element& element) | 117 inline bool Fullscreen::isActiveFullScreenElement(const Element& element) |
122 { | 118 { |
123 Fullscreen* fullscreen = fromIfExists(element.document()); | 119 Fullscreen* fullscreen = fromIfExists(element.document()); |
124 if (!fullscreen) | 120 if (!fullscreen) |
125 return false; | 121 return false; |
126 return fullscreen->webkitCurrentFullScreenElement() == &element; | 122 return fullscreen->webkitCurrentFullScreenElement() == &element; |
127 } | 123 } |
128 | 124 |
129 inline Fullscreen* Fullscreen::fromIfExists(Document& document) | 125 inline Fullscreen* Fullscreen::fromIfExists(Document& document) |
130 { | 126 { |
131 if (!document.hasFullscreenSupplement()) | 127 if (!document.hasFullscreenSupplement()) |
132 return 0; | 128 return 0; |
133 return fromIfExistsSlow(document); | 129 return fromIfExistsSlow(document); |
134 } | 130 } |
135 | 131 |
136 } // namespace blink | 132 } // namespace blink |
137 | 133 |
138 #endif // Fullscreen_h | 134 #endif // Fullscreen_h |
OLD | NEW |