OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2011, 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 11 matching lines...) Expand all Loading... |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/html/shadow/MediaControls.h" | 28 #include "core/html/shadow/MediaControls.h" |
29 | 29 |
30 #include "bindings/v8/ExceptionStatePlaceholder.h" | 30 #include "bindings/v8/ExceptionStatePlaceholder.h" |
31 #include "core/events/MouseEvent.h" | 31 #include "core/events/MouseEvent.h" |
| 32 #include "core/html/HTMLMediaElement.h" |
| 33 #include "core/html/MediaController.h" |
32 #include "core/rendering/RenderTheme.h" | 34 #include "core/rendering/RenderTheme.h" |
33 | 35 |
34 namespace WebCore { | 36 namespace WebCore { |
35 | 37 |
36 #if OS(ANDROID) | 38 #if OS(ANDROID) |
37 static const bool alwaysHideFullscreenControls = true; | 39 static const bool alwaysHideFullscreenControls = true; |
38 static const bool needOverlayPlayButton = true; | 40 static const bool needOverlayPlayButton = true; |
39 #else | 41 #else |
40 static const bool alwaysHideFullscreenControls = false; | 42 static const bool alwaysHideFullscreenControls = false; |
41 static const bool needOverlayPlayButton = false; | 43 static const bool needOverlayPlayButton = false; |
42 #endif | 44 #endif |
43 | 45 |
44 static const double timeWithoutMouseMovementBeforeHidingFullscreenControls = 3; | 46 static const double timeWithoutMouseMovementBeforeHidingFullscreenControls = 3; |
45 | 47 |
46 MediaControls::MediaControls(Document& document) | 48 MediaControls::MediaControls(HTMLMediaElement& mediaElement) |
47 : HTMLDivElement(document) | 49 : HTMLDivElement(mediaElement.document()) |
48 , m_mediaController(0) | 50 , m_mediaElement(mediaElement) |
49 , m_panel(0) | 51 , m_panel(0) |
50 , m_textDisplayContainer(0) | 52 , m_textDisplayContainer(0) |
51 , m_overlayPlayButton(0) | 53 , m_overlayPlayButton(0) |
52 , m_overlayEnclosure(0) | 54 , m_overlayEnclosure(0) |
53 , m_playButton(0) | 55 , m_playButton(0) |
54 , m_currentTimeDisplay(0) | 56 , m_currentTimeDisplay(0) |
55 , m_timeline(0) | 57 , m_timeline(0) |
56 , m_muteButton(0) | 58 , m_muteButton(0) |
57 , m_volumeSlider(0) | 59 , m_volumeSlider(0) |
58 , m_toggleClosedCaptionsButton(0) | 60 , m_toggleClosedCaptionsButton(0) |
59 , m_fullScreenButton(0) | 61 , m_fullScreenButton(0) |
60 , m_durationDisplay(0) | 62 , m_durationDisplay(0) |
61 , m_enclosure(0) | 63 , m_enclosure(0) |
62 , m_hideFullscreenControlsTimer(this, &MediaControls::hideFullscreenControls
TimerFired) | 64 , m_hideFullscreenControlsTimer(this, &MediaControls::hideFullscreenControls
TimerFired) |
63 , m_isFullscreen(false) | 65 , m_isFullscreen(false) |
64 , m_isMouseOverControls(false) | 66 , m_isMouseOverControls(false) |
65 { | 67 { |
66 } | 68 } |
67 | 69 |
68 PassRefPtr<MediaControls> MediaControls::create(Document& document) | 70 PassRefPtr<MediaControls> MediaControls::create(HTMLMediaElement& mediaElement) |
69 { | 71 { |
70 RefPtr<MediaControls> controls = adoptRef(new MediaControls(document)); | 72 RefPtr<MediaControls> controls = adoptRef(new MediaControls(mediaElement)); |
71 | 73 |
72 if (controls->initializeControls(document)) | 74 if (controls->initializeControls()) |
73 return controls.release(); | 75 return controls.release(); |
74 | 76 |
75 return nullptr; | 77 return nullptr; |
76 } | 78 } |
77 | 79 |
78 bool MediaControls::initializeControls(Document& document) | 80 bool MediaControls::initializeControls() |
79 { | 81 { |
80 TrackExceptionState exceptionState; | 82 TrackExceptionState exceptionState; |
81 | 83 |
82 if (needOverlayPlayButton) { | 84 if (needOverlayPlayButton) { |
83 RefPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = MediaCont
rolOverlayEnclosureElement::create(document); | 85 RefPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = MediaCont
rolOverlayEnclosureElement::create(*this); |
84 RefPtr<MediaControlOverlayPlayButtonElement> overlayPlayButton = MediaCo
ntrolOverlayPlayButtonElement::create(document); | 86 RefPtr<MediaControlOverlayPlayButtonElement> overlayPlayButton = MediaCo
ntrolOverlayPlayButtonElement::create(*this); |
85 m_overlayPlayButton = overlayPlayButton.get(); | 87 m_overlayPlayButton = overlayPlayButton.get(); |
86 overlayEnclosure->appendChild(overlayPlayButton.release(), exceptionStat
e); | 88 overlayEnclosure->appendChild(overlayPlayButton.release(), exceptionStat
e); |
87 if (exceptionState.hadException()) | 89 if (exceptionState.hadException()) |
88 return false; | 90 return false; |
89 | 91 |
90 m_overlayEnclosure = overlayEnclosure.get(); | 92 m_overlayEnclosure = overlayEnclosure.get(); |
91 appendChild(overlayEnclosure.release(), exceptionState); | 93 appendChild(overlayEnclosure.release(), exceptionState); |
92 if (exceptionState.hadException()) | 94 if (exceptionState.hadException()) |
93 return false; | 95 return false; |
94 } | 96 } |
95 | 97 |
96 // Create an enclosing element for the panel so we can visually offset the c
ontrols correctly. | 98 // Create an enclosing element for the panel so we can visually offset the c
ontrols correctly. |
97 RefPtr<MediaControlPanelEnclosureElement> enclosure = MediaControlPanelEnclo
sureElement::create(document); | 99 RefPtr<MediaControlPanelEnclosureElement> enclosure = MediaControlPanelEnclo
sureElement::create(*this); |
98 | 100 |
99 RefPtr<MediaControlPanelElement> panel = MediaControlPanelElement::create(do
cument); | 101 RefPtr<MediaControlPanelElement> panel = MediaControlPanelElement::create(*t
his); |
100 | 102 |
101 RefPtr<MediaControlPlayButtonElement> playButton = MediaControlPlayButtonEle
ment::create(document); | 103 RefPtr<MediaControlPlayButtonElement> playButton = MediaControlPlayButtonEle
ment::create(*this); |
102 m_playButton = playButton.get(); | 104 m_playButton = playButton.get(); |
103 panel->appendChild(playButton.release(), exceptionState); | 105 panel->appendChild(playButton.release(), exceptionState); |
104 if (exceptionState.hadException()) | 106 if (exceptionState.hadException()) |
105 return false; | 107 return false; |
106 | 108 |
107 RefPtr<MediaControlTimelineElement> timeline = MediaControlTimelineElement::
create(document, this); | 109 RefPtr<MediaControlTimelineElement> timeline = MediaControlTimelineElement::
create(*this); |
108 m_timeline = timeline.get(); | 110 m_timeline = timeline.get(); |
109 panel->appendChild(timeline.release(), exceptionState); | 111 panel->appendChild(timeline.release(), exceptionState); |
110 if (exceptionState.hadException()) | 112 if (exceptionState.hadException()) |
111 return false; | 113 return false; |
112 | 114 |
113 RefPtr<MediaControlCurrentTimeDisplayElement> currentTimeDisplay = MediaCont
rolCurrentTimeDisplayElement::create(document); | 115 RefPtr<MediaControlCurrentTimeDisplayElement> currentTimeDisplay = MediaCont
rolCurrentTimeDisplayElement::create(*this); |
114 m_currentTimeDisplay = currentTimeDisplay.get(); | 116 m_currentTimeDisplay = currentTimeDisplay.get(); |
115 m_currentTimeDisplay->hide(); | 117 m_currentTimeDisplay->hide(); |
116 panel->appendChild(currentTimeDisplay.release(), exceptionState); | 118 panel->appendChild(currentTimeDisplay.release(), exceptionState); |
117 if (exceptionState.hadException()) | 119 if (exceptionState.hadException()) |
118 return false; | 120 return false; |
119 | 121 |
120 RefPtr<MediaControlTimeRemainingDisplayElement> durationDisplay = MediaContr
olTimeRemainingDisplayElement::create(document); | 122 RefPtr<MediaControlTimeRemainingDisplayElement> durationDisplay = MediaContr
olTimeRemainingDisplayElement::create(*this); |
121 m_durationDisplay = durationDisplay.get(); | 123 m_durationDisplay = durationDisplay.get(); |
122 panel->appendChild(durationDisplay.release(), exceptionState); | 124 panel->appendChild(durationDisplay.release(), exceptionState); |
123 if (exceptionState.hadException()) | 125 if (exceptionState.hadException()) |
124 return false; | 126 return false; |
125 | 127 |
126 RefPtr<MediaControlMuteButtonElement> muteButton = MediaControlMuteButtonEle
ment::create(document); | 128 RefPtr<MediaControlMuteButtonElement> muteButton = MediaControlMuteButtonEle
ment::create(*this); |
127 m_muteButton = muteButton.get(); | 129 m_muteButton = muteButton.get(); |
128 panel->appendChild(muteButton.release(), exceptionState); | 130 panel->appendChild(muteButton.release(), exceptionState); |
129 if (exceptionState.hadException()) | 131 if (exceptionState.hadException()) |
130 return false; | 132 return false; |
131 | 133 |
132 RefPtr<MediaControlVolumeSliderElement> slider = MediaControlVolumeSliderEle
ment::create(document); | 134 RefPtr<MediaControlVolumeSliderElement> slider = MediaControlVolumeSliderEle
ment::create(*this); |
133 m_volumeSlider = slider.get(); | 135 m_volumeSlider = slider.get(); |
134 panel->appendChild(slider.release(), exceptionState); | 136 panel->appendChild(slider.release(), exceptionState); |
135 if (exceptionState.hadException()) | 137 if (exceptionState.hadException()) |
136 return false; | 138 return false; |
137 | 139 |
138 RefPtr<MediaControlToggleClosedCaptionsButtonElement> toggleClosedCaptionsBu
tton = MediaControlToggleClosedCaptionsButtonElement::create(document); | 140 RefPtr<MediaControlToggleClosedCaptionsButtonElement> toggleClosedCaptionsBu
tton = MediaControlToggleClosedCaptionsButtonElement::create(*this); |
139 m_toggleClosedCaptionsButton = toggleClosedCaptionsButton.get(); | 141 m_toggleClosedCaptionsButton = toggleClosedCaptionsButton.get(); |
140 panel->appendChild(toggleClosedCaptionsButton.release(), exceptionState); | 142 panel->appendChild(toggleClosedCaptionsButton.release(), exceptionState); |
141 if (exceptionState.hadException()) | 143 if (exceptionState.hadException()) |
142 return false; | 144 return false; |
143 | 145 |
144 RefPtr<MediaControlFullscreenButtonElement> fullscreenButton = MediaControlF
ullscreenButtonElement::create(document); | 146 RefPtr<MediaControlFullscreenButtonElement> fullscreenButton = MediaControlF
ullscreenButtonElement::create(*this); |
145 m_fullScreenButton = fullscreenButton.get(); | 147 m_fullScreenButton = fullscreenButton.get(); |
146 panel->appendChild(fullscreenButton.release(), exceptionState); | 148 panel->appendChild(fullscreenButton.release(), exceptionState); |
147 if (exceptionState.hadException()) | 149 if (exceptionState.hadException()) |
148 return false; | 150 return false; |
149 | 151 |
150 m_panel = panel.get(); | 152 m_panel = panel.get(); |
151 enclosure->appendChild(panel.release(), exceptionState); | 153 enclosure->appendChild(panel.release(), exceptionState); |
152 if (exceptionState.hadException()) | 154 if (exceptionState.hadException()) |
153 return false; | 155 return false; |
154 | 156 |
155 m_enclosure = enclosure.get(); | 157 m_enclosure = enclosure.get(); |
156 appendChild(enclosure.release(), exceptionState); | 158 appendChild(enclosure.release(), exceptionState); |
157 if (exceptionState.hadException()) | 159 if (exceptionState.hadException()) |
158 return false; | 160 return false; |
159 | 161 |
160 return true; | 162 return true; |
161 } | 163 } |
162 | 164 |
163 void MediaControls::setMediaController(MediaControllerInterface* controller) | 165 MediaControllerInterface& MediaControls::mediaControllerInterface() const |
164 { | 166 { |
165 if (m_mediaController == controller) | 167 if (m_mediaElement.controller()) |
166 return; | 168 return *m_mediaElement.controller(); |
167 m_mediaController = controller; | 169 return m_mediaElement; |
168 | |
169 m_panel->setMediaController(controller); | |
170 if (m_textDisplayContainer) | |
171 m_textDisplayContainer->setMediaController(controller); | |
172 if (m_overlayPlayButton) | |
173 m_overlayPlayButton->setMediaController(controller); | |
174 if (m_overlayEnclosure) | |
175 m_overlayEnclosure->setMediaController(controller); | |
176 m_playButton->setMediaController(controller); | |
177 m_currentTimeDisplay->setMediaController(controller); | |
178 m_timeline->setMediaController(controller); | |
179 m_muteButton->setMediaController(controller); | |
180 m_volumeSlider->setMediaController(controller); | |
181 m_toggleClosedCaptionsButton->setMediaController(controller); | |
182 m_fullScreenButton->setMediaController(controller); | |
183 m_durationDisplay->setMediaController(controller); | |
184 m_enclosure->setMediaController(controller); | |
185 } | 170 } |
186 | 171 |
187 void MediaControls::reset() | 172 void MediaControls::reset() |
188 { | 173 { |
189 double duration = m_mediaController->duration(); | 174 double duration = mediaControllerInterface().duration(); |
190 m_durationDisplay->setInnerText(RenderTheme::theme().formatMediaControlsTime
(duration), ASSERT_NO_EXCEPTION); | 175 m_durationDisplay->setInnerText(RenderTheme::theme().formatMediaControlsTime
(duration), ASSERT_NO_EXCEPTION); |
191 m_durationDisplay->setCurrentValue(duration); | 176 m_durationDisplay->setCurrentValue(duration); |
192 | 177 |
193 m_playButton->updateDisplayType(); | 178 m_playButton->updateDisplayType(); |
194 | 179 |
195 updateCurrentTimeDisplay(); | 180 updateCurrentTimeDisplay(); |
196 | 181 |
197 m_timeline->setDuration(m_mediaController->duration()); | 182 m_timeline->setDuration(mediaControllerInterface().duration()); |
198 m_timeline->setPosition(m_mediaController->currentTime()); | 183 m_timeline->setPosition(mediaControllerInterface().currentTime()); |
199 | 184 |
200 if (!m_mediaController->hasAudio()) { | 185 if (!mediaControllerInterface().hasAudio()) { |
201 m_volumeSlider->hide(); | 186 m_volumeSlider->hide(); |
202 } else { | 187 } else { |
203 m_volumeSlider->show(); | 188 m_volumeSlider->show(); |
204 m_volumeSlider->setVolume(m_mediaController->volume()); | 189 m_volumeSlider->setVolume(mediaControllerInterface().volume()); |
205 } | 190 } |
206 | 191 |
207 refreshClosedCaptionsButtonVisibility(); | 192 refreshClosedCaptionsButtonVisibility(); |
208 | 193 |
209 if (m_mediaController->hasVideo()) | 194 if (mediaControllerInterface().hasVideo()) |
210 m_fullScreenButton->show(); | 195 m_fullScreenButton->show(); |
211 else | 196 else |
212 m_fullScreenButton->hide(); | 197 m_fullScreenButton->hide(); |
213 | 198 |
214 makeOpaque(); | 199 makeOpaque(); |
215 } | 200 } |
216 | 201 |
217 void MediaControls::show() | 202 void MediaControls::show() |
218 { | 203 { |
219 makeOpaque(); | 204 makeOpaque(); |
(...skipping 23 matching lines...) Expand all Loading... |
243 } | 228 } |
244 | 229 |
245 void MediaControls::playbackStarted() | 230 void MediaControls::playbackStarted() |
246 { | 231 { |
247 m_currentTimeDisplay->show(); | 232 m_currentTimeDisplay->show(); |
248 m_durationDisplay->hide(); | 233 m_durationDisplay->hide(); |
249 | 234 |
250 if (m_overlayPlayButton) | 235 if (m_overlayPlayButton) |
251 m_overlayPlayButton->updateDisplayType(); | 236 m_overlayPlayButton->updateDisplayType(); |
252 m_playButton->updateDisplayType(); | 237 m_playButton->updateDisplayType(); |
253 m_timeline->setPosition(m_mediaController->currentTime()); | 238 m_timeline->setPosition(mediaControllerInterface().currentTime()); |
254 updateCurrentTimeDisplay(); | 239 updateCurrentTimeDisplay(); |
255 | 240 |
256 if (m_isFullscreen) | 241 if (m_isFullscreen) |
257 startHideFullscreenControlsTimer(); | 242 startHideFullscreenControlsTimer(); |
258 } | 243 } |
259 | 244 |
260 void MediaControls::playbackProgressed() | 245 void MediaControls::playbackProgressed() |
261 { | 246 { |
262 m_timeline->setPosition(m_mediaController->currentTime()); | 247 m_timeline->setPosition(mediaControllerInterface().currentTime()); |
263 updateCurrentTimeDisplay(); | 248 updateCurrentTimeDisplay(); |
264 | 249 |
265 if (!m_isMouseOverControls && m_mediaController->hasVideo()) | 250 if (!m_isMouseOverControls && mediaControllerInterface().hasVideo()) |
266 makeTransparent(); | 251 makeTransparent(); |
267 } | 252 } |
268 | 253 |
269 void MediaControls::playbackStopped() | 254 void MediaControls::playbackStopped() |
270 { | 255 { |
271 if (m_overlayPlayButton) | 256 if (m_overlayPlayButton) |
272 m_overlayPlayButton->updateDisplayType(); | 257 m_overlayPlayButton->updateDisplayType(); |
273 m_playButton->updateDisplayType(); | 258 m_playButton->updateDisplayType(); |
274 m_timeline->setPosition(m_mediaController->currentTime()); | 259 m_timeline->setPosition(mediaControllerInterface().currentTime()); |
275 updateCurrentTimeDisplay(); | 260 updateCurrentTimeDisplay(); |
276 makeOpaque(); | 261 makeOpaque(); |
277 | 262 |
278 stopHideFullscreenControlsTimer(); | 263 stopHideFullscreenControlsTimer(); |
279 } | 264 } |
280 | 265 |
281 void MediaControls::updateCurrentTimeDisplay() | 266 void MediaControls::updateCurrentTimeDisplay() |
282 { | 267 { |
283 double now = m_mediaController->currentTime(); | 268 double now = mediaControllerInterface().currentTime(); |
284 double duration = m_mediaController->duration(); | 269 double duration = mediaControllerInterface().duration(); |
285 | 270 |
286 // After seek, hide duration display and show current time. | 271 // After seek, hide duration display and show current time. |
287 if (now > 0) { | 272 if (now > 0) { |
288 m_currentTimeDisplay->show(); | 273 m_currentTimeDisplay->show(); |
289 m_durationDisplay->hide(); | 274 m_durationDisplay->hide(); |
290 } | 275 } |
291 | 276 |
292 // Allow the theme to format the time. | 277 // Allow the theme to format the time. |
293 m_currentTimeDisplay->setInnerText(RenderTheme::theme().formatMediaControlsC
urrentTime(now, duration), IGNORE_EXCEPTION); | 278 m_currentTimeDisplay->setInnerText(RenderTheme::theme().formatMediaControlsC
urrentTime(now, duration), IGNORE_EXCEPTION); |
294 m_currentTimeDisplay->setCurrentValue(now); | 279 m_currentTimeDisplay->setCurrentValue(now); |
295 } | 280 } |
296 | 281 |
297 void MediaControls::changedMute() | 282 void MediaControls::changedMute() |
298 { | 283 { |
299 m_muteButton->updateDisplayType(); | 284 m_muteButton->updateDisplayType(); |
300 | 285 |
301 if (m_mediaController->muted()) | 286 if (mediaControllerInterface().muted()) |
302 m_volumeSlider->setVolume(0); | 287 m_volumeSlider->setVolume(0); |
303 else | 288 else |
304 m_volumeSlider->setVolume(m_mediaController->volume()); | 289 m_volumeSlider->setVolume(mediaControllerInterface().volume()); |
305 } | 290 } |
306 | 291 |
307 void MediaControls::changedVolume() | 292 void MediaControls::changedVolume() |
308 { | 293 { |
309 m_volumeSlider->setVolume(m_mediaController->volume()); | 294 m_volumeSlider->setVolume(mediaControllerInterface().volume()); |
310 if (m_muteButton->renderer()) | 295 if (m_muteButton->renderer()) |
311 m_muteButton->renderer()->repaint(); | 296 m_muteButton->renderer()->repaint(); |
312 } | 297 } |
313 | 298 |
314 void MediaControls::changedClosedCaptionsVisibility() | 299 void MediaControls::changedClosedCaptionsVisibility() |
315 { | 300 { |
316 m_toggleClosedCaptionsButton->updateDisplayType(); | 301 m_toggleClosedCaptionsButton->updateDisplayType(); |
317 } | 302 } |
318 | 303 |
319 void MediaControls::refreshClosedCaptionsButtonVisibility() | 304 void MediaControls::refreshClosedCaptionsButtonVisibility() |
320 { | 305 { |
321 if (m_mediaController->hasClosedCaptions()) | 306 if (mediaControllerInterface().hasClosedCaptions()) |
322 m_toggleClosedCaptionsButton->show(); | 307 m_toggleClosedCaptionsButton->show(); |
323 else | 308 else |
324 m_toggleClosedCaptionsButton->hide(); | 309 m_toggleClosedCaptionsButton->hide(); |
325 } | 310 } |
326 | 311 |
327 void MediaControls::closedCaptionTracksChanged() | 312 void MediaControls::closedCaptionTracksChanged() |
328 { | 313 { |
329 refreshClosedCaptionsButtonVisibility(); | 314 refreshClosedCaptionsButtonVisibility(); |
330 } | 315 } |
331 | 316 |
(...skipping 11 matching lines...) Expand all Loading... |
343 stopHideFullscreenControlsTimer(); | 328 stopHideFullscreenControlsTimer(); |
344 } | 329 } |
345 | 330 |
346 void MediaControls::defaultEventHandler(Event* event) | 331 void MediaControls::defaultEventHandler(Event* event) |
347 { | 332 { |
348 HTMLDivElement::defaultEventHandler(event); | 333 HTMLDivElement::defaultEventHandler(event); |
349 | 334 |
350 if (event->type() == EventTypeNames::mouseover) { | 335 if (event->type() == EventTypeNames::mouseover) { |
351 if (!containsRelatedTarget(event)) { | 336 if (!containsRelatedTarget(event)) { |
352 m_isMouseOverControls = true; | 337 m_isMouseOverControls = true; |
353 if (!m_mediaController->canPlay()) { | 338 if (!mediaControllerInterface().canPlay()) { |
354 makeOpaque(); | 339 makeOpaque(); |
355 if (shouldHideFullscreenControls()) | 340 if (shouldHideFullscreenControls()) |
356 startHideFullscreenControlsTimer(); | 341 startHideFullscreenControlsTimer(); |
357 } | 342 } |
358 } | 343 } |
359 return; | 344 return; |
360 } | 345 } |
361 | 346 |
362 if (event->type() == EventTypeNames::mouseout) { | 347 if (event->type() == EventTypeNames::mouseout) { |
363 if (!containsRelatedTarget(event)) { | 348 if (!containsRelatedTarget(event)) { |
(...skipping 10 matching lines...) Expand all Loading... |
374 makeOpaque(); | 359 makeOpaque(); |
375 if (shouldHideFullscreenControls()) | 360 if (shouldHideFullscreenControls()) |
376 startHideFullscreenControlsTimer(); | 361 startHideFullscreenControlsTimer(); |
377 } | 362 } |
378 return; | 363 return; |
379 } | 364 } |
380 } | 365 } |
381 | 366 |
382 void MediaControls::hideFullscreenControlsTimerFired(Timer<MediaControls>*) | 367 void MediaControls::hideFullscreenControlsTimerFired(Timer<MediaControls>*) |
383 { | 368 { |
384 if (m_mediaController->paused()) | 369 if (mediaControllerInterface().paused()) |
385 return; | 370 return; |
386 | 371 |
387 if (!m_isFullscreen) | 372 if (!m_isFullscreen) |
388 return; | 373 return; |
389 | 374 |
390 if (!shouldHideFullscreenControls()) | 375 if (!shouldHideFullscreenControls()) |
391 return; | 376 return; |
392 | 377 |
393 makeTransparent(); | 378 makeTransparent(); |
394 } | 379 } |
(...skipping 25 matching lines...) Expand all Loading... |
420 if (!relatedTarget) | 405 if (!relatedTarget) |
421 return false; | 406 return false; |
422 return contains(relatedTarget->toNode()); | 407 return contains(relatedTarget->toNode()); |
423 } | 408 } |
424 | 409 |
425 void MediaControls::createTextTrackDisplay() | 410 void MediaControls::createTextTrackDisplay() |
426 { | 411 { |
427 if (m_textDisplayContainer) | 412 if (m_textDisplayContainer) |
428 return; | 413 return; |
429 | 414 |
430 RefPtr<MediaControlTextTrackContainerElement> textDisplayContainer = MediaCo
ntrolTextTrackContainerElement::create(document()); | 415 RefPtr<MediaControlTextTrackContainerElement> textDisplayContainer = MediaCo
ntrolTextTrackContainerElement::create(*this); |
431 m_textDisplayContainer = textDisplayContainer.get(); | 416 m_textDisplayContainer = textDisplayContainer.get(); |
432 | 417 |
433 m_textDisplayContainer->setMediaController(m_mediaController); | |
434 | |
435 // Insert it before (behind) all other control elements. | 418 // Insert it before (behind) all other control elements. |
436 if (m_overlayEnclosure && m_overlayPlayButton) | 419 if (m_overlayEnclosure && m_overlayPlayButton) |
437 m_overlayEnclosure->insertBefore(textDisplayContainer.release(), m_overl
ayPlayButton); | 420 m_overlayEnclosure->insertBefore(textDisplayContainer.release(), m_overl
ayPlayButton); |
438 else | 421 else |
439 insertBefore(textDisplayContainer.release(), m_enclosure); | 422 insertBefore(textDisplayContainer.release(), m_enclosure); |
440 } | 423 } |
441 | 424 |
442 void MediaControls::showTextTrackDisplay() | 425 void MediaControls::showTextTrackDisplay() |
443 { | 426 { |
444 if (!m_textDisplayContainer) | 427 if (!m_textDisplayContainer) |
(...skipping 10 matching lines...) Expand all Loading... |
455 | 438 |
456 void MediaControls::updateTextTrackDisplay() | 439 void MediaControls::updateTextTrackDisplay() |
457 { | 440 { |
458 if (!m_textDisplayContainer) | 441 if (!m_textDisplayContainer) |
459 createTextTrackDisplay(); | 442 createTextTrackDisplay(); |
460 | 443 |
461 m_textDisplayContainer->updateDisplay(); | 444 m_textDisplayContainer->updateDisplay(); |
462 } | 445 } |
463 | 446 |
464 } | 447 } |
OLD | NEW |