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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 if (m_isPausedForScrubbing) | 266 if (m_isPausedForScrubbing) |
267 return; | 267 return; |
268 | 268 |
269 if (m_overlayPlayButton) | 269 if (m_overlayPlayButton) |
270 m_overlayPlayButton->updateDisplayType(); | 270 m_overlayPlayButton->updateDisplayType(); |
271 m_playButton->updateDisplayType(); | 271 m_playButton->updateDisplayType(); |
272 } | 272 } |
273 | 273 |
274 void MediaControls::beginScrubbing() | 274 void MediaControls::beginScrubbing() |
275 { | 275 { |
276 if (!mediaControllerInterface().paused()) { | 276 if (!mediaElement().togglePlayStateWillPlay()) { |
277 m_isPausedForScrubbing = true; | 277 m_isPausedForScrubbing = true; |
278 mediaControllerInterface().pause(); | 278 mediaElement().togglePlayState(); |
279 } | 279 } |
280 } | 280 } |
281 | 281 |
282 void MediaControls::endScrubbing() | 282 void MediaControls::endScrubbing() |
283 { | 283 { |
284 if (m_isPausedForScrubbing) { | 284 if (m_isPausedForScrubbing) { |
285 m_isPausedForScrubbing = false; | 285 m_isPausedForScrubbing = false; |
286 if (mediaControllerInterface().paused()) | 286 if (mediaElement().togglePlayStateWillPlay()) |
287 mediaControllerInterface().play(); | 287 mediaElement().togglePlayState(); |
288 } | 288 } |
289 } | 289 } |
290 | 290 |
291 void MediaControls::updateCurrentTimeDisplay() | 291 void MediaControls::updateCurrentTimeDisplay() |
292 { | 292 { |
293 double now = mediaControllerInterface().currentTime(); | 293 double now = mediaControllerInterface().currentTime(); |
294 double duration = mediaControllerInterface().duration(); | 294 double duration = mediaControllerInterface().duration(); |
295 | 295 |
296 // After seek, hide duration display and show current time. | 296 // After seek, hide duration display and show current time. |
297 if (now > 0) { | 297 if (now > 0) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 stopHideFullscreenControlsTimer(); | 353 stopHideFullscreenControlsTimer(); |
354 } | 354 } |
355 | 355 |
356 void MediaControls::defaultEventHandler(Event* event) | 356 void MediaControls::defaultEventHandler(Event* event) |
357 { | 357 { |
358 HTMLDivElement::defaultEventHandler(event); | 358 HTMLDivElement::defaultEventHandler(event); |
359 | 359 |
360 if (event->type() == EventTypeNames::mouseover) { | 360 if (event->type() == EventTypeNames::mouseover) { |
361 if (!containsRelatedTarget(event)) { | 361 if (!containsRelatedTarget(event)) { |
362 m_isMouseOverControls = true; | 362 m_isMouseOverControls = true; |
363 if (!mediaControllerInterface().canPlay()) { | 363 if (!mediaElement().togglePlayStateWillPlay()) { |
364 makeOpaque(); | 364 makeOpaque(); |
365 if (shouldHideFullscreenControls()) | 365 if (shouldHideFullscreenControls()) |
366 startHideFullscreenControlsTimer(); | 366 startHideFullscreenControlsTimer(); |
367 } | 367 } |
368 } | 368 } |
369 return; | 369 return; |
370 } | 370 } |
371 | 371 |
372 if (event->type() == EventTypeNames::mouseout) { | 372 if (event->type() == EventTypeNames::mouseout) { |
373 if (!containsRelatedTarget(event)) { | 373 if (!containsRelatedTarget(event)) { |
(...skipping 10 matching lines...) Expand all Loading... |
384 makeOpaque(); | 384 makeOpaque(); |
385 if (shouldHideFullscreenControls()) | 385 if (shouldHideFullscreenControls()) |
386 startHideFullscreenControlsTimer(); | 386 startHideFullscreenControlsTimer(); |
387 } | 387 } |
388 return; | 388 return; |
389 } | 389 } |
390 } | 390 } |
391 | 391 |
392 void MediaControls::hideFullscreenControlsTimerFired(Timer<MediaControls>*) | 392 void MediaControls::hideFullscreenControlsTimerFired(Timer<MediaControls>*) |
393 { | 393 { |
394 if (mediaControllerInterface().paused()) | 394 if (mediaElement().togglePlayStateWillPlay()) |
395 return; | 395 return; |
396 | 396 |
397 if (!m_isFullscreen) | 397 if (!m_isFullscreen) |
398 return; | 398 return; |
399 | 399 |
400 if (!shouldHideFullscreenControls()) | 400 if (!shouldHideFullscreenControls()) |
401 return; | 401 return; |
402 | 402 |
403 makeTransparent(); | 403 makeTransparent(); |
404 } | 404 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 463 |
464 void MediaControls::updateTextTrackDisplay() | 464 void MediaControls::updateTextTrackDisplay() |
465 { | 465 { |
466 if (!m_textDisplayContainer) | 466 if (!m_textDisplayContainer) |
467 createTextTrackDisplay(); | 467 createTextTrackDisplay(); |
468 | 468 |
469 m_textDisplayContainer->updateDisplay(); | 469 m_textDisplayContainer->updateDisplay(); |
470 } | 470 } |
471 | 471 |
472 } | 472 } |
OLD | NEW |