Chromium Code Reviews

Side by Side Diff: Source/core/html/shadow/MediaControlElements.h

Issue 195473002: Let MediaControls use the parent HTMLMediaElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
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 20 matching lines...)
31 #define MediaControlElements_h 31 #define MediaControlElements_h
32 32
33 #include "core/html/shadow/MediaControlElementTypes.h" 33 #include "core/html/shadow/MediaControlElementTypes.h"
34 34
35 namespace WebCore { 35 namespace WebCore {
36 36
37 // ---------------------------- 37 // ----------------------------
38 38
39 class MediaControlPanelElement FINAL : public MediaControlDivElement { 39 class MediaControlPanelElement FINAL : public MediaControlDivElement {
40 public: 40 public:
41 static PassRefPtr<MediaControlPanelElement> create(Document&); 41 static PassRefPtr<MediaControlPanelElement> create(HTMLMediaElement&);
42 42
43 void setCanBeDragged(bool); 43 void setCanBeDragged(bool);
44 void setIsDisplayed(bool); 44 void setIsDisplayed(bool);
45 45
46 void resetPosition(); 46 void resetPosition();
47 void makeOpaque(); 47 void makeOpaque();
48 void makeTransparent(); 48 void makeTransparent();
49 49
50 virtual bool willRespondToMouseMoveEvents() OVERRIDE { return true; } 50 virtual bool willRespondToMouseMoveEvents() OVERRIDE { return true; }
51 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } 51 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
52 52
53 private: 53 private:
54 explicit MediaControlPanelElement(Document&); 54 explicit MediaControlPanelElement(HTMLMediaElement&);
55 55
56 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 56 virtual const AtomicString& shadowPseudoId() const OVERRIDE;
57 virtual void defaultEventHandler(Event*) OVERRIDE; 57 virtual void defaultEventHandler(Event*) OVERRIDE;
58 58
59 void startDrag(const LayoutPoint& eventLocation); 59 void startDrag(const LayoutPoint& eventLocation);
60 void continueDrag(const LayoutPoint& eventLocation); 60 void continueDrag(const LayoutPoint& eventLocation);
61 void endDrag(); 61 void endDrag();
62 62
63 void startTimer(); 63 void startTimer();
64 void stopTimer(); 64 void stopTimer();
65 void transitionTimerFired(Timer<MediaControlPanelElement>*); 65 void transitionTimerFired(Timer<MediaControlPanelElement>*);
66 66
67 void setPosition(const LayoutPoint&); 67 void setPosition(const LayoutPoint&);
68 68
69 bool m_canBeDragged; 69 bool m_canBeDragged;
70 bool m_isBeingDragged; 70 bool m_isBeingDragged;
71 bool m_isDisplayed; 71 bool m_isDisplayed;
72 bool m_opaque; 72 bool m_opaque;
73 LayoutPoint m_lastDragEventLocation; 73 LayoutPoint m_lastDragEventLocation;
74 LayoutPoint m_cumulativeDragOffset; 74 LayoutPoint m_cumulativeDragOffset;
75 75
76 Timer<MediaControlPanelElement> m_transitionTimer; 76 Timer<MediaControlPanelElement> m_transitionTimer;
77 }; 77 };
78 78
79 // ---------------------------- 79 // ----------------------------
80 80
81 class MediaControlPanelEnclosureElement FINAL : public MediaControlDivElement { 81 class MediaControlPanelEnclosureElement FINAL : public MediaControlDivElement {
82 public: 82 public:
83 static PassRefPtr<MediaControlPanelEnclosureElement> create(Document&); 83 static PassRefPtr<MediaControlPanelEnclosureElement> create(HTMLMediaElement &);
84 84
85 private: 85 private:
86 explicit MediaControlPanelEnclosureElement(Document&); 86 explicit MediaControlPanelEnclosureElement(HTMLMediaElement&);
87 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 87 virtual const AtomicString& shadowPseudoId() const OVERRIDE;
88 }; 88 };
89 89
90 // ---------------------------- 90 // ----------------------------
91 91
92 class MediaControlOverlayEnclosureElement FINAL : public MediaControlDivElement { 92 class MediaControlOverlayEnclosureElement FINAL : public MediaControlDivElement {
93 public: 93 public:
94 static PassRefPtr<MediaControlOverlayEnclosureElement> create(Document&); 94 static PassRefPtr<MediaControlOverlayEnclosureElement> create(HTMLMediaEleme nt&);
95 95
96 private: 96 private:
97 explicit MediaControlOverlayEnclosureElement(Document&); 97 explicit MediaControlOverlayEnclosureElement(HTMLMediaElement&);
98 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 98 virtual const AtomicString& shadowPseudoId() const OVERRIDE;
99 }; 99 };
100 100
101 // ---------------------------- 101 // ----------------------------
102 102
103 class MediaControlMuteButtonElement FINAL : public MediaControlInputElement { 103 class MediaControlMuteButtonElement FINAL : public MediaControlInputElement {
104 public: 104 public:
105 static PassRefPtr<MediaControlMuteButtonElement> create(Document&); 105 static PassRefPtr<MediaControlMuteButtonElement> create(HTMLMediaElement&);
106 106
107 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } 107 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
108 virtual void updateDisplayType() OVERRIDE; 108 virtual void updateDisplayType() OVERRIDE;
109 109
110 private: 110 private:
111 explicit MediaControlMuteButtonElement(Document&); 111 explicit MediaControlMuteButtonElement(HTMLMediaElement&);
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 116
117 // ---------------------------- 117 // ----------------------------
118 118
119 class MediaControlPlayButtonElement FINAL : public MediaControlInputElement { 119 class MediaControlPlayButtonElement FINAL : public MediaControlInputElement {
120 public: 120 public:
121 static PassRefPtr<MediaControlPlayButtonElement> create(Document&); 121 static PassRefPtr<MediaControlPlayButtonElement> create(HTMLMediaElement&);
122 122
123 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } 123 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
124 virtual void updateDisplayType() OVERRIDE; 124 virtual void updateDisplayType() OVERRIDE;
125 125
126 private: 126 private:
127 explicit MediaControlPlayButtonElement(Document&); 127 explicit MediaControlPlayButtonElement(HTMLMediaElement&);
128 128
129 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 129 virtual const AtomicString& shadowPseudoId() const OVERRIDE;
130 virtual void defaultEventHandler(Event*) OVERRIDE; 130 virtual void defaultEventHandler(Event*) OVERRIDE;
131 }; 131 };
132 132
133 // ---------------------------- 133 // ----------------------------
134 134
135 class MediaControlOverlayPlayButtonElement FINAL : public MediaControlInputEleme nt { 135 class MediaControlOverlayPlayButtonElement FINAL : public MediaControlInputEleme nt {
136 public: 136 public:
137 static PassRefPtr<MediaControlOverlayPlayButtonElement> create(Document&); 137 static PassRefPtr<MediaControlOverlayPlayButtonElement> create(HTMLMediaElem ent&);
138 138
139 virtual void updateDisplayType() OVERRIDE; 139 virtual void updateDisplayType() OVERRIDE;
140 140
141 private: 141 private:
142 explicit MediaControlOverlayPlayButtonElement(Document&); 142 explicit MediaControlOverlayPlayButtonElement(HTMLMediaElement&);
143 143
144 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 144 virtual const AtomicString& shadowPseudoId() const OVERRIDE;
145 virtual void defaultEventHandler(Event*) OVERRIDE; 145 virtual void defaultEventHandler(Event*) OVERRIDE;
146 }; 146 };
147 147
148 // ---------------------------- 148 // ----------------------------
149 149
150 class MediaControlToggleClosedCaptionsButtonElement FINAL : public MediaControlI nputElement { 150 class MediaControlToggleClosedCaptionsButtonElement FINAL : public MediaControlI nputElement {
151 public: 151 public:
152 static PassRefPtr<MediaControlToggleClosedCaptionsButtonElement> create(Docu ment&); 152 static PassRefPtr<MediaControlToggleClosedCaptionsButtonElement> create(HTML MediaElement&);
153 153
154 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } 154 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
155 155
156 virtual void updateDisplayType() OVERRIDE; 156 virtual void updateDisplayType() OVERRIDE;
157 157
158 private: 158 private:
159 explicit MediaControlToggleClosedCaptionsButtonElement(Document&); 159 explicit MediaControlToggleClosedCaptionsButtonElement(HTMLMediaElement&);
160 160
161 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 161 virtual const AtomicString& shadowPseudoId() const OVERRIDE;
162 virtual void defaultEventHandler(Event*) OVERRIDE; 162 virtual void defaultEventHandler(Event*) OVERRIDE;
163 }; 163 };
164 164
165 // ---------------------------- 165 // ----------------------------
166 166
167 class MediaControlTimelineElement FINAL : public MediaControlInputElement { 167 class MediaControlTimelineElement FINAL : public MediaControlInputElement {
168 public: 168 public:
169 static PassRefPtr<MediaControlTimelineElement> create(Document&, MediaContro ls*); 169 static PassRefPtr<MediaControlTimelineElement> create(HTMLMediaElement&, Med iaControls*);
170 170
171 virtual bool willRespondToMouseClickEvents() OVERRIDE; 171 virtual bool willRespondToMouseClickEvents() OVERRIDE;
172 172
173 void setPosition(double); 173 void setPosition(double);
174 void setDuration(double); 174 void setDuration(double);
175 175
176 private: 176 private:
177 explicit MediaControlTimelineElement(Document&, MediaControls*); 177 explicit MediaControlTimelineElement(HTMLMediaElement&, MediaControls*);
acolwell GONE FROM CHROMIUM 2014/03/12 00:22:32 nit: drop explicit
philipj_slow 2014/03/12 04:30:11 Done.
178 178
179 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 179 virtual const AtomicString& shadowPseudoId() const OVERRIDE;
180 virtual void defaultEventHandler(Event*) OVERRIDE; 180 virtual void defaultEventHandler(Event*) OVERRIDE;
181 181
182 MediaControls* m_controls; 182 MediaControls* m_controls;
183 }; 183 };
184 184
185 // ---------------------------- 185 // ----------------------------
186 186
187 class MediaControlFullscreenButtonElement FINAL : public MediaControlInputElemen t { 187 class MediaControlFullscreenButtonElement FINAL : public MediaControlInputElemen t {
188 public: 188 public:
189 static PassRefPtr<MediaControlFullscreenButtonElement> create(Document&); 189 static PassRefPtr<MediaControlFullscreenButtonElement> create(HTMLMediaEleme nt&);
190 190
191 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; } 191 virtual bool willRespondToMouseClickEvents() OVERRIDE { return true; }
192 192
193 void setIsFullscreen(bool); 193 void setIsFullscreen(bool);
194 194
195 private: 195 private:
196 explicit MediaControlFullscreenButtonElement(Document&); 196 explicit MediaControlFullscreenButtonElement(HTMLMediaElement&);
197 197
198 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 198 virtual const AtomicString& shadowPseudoId() const OVERRIDE;
199 virtual void defaultEventHandler(Event*) OVERRIDE; 199 virtual void defaultEventHandler(Event*) OVERRIDE;
200 }; 200 };
201 201
202 // ---------------------------- 202 // ----------------------------
203 203
204 class MediaControlVolumeSliderElement FINAL : public MediaControlInputElement { 204 class MediaControlVolumeSliderElement FINAL : public MediaControlInputElement {
205 public: 205 public:
206 static PassRefPtr<MediaControlVolumeSliderElement> create(Document&); 206 static PassRefPtr<MediaControlVolumeSliderElement> create(HTMLMediaElement&) ;
207 207
208 virtual bool willRespondToMouseMoveEvents() OVERRIDE; 208 virtual bool willRespondToMouseMoveEvents() OVERRIDE;
209 virtual bool willRespondToMouseClickEvents() OVERRIDE; 209 virtual bool willRespondToMouseClickEvents() OVERRIDE;
210 void setVolume(double); 210 void setVolume(double);
211 211
212 private: 212 private:
213 explicit MediaControlVolumeSliderElement(Document&); 213 explicit MediaControlVolumeSliderElement(HTMLMediaElement&);
214 214
215 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 215 virtual const AtomicString& shadowPseudoId() const OVERRIDE;
216 virtual void defaultEventHandler(Event*) OVERRIDE; 216 virtual void defaultEventHandler(Event*) OVERRIDE;
217 }; 217 };
218 218
219 // ---------------------------- 219 // ----------------------------
220 220
221 class MediaControlTimeRemainingDisplayElement FINAL : public MediaControlTimeDis playElement { 221 class MediaControlTimeRemainingDisplayElement FINAL : public MediaControlTimeDis playElement {
222 public: 222 public:
223 static PassRefPtr<MediaControlTimeRemainingDisplayElement> create(Document&) ; 223 static PassRefPtr<MediaControlTimeRemainingDisplayElement> create(HTMLMediaE lement&);
224 224
225 private: 225 private:
226 explicit MediaControlTimeRemainingDisplayElement(Document&); 226 explicit MediaControlTimeRemainingDisplayElement(HTMLMediaElement&);
227 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 227 virtual const AtomicString& shadowPseudoId() const OVERRIDE;
228 }; 228 };
229 229
230 // ---------------------------- 230 // ----------------------------
231 231
232 class MediaControlCurrentTimeDisplayElement FINAL : public MediaControlTimeDispl ayElement { 232 class MediaControlCurrentTimeDisplayElement FINAL : public MediaControlTimeDispl ayElement {
233 public: 233 public:
234 static PassRefPtr<MediaControlCurrentTimeDisplayElement> create(Document&); 234 static PassRefPtr<MediaControlCurrentTimeDisplayElement> create(HTMLMediaEle ment&);
235 235
236 private: 236 private:
237 explicit MediaControlCurrentTimeDisplayElement(Document&); 237 explicit MediaControlCurrentTimeDisplayElement(HTMLMediaElement&);
238 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 238 virtual const AtomicString& shadowPseudoId() const OVERRIDE;
239 }; 239 };
240 240
241 // ---------------------------- 241 // ----------------------------
242 242
243 class MediaControlTextTrackContainerElement FINAL : public MediaControlDivElemen t { 243 class MediaControlTextTrackContainerElement FINAL : public MediaControlDivElemen t {
244 public: 244 public:
245 static PassRefPtr<MediaControlTextTrackContainerElement> create(Document&); 245 static PassRefPtr<MediaControlTextTrackContainerElement> create(HTMLMediaEle ment&);
246 246
247 void updateDisplay(); 247 void updateDisplay();
248 void updateSizes(); 248 void updateSizes();
249 static const AtomicString& textTrackContainerElementShadowPseudoId(); 249 static const AtomicString& textTrackContainerElementShadowPseudoId();
250 250
251 private: 251 private:
252 explicit MediaControlTextTrackContainerElement(Document&); 252 explicit MediaControlTextTrackContainerElement(HTMLMediaElement&);
253 virtual const AtomicString& shadowPseudoId() const OVERRIDE; 253 virtual const AtomicString& shadowPseudoId() const OVERRIDE;
254 254
255 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; 255 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
256 256
257 IntRect m_videoDisplaySize; 257 IntRect m_videoDisplaySize;
258 float m_fontSize; 258 float m_fontSize;
259 }; 259 };
260 260
261 261
262 } // namespace WebCore 262 } // namespace WebCore
263 263
264 #endif // MediaControlElements_h 264 #endif // MediaControlElements_h
OLDNEW

Powered by Google App Engine