• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
3  * Copyright (C) 2012 Google Inc. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1.  Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer.
11  * 2.  Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution.
14  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15  *     its contributors may be used to endorse or promote products derived
16  *     from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef MediaControlElements_h
31 #define MediaControlElements_h
32 
33 #include "core/html/shadow/MediaControlElementTypes.h"
34 
35 namespace WebCore {
36 
37 // ----------------------------
38 
39 class MediaControlPanelElement FINAL : public MediaControlDivElement {
40 public:
41     static PassRefPtr<MediaControlPanelElement> create(Document&);
42 
43     void setCanBeDragged(bool);
44     void setIsDisplayed(bool);
45 
46     void resetPosition();
47     void makeOpaque();
48     void makeTransparent();
49 
willRespondToMouseMoveEvents()50     virtual bool willRespondToMouseMoveEvents() OVERRIDE { return true; }
willRespondToMouseClickEvents()51     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
52 
53 private:
54     explicit MediaControlPanelElement(Document&);
55 
56     virtual const AtomicString& pseudo() const OVERRIDE;
57     virtual void defaultEventHandler(Event*) OVERRIDE;
58 
59     void startDrag(const LayoutPoint& eventLocation);
60     void continueDrag(const LayoutPoint& eventLocation);
61     void endDrag();
62 
63     void startTimer();
64     void stopTimer();
65     void transitionTimerFired(Timer<MediaControlPanelElement>*);
66 
67     void setPosition(const LayoutPoint&);
68 
69     bool m_canBeDragged;
70     bool m_isBeingDragged;
71     bool m_isDisplayed;
72     bool m_opaque;
73     LayoutPoint m_lastDragEventLocation;
74     LayoutPoint m_cumulativeDragOffset;
75 
76     Timer<MediaControlPanelElement> m_transitionTimer;
77 };
78 
79 // ----------------------------
80 
81 class MediaControlPanelEnclosureElement FINAL : public MediaControlDivElement {
82 public:
83     static PassRefPtr<MediaControlPanelEnclosureElement> create(Document&);
84 
85 private:
86     explicit MediaControlPanelEnclosureElement(Document&);
87     virtual const AtomicString& pseudo() const OVERRIDE;
88 };
89 
90 // ----------------------------
91 
92 class MediaControlOverlayEnclosureElement FINAL : public MediaControlDivElement {
93 public:
94     static PassRefPtr<MediaControlOverlayEnclosureElement> create(Document&);
95 
96 private:
97     explicit MediaControlOverlayEnclosureElement(Document&);
98     virtual const AtomicString& pseudo() const OVERRIDE;
99 };
100 
101 // ----------------------------
102 
103 class MediaControlPanelMuteButtonElement FINAL : public MediaControlMuteButtonElement {
104 public:
105     static PassRefPtr<MediaControlPanelMuteButtonElement> create(Document&, MediaControls*);
106 
willRespondToMouseMoveEvents()107     virtual bool willRespondToMouseMoveEvents() OVERRIDE { return true; }
108 
109 private:
110     explicit MediaControlPanelMuteButtonElement(Document&, MediaControls*);
111 
112     virtual const AtomicString& pseudo() const OVERRIDE;
113     virtual void defaultEventHandler(Event*) OVERRIDE;
114 
115     MediaControls* m_controls;
116 };
117 
118 // ----------------------------
119 
120 class MediaControlVolumeSliderMuteButtonElement FINAL : public MediaControlMuteButtonElement {
121 public:
122     static PassRefPtr<MediaControlVolumeSliderMuteButtonElement> create(Document&);
123 
124 private:
125     explicit MediaControlVolumeSliderMuteButtonElement(Document&);
126     virtual const AtomicString& pseudo() const OVERRIDE;
127 };
128 
129 
130 // ----------------------------
131 
132 class MediaControlPlayButtonElement FINAL : public MediaControlInputElement {
133 public:
134     static PassRefPtr<MediaControlPlayButtonElement> create(Document&);
135 
willRespondToMouseClickEvents()136     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
137     virtual void updateDisplayType() OVERRIDE;
138 
139 private:
140     explicit MediaControlPlayButtonElement(Document&);
141 
142     virtual const AtomicString& pseudo() const OVERRIDE;
143     virtual void defaultEventHandler(Event*) OVERRIDE;
144 };
145 
146 // ----------------------------
147 
148 class MediaControlOverlayPlayButtonElement FINAL : public MediaControlInputElement {
149 public:
150     static PassRefPtr<MediaControlOverlayPlayButtonElement> create(Document&);
151 
152     virtual void updateDisplayType() OVERRIDE;
153 
154 private:
155     explicit MediaControlOverlayPlayButtonElement(Document&);
156 
157     virtual const AtomicString& pseudo() const OVERRIDE;
158     virtual void defaultEventHandler(Event*) OVERRIDE;
159 };
160 
161 // ----------------------------
162 
163 class MediaControlToggleClosedCaptionsButtonElement FINAL : public MediaControlInputElement {
164 public:
165     static PassRefPtr<MediaControlToggleClosedCaptionsButtonElement> create(Document&, MediaControls*);
166 
willRespondToMouseClickEvents()167     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
168 
169     virtual void updateDisplayType() OVERRIDE;
170 
171 private:
172     explicit MediaControlToggleClosedCaptionsButtonElement(Document&, MediaControls*);
173 
174     virtual const AtomicString& pseudo() const OVERRIDE;
175     virtual void defaultEventHandler(Event*) OVERRIDE;
176 };
177 
178 // ----------------------------
179 
180 class MediaControlTimelineElement FINAL : public MediaControlInputElement {
181 public:
182     static PassRefPtr<MediaControlTimelineElement> create(Document&, MediaControls*);
183 
184     virtual bool willRespondToMouseClickEvents() OVERRIDE;
185 
186     void setPosition(double);
187     void setDuration(double);
188 
189 private:
190     explicit MediaControlTimelineElement(Document&, MediaControls*);
191 
192     virtual const AtomicString& pseudo() const OVERRIDE;
193     virtual void defaultEventHandler(Event*) OVERRIDE;
194 
195     MediaControls* m_controls;
196 };
197 
198 // ----------------------------
199 
200 class MediaControlFullscreenButtonElement FINAL : public MediaControlInputElement {
201 public:
202     static PassRefPtr<MediaControlFullscreenButtonElement> create(Document&);
203 
willRespondToMouseClickEvents()204     virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
205 
206     virtual void setIsFullscreen(bool);
207 
208 private:
209     explicit MediaControlFullscreenButtonElement(Document&);
210 
211     virtual const AtomicString& pseudo() const OVERRIDE;
212     virtual void defaultEventHandler(Event*) OVERRIDE;
213 };
214 
215 // ----------------------------
216 
217 class MediaControlPanelVolumeSliderElement FINAL : public MediaControlVolumeSliderElement {
218 public:
219     static PassRefPtr<MediaControlPanelVolumeSliderElement> create(Document&);
220 
221 private:
222     explicit MediaControlPanelVolumeSliderElement(Document&);
223     virtual const AtomicString& pseudo() const OVERRIDE;
224 };
225 
226 // ----------------------------
227 
228 class MediaControlTimeRemainingDisplayElement FINAL : public MediaControlTimeDisplayElement {
229 public:
230     static PassRefPtr<MediaControlTimeRemainingDisplayElement> create(Document&);
231 
232 private:
233     explicit MediaControlTimeRemainingDisplayElement(Document&);
234     virtual const AtomicString& pseudo() const OVERRIDE;
235 };
236 
237 // ----------------------------
238 
239 class MediaControlCurrentTimeDisplayElement FINAL : public MediaControlTimeDisplayElement {
240 public:
241     static PassRefPtr<MediaControlCurrentTimeDisplayElement> create(Document&);
242 
243 private:
244     explicit MediaControlCurrentTimeDisplayElement(Document&);
245     virtual const AtomicString& pseudo() const OVERRIDE;
246 };
247 
248 // ----------------------------
249 
250 class MediaControlTextTrackContainerElement FINAL : public MediaControlDivElement {
251 public:
252     static PassRefPtr<MediaControlTextTrackContainerElement> create(Document&);
253 
254     void updateDisplay();
255     void updateSizes(bool forceUpdate = false);
256     static const AtomicString& textTrackContainerElementShadowPseudoId();
257 
258 private:
259     explicit MediaControlTextTrackContainerElement(Document&);
260     virtual const AtomicString& pseudo() const OVERRIDE;
261 
262     virtual RenderObject* createRenderer(RenderStyle*);
263 
264     IntRect m_videoDisplaySize;
265     float m_fontSize;
266 };
267 
268 
269 } // namespace WebCore
270 
271 #endif // MediaControlElements_h
272