OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 19 matching lines...) Expand all Loading... |
30 #ifndef MediaControlElements_h | 30 #ifndef MediaControlElements_h |
31 #define MediaControlElements_h | 31 #define MediaControlElements_h |
32 | 32 |
33 #include "MediaControlElementTypes.h" | 33 #include "MediaControlElementTypes.h" |
34 #include "core/platform/graphics/TextTrackRepresentation.h" | 34 #include "core/platform/graphics/TextTrackRepresentation.h" |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 // ---------------------------- | 38 // ---------------------------- |
39 | 39 |
40 class MediaControlPanelElement : public MediaControlDivElement { | 40 class MediaControlPanelElement FINAL : public MediaControlDivElement { |
41 public: | 41 public: |
42 static PassRefPtr<MediaControlPanelElement> create(Document*); | 42 static PassRefPtr<MediaControlPanelElement> create(Document*); |
43 | 43 |
44 void setCanBeDragged(bool); | 44 void setCanBeDragged(bool); |
45 void setIsDisplayed(bool); | 45 void setIsDisplayed(bool); |
46 | 46 |
47 void resetPosition(); | 47 void resetPosition(); |
48 void makeOpaque(); | 48 void makeOpaque(); |
49 void makeTransparent(); | 49 void makeTransparent(); |
50 | 50 |
(...skipping 21 matching lines...) Expand all Loading... |
72 bool m_isDisplayed; | 72 bool m_isDisplayed; |
73 bool m_opaque; | 73 bool m_opaque; |
74 LayoutPoint m_lastDragEventLocation; | 74 LayoutPoint m_lastDragEventLocation; |
75 LayoutPoint m_cumulativeDragOffset; | 75 LayoutPoint m_cumulativeDragOffset; |
76 | 76 |
77 Timer<MediaControlPanelElement> m_transitionTimer; | 77 Timer<MediaControlPanelElement> m_transitionTimer; |
78 }; | 78 }; |
79 | 79 |
80 // ---------------------------- | 80 // ---------------------------- |
81 | 81 |
82 class MediaControlPanelEnclosureElement : public MediaControlDivElement { | 82 class MediaControlPanelEnclosureElement FINAL : public MediaControlDivElement { |
83 public: | 83 public: |
84 static PassRefPtr<MediaControlPanelEnclosureElement> create(Document*); | 84 static PassRefPtr<MediaControlPanelEnclosureElement> create(Document*); |
85 | 85 |
86 private: | 86 private: |
87 explicit MediaControlPanelEnclosureElement(Document*); | 87 explicit MediaControlPanelEnclosureElement(Document*); |
88 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 88 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
89 }; | 89 }; |
90 | 90 |
91 // ---------------------------- | 91 // ---------------------------- |
92 | 92 |
93 class MediaControlOverlayEnclosureElement : public MediaControlDivElement { | 93 class MediaControlOverlayEnclosureElement FINAL : public MediaControlDivElement
{ |
94 public: | 94 public: |
95 static PassRefPtr<MediaControlOverlayEnclosureElement> create(Document*); | 95 static PassRefPtr<MediaControlOverlayEnclosureElement> create(Document*); |
96 | 96 |
97 private: | 97 private: |
98 explicit MediaControlOverlayEnclosureElement(Document*); | 98 explicit MediaControlOverlayEnclosureElement(Document*); |
99 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 99 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
100 }; | 100 }; |
101 | 101 |
102 // ---------------------------- | 102 // ---------------------------- |
103 | 103 |
104 class MediaControlPanelMuteButtonElement : public MediaControlMuteButtonElement
{ | 104 class MediaControlPanelMuteButtonElement FINAL : public MediaControlMuteButtonEl
ement { |
105 public: | 105 public: |
106 static PassRefPtr<MediaControlPanelMuteButtonElement> create(Document*, Medi
aControls*); | 106 static PassRefPtr<MediaControlPanelMuteButtonElement> create(Document*, Medi
aControls*); |
107 | 107 |
108 virtual bool willRespondToMouseMoveEvents() OVERRIDE { return true; } | 108 virtual bool willRespondToMouseMoveEvents() OVERRIDE { return true; } |
109 | 109 |
110 private: | 110 private: |
111 explicit MediaControlPanelMuteButtonElement(Document*, MediaControls*); | 111 explicit MediaControlPanelMuteButtonElement(Document*, MediaControls*); |
112 | 112 |
113 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 113 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
114 virtual void defaultEventHandler(Event*) OVERRIDE; | 114 virtual void defaultEventHandler(Event*) OVERRIDE; |
115 | 115 |
116 MediaControls* m_controls; | 116 MediaControls* m_controls; |
117 }; | 117 }; |
118 | 118 |
119 // ---------------------------- | 119 // ---------------------------- |
120 | 120 |
121 class MediaControlVolumeSliderMuteButtonElement : public MediaControlMuteButtonE
lement { | 121 class MediaControlVolumeSliderMuteButtonElement FINAL : public MediaControlMuteB
uttonElement { |
122 public: | 122 public: |
123 static PassRefPtr<MediaControlVolumeSliderMuteButtonElement> create(Document
*); | 123 static PassRefPtr<MediaControlVolumeSliderMuteButtonElement> create(Document
*); |
124 | 124 |
125 private: | 125 private: |
126 explicit MediaControlVolumeSliderMuteButtonElement(Document*); | 126 explicit MediaControlVolumeSliderMuteButtonElement(Document*); |
127 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 127 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
128 }; | 128 }; |
129 | 129 |
130 | 130 |
131 // ---------------------------- | 131 // ---------------------------- |
132 | 132 |
133 class MediaControlPlayButtonElement : public MediaControlInputElement { | 133 class MediaControlPlayButtonElement FINAL : public MediaControlInputElement { |
134 public: | 134 public: |
135 static PassRefPtr<MediaControlPlayButtonElement> create(Document*); | 135 static PassRefPtr<MediaControlPlayButtonElement> create(Document*); |
136 | 136 |
137 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } | 137 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } |
138 virtual void updateDisplayType() OVERRIDE; | 138 virtual void updateDisplayType() OVERRIDE; |
139 | 139 |
140 private: | 140 private: |
141 explicit MediaControlPlayButtonElement(Document*); | 141 explicit MediaControlPlayButtonElement(Document*); |
142 | 142 |
143 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 143 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
144 virtual void defaultEventHandler(Event*) OVERRIDE; | 144 virtual void defaultEventHandler(Event*) OVERRIDE; |
145 }; | 145 }; |
146 | 146 |
147 // ---------------------------- | 147 // ---------------------------- |
148 | 148 |
149 class MediaControlOverlayPlayButtonElement : public MediaControlInputElement { | 149 class MediaControlOverlayPlayButtonElement FINAL : public MediaControlInputEleme
nt { |
150 public: | 150 public: |
151 static PassRefPtr<MediaControlOverlayPlayButtonElement> create(Document*); | 151 static PassRefPtr<MediaControlOverlayPlayButtonElement> create(Document*); |
152 | 152 |
153 virtual void updateDisplayType() OVERRIDE; | 153 virtual void updateDisplayType() OVERRIDE; |
154 | 154 |
155 private: | 155 private: |
156 explicit MediaControlOverlayPlayButtonElement(Document*); | 156 explicit MediaControlOverlayPlayButtonElement(Document*); |
157 | 157 |
158 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 158 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
159 virtual void defaultEventHandler(Event*) OVERRIDE; | 159 virtual void defaultEventHandler(Event*) OVERRIDE; |
160 }; | 160 }; |
161 | 161 |
162 // ---------------------------- | 162 // ---------------------------- |
163 | 163 |
164 class MediaControlToggleClosedCaptionsButtonElement : public MediaControlInputEl
ement { | 164 class MediaControlToggleClosedCaptionsButtonElement FINAL : public MediaControlI
nputElement { |
165 public: | 165 public: |
166 static PassRefPtr<MediaControlToggleClosedCaptionsButtonElement> create(Docu
ment*, MediaControls*); | 166 static PassRefPtr<MediaControlToggleClosedCaptionsButtonElement> create(Docu
ment*, MediaControls*); |
167 | 167 |
168 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } | 168 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } |
169 | 169 |
170 virtual void updateDisplayType() OVERRIDE; | 170 virtual void updateDisplayType() OVERRIDE; |
171 | 171 |
172 private: | 172 private: |
173 explicit MediaControlToggleClosedCaptionsButtonElement(Document*, MediaContr
ols*); | 173 explicit MediaControlToggleClosedCaptionsButtonElement(Document*, MediaContr
ols*); |
174 | 174 |
175 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 175 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
176 virtual void defaultEventHandler(Event*) OVERRIDE; | 176 virtual void defaultEventHandler(Event*) OVERRIDE; |
177 }; | 177 }; |
178 | 178 |
179 // ---------------------------- | 179 // ---------------------------- |
180 | 180 |
181 class MediaControlClosedCaptionsContainerElement : public MediaControlDivElement
{ | 181 class MediaControlClosedCaptionsContainerElement FINAL : public MediaControlDivE
lement { |
182 public: | 182 public: |
183 static PassRefPtr<MediaControlClosedCaptionsContainerElement> create(Documen
t*); | 183 static PassRefPtr<MediaControlClosedCaptionsContainerElement> create(Documen
t*); |
184 | 184 |
185 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } | 185 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } |
186 | 186 |
187 private: | 187 private: |
188 MediaControlClosedCaptionsContainerElement(Document*); | 188 MediaControlClosedCaptionsContainerElement(Document*); |
189 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 189 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
190 }; | 190 }; |
191 | 191 |
192 // ---------------------------- | 192 // ---------------------------- |
193 | 193 |
194 class MediaControlClosedCaptionsTrackListElement : public MediaControlDivElement
{ | 194 class MediaControlClosedCaptionsTrackListElement FINAL : public MediaControlDivE
lement { |
195 public: | 195 public: |
196 static PassRefPtr<MediaControlClosedCaptionsTrackListElement> create(Documen
t*, MediaControls*); | 196 static PassRefPtr<MediaControlClosedCaptionsTrackListElement> create(Documen
t*, MediaControls*); |
197 | 197 |
198 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } | 198 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } |
199 | 199 |
200 void updateDisplay(); | 200 void updateDisplay(); |
201 void resetTrackListMenu() { m_trackListHasChanged = true; } | 201 void resetTrackListMenu() { m_trackListHasChanged = true; } |
202 | 202 |
203 private: | 203 private: |
204 MediaControlClosedCaptionsTrackListElement(Document*, MediaControls*); | 204 MediaControlClosedCaptionsTrackListElement(Document*, MediaControls*); |
205 | 205 |
206 void rebuildTrackListMenu(); | 206 void rebuildTrackListMenu(); |
207 | 207 |
208 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 208 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
209 virtual void defaultEventHandler(Event*) OVERRIDE; | 209 virtual void defaultEventHandler(Event*) OVERRIDE; |
210 | 210 |
211 typedef Vector<RefPtr<Element> > TrackMenuItems; | 211 typedef Vector<RefPtr<Element> > TrackMenuItems; |
212 TrackMenuItems m_menuItems; | 212 TrackMenuItems m_menuItems; |
213 typedef HashMap<RefPtr<Element>, RefPtr<TextTrack> > MenuItemToTrackMap; | 213 typedef HashMap<RefPtr<Element>, RefPtr<TextTrack> > MenuItemToTrackMap; |
214 MenuItemToTrackMap m_menuToTrackMap; | 214 MenuItemToTrackMap m_menuToTrackMap; |
215 MediaControls* m_controls; | 215 MediaControls* m_controls; |
216 bool m_trackListHasChanged; | 216 bool m_trackListHasChanged; |
217 }; | 217 }; |
218 | 218 |
219 // ---------------------------- | 219 // ---------------------------- |
220 | 220 |
221 class MediaControlTimelineElement : public MediaControlInputElement { | 221 class MediaControlTimelineElement FINAL : public MediaControlInputElement { |
222 public: | 222 public: |
223 static PassRefPtr<MediaControlTimelineElement> create(Document*, MediaContro
ls*); | 223 static PassRefPtr<MediaControlTimelineElement> create(Document*, MediaContro
ls*); |
224 | 224 |
225 virtual bool willRespondToMouseClickEvents() OVERRIDE; | 225 virtual bool willRespondToMouseClickEvents() OVERRIDE; |
226 | 226 |
227 void setPosition(double); | 227 void setPosition(double); |
228 void setDuration(double); | 228 void setDuration(double); |
229 | 229 |
230 private: | 230 private: |
231 explicit MediaControlTimelineElement(Document*, MediaControls*); | 231 explicit MediaControlTimelineElement(Document*, MediaControls*); |
232 | 232 |
233 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 233 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
234 virtual void defaultEventHandler(Event*) OVERRIDE; | 234 virtual void defaultEventHandler(Event*) OVERRIDE; |
235 | 235 |
236 MediaControls* m_controls; | 236 MediaControls* m_controls; |
237 }; | 237 }; |
238 | 238 |
239 // ---------------------------- | 239 // ---------------------------- |
240 | 240 |
241 class MediaControlFullscreenButtonElement : public MediaControlInputElement { | 241 class MediaControlFullscreenButtonElement FINAL : public MediaControlInputElemen
t { |
242 public: | 242 public: |
243 static PassRefPtr<MediaControlFullscreenButtonElement> create(Document*); | 243 static PassRefPtr<MediaControlFullscreenButtonElement> create(Document*); |
244 | 244 |
245 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } | 245 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } |
246 | 246 |
247 virtual void setIsFullscreen(bool); | 247 virtual void setIsFullscreen(bool); |
248 | 248 |
249 private: | 249 private: |
250 explicit MediaControlFullscreenButtonElement(Document*); | 250 explicit MediaControlFullscreenButtonElement(Document*); |
251 | 251 |
252 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 252 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
253 virtual void defaultEventHandler(Event*) OVERRIDE; | 253 virtual void defaultEventHandler(Event*) OVERRIDE; |
254 }; | 254 }; |
255 | 255 |
256 // ---------------------------- | 256 // ---------------------------- |
257 | 257 |
258 class MediaControlPanelVolumeSliderElement : public MediaControlVolumeSliderElem
ent { | 258 class MediaControlPanelVolumeSliderElement FINAL : public MediaControlVolumeSlid
erElement { |
259 public: | 259 public: |
260 static PassRefPtr<MediaControlPanelVolumeSliderElement> create(Document*); | 260 static PassRefPtr<MediaControlPanelVolumeSliderElement> create(Document*); |
261 | 261 |
262 private: | 262 private: |
263 explicit MediaControlPanelVolumeSliderElement(Document*); | 263 explicit MediaControlPanelVolumeSliderElement(Document*); |
264 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 264 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
265 }; | 265 }; |
266 | 266 |
267 // ---------------------------- | 267 // ---------------------------- |
268 | 268 |
269 class MediaControlTimeRemainingDisplayElement : public MediaControlTimeDisplayEl
ement { | 269 class MediaControlTimeRemainingDisplayElement FINAL : public MediaControlTimeDis
playElement { |
270 public: | 270 public: |
271 static PassRefPtr<MediaControlTimeRemainingDisplayElement> create(Document*)
; | 271 static PassRefPtr<MediaControlTimeRemainingDisplayElement> create(Document*)
; |
272 | 272 |
273 private: | 273 private: |
274 explicit MediaControlTimeRemainingDisplayElement(Document*); | 274 explicit MediaControlTimeRemainingDisplayElement(Document*); |
275 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 275 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
276 }; | 276 }; |
277 | 277 |
278 // ---------------------------- | 278 // ---------------------------- |
279 | 279 |
280 class MediaControlCurrentTimeDisplayElement : public MediaControlTimeDisplayElem
ent { | 280 class MediaControlCurrentTimeDisplayElement FINAL : public MediaControlTimeDispl
ayElement { |
281 public: | 281 public: |
282 static PassRefPtr<MediaControlCurrentTimeDisplayElement> create(Document*); | 282 static PassRefPtr<MediaControlCurrentTimeDisplayElement> create(Document*); |
283 | 283 |
284 private: | 284 private: |
285 explicit MediaControlCurrentTimeDisplayElement(Document*); | 285 explicit MediaControlCurrentTimeDisplayElement(Document*); |
286 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 286 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
287 }; | 287 }; |
288 | 288 |
289 // ---------------------------- | 289 // ---------------------------- |
290 | 290 |
291 class MediaControlTextTrackContainerElement : public MediaControlDivElement, pub
lic TextTrackRepresentationClient { | 291 class MediaControlTextTrackContainerElement FINAL : public MediaControlDivElemen
t, public TextTrackRepresentationClient { |
292 public: | 292 public: |
293 static PassRefPtr<MediaControlTextTrackContainerElement> create(Document*); | 293 static PassRefPtr<MediaControlTextTrackContainerElement> create(Document*); |
294 | 294 |
295 void updateDisplay(); | 295 void updateDisplay(); |
296 void updateSizes(bool forceUpdate = false); | 296 void updateSizes(bool forceUpdate = false); |
297 static const AtomicString& textTrackContainerElementShadowPseudoId(); | 297 static const AtomicString& textTrackContainerElementShadowPseudoId(); |
298 | 298 |
299 private: | 299 private: |
300 explicit MediaControlTextTrackContainerElement(Document*); | 300 explicit MediaControlTextTrackContainerElement(Document*); |
301 virtual const AtomicString& shadowPseudoId() const OVERRIDE; | 301 virtual const AtomicString& shadowPseudoId() const OVERRIDE; |
302 | 302 |
303 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); | 303 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); |
304 | 304 |
305 virtual void paintTextTrackRepresentation(GraphicsContext*, const IntRect&)
OVERRIDE; | 305 virtual void paintTextTrackRepresentation(GraphicsContext*, const IntRect&)
OVERRIDE; |
306 virtual void textTrackRepresentationBoundsChanged(const IntRect&) OVERRIDE; | 306 virtual void textTrackRepresentationBoundsChanged(const IntRect&) OVERRIDE; |
307 OwnPtr<TextTrackRepresentation> m_textTrackRepresentation; | 307 OwnPtr<TextTrackRepresentation> m_textTrackRepresentation; |
308 | 308 |
309 IntRect m_videoDisplaySize; | 309 IntRect m_videoDisplaySize; |
310 float m_fontSize; | 310 float m_fontSize; |
311 }; | 311 }; |
312 | 312 |
313 | 313 |
314 } // namespace WebCore | 314 } // namespace WebCore |
315 | 315 |
316 #endif // MediaControlElements_h | 316 #endif // MediaControlElements_h |
OLD | NEW |