| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 updateTimeDisplay(); | 309 updateTimeDisplay(); |
| 310 | 310 |
| 311 if (m_mediaElement->isFullscreen()) | 311 if (m_mediaElement->isFullscreen()) |
| 312 startHideFullscreenControlsTimer(); | 312 startHideFullscreenControlsTimer(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 void MediaControlRootElement::playbackProgressed() | 315 void MediaControlRootElement::playbackProgressed() |
| 316 { | 316 { |
| 317 m_timeline->setPosition(m_mediaElement->currentTime()); | 317 m_timeline->setPosition(m_mediaElement->currentTime()); |
| 318 updateTimeDisplay(); | 318 updateTimeDisplay(); |
| 319 | 319 |
| 320 if (!m_isMouseOverControls && m_mediaElement->hasVideo()) | 320 if (!m_isMouseOverControls && m_mediaElement->hasVideo()) |
| 321 makeTransparent(); | 321 makeTransparent(); |
| 322 } | 322 } |
| 323 | 323 |
| 324 void MediaControlRootElement::playbackStopped() | 324 void MediaControlRootElement::playbackStopped() |
| 325 { | 325 { |
| 326 m_playButton->updateDisplayType(); | 326 m_playButton->updateDisplayType(); |
| 327 m_timeline->setPosition(m_mediaElement->currentTime()); | 327 m_timeline->setPosition(m_mediaElement->currentTime()); |
| 328 updateTimeDisplay(); | 328 updateTimeDisplay(); |
| 329 makeOpaque(); | 329 makeOpaque(); |
| 330 | 330 |
| 331 stopHideFullscreenControlsTimer(); | 331 stopHideFullscreenControlsTimer(); |
| 332 } | 332 } |
| 333 | 333 |
| 334 void MediaControlRootElement::updateTimeDisplay() | 334 void MediaControlRootElement::updateTimeDisplay() |
| 335 { | 335 { |
| 336 float now = m_mediaElement->currentTime(); | 336 float now = m_mediaElement->currentTime(); |
| 337 float duration = m_mediaElement->duration(); | 337 float duration = m_mediaElement->duration(); |
| 338 | 338 |
| 339 Page* page = document()->page(); | 339 Page* page = document()->page(); |
| 340 if (!page) | 340 if (!page) |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 m_seekForwardButton->show(); | 433 m_seekForwardButton->show(); |
| 434 m_returnToRealTimeButton->show(); | 434 m_returnToRealTimeButton->show(); |
| 435 | 435 |
| 436 m_panel->setCanBeDragged(false); | 436 m_panel->setCanBeDragged(false); |
| 437 | 437 |
| 438 // We will keep using the panel, but we want it to go back to the standard p
osition. | 438 // We will keep using the panel, but we want it to go back to the standard p
osition. |
| 439 // This will matter right away because we use the panel even when not fullsc
reen. | 439 // This will matter right away because we use the panel even when not fullsc
reen. |
| 440 // And if we reenter fullscreen we also want the panel in the standard posit
ion. | 440 // And if we reenter fullscreen we also want the panel in the standard posit
ion. |
| 441 m_panel->resetPosition(); | 441 m_panel->resetPosition(); |
| 442 | 442 |
| 443 stopHideFullscreenControlsTimer(); | 443 stopHideFullscreenControlsTimer(); |
| 444 } | 444 } |
| 445 | 445 |
| 446 void MediaControlRootElement::showVolumeSlider() | 446 void MediaControlRootElement::showVolumeSlider() |
| 447 { | 447 { |
| 448 if (!m_mediaElement->hasAudio()) | 448 if (!m_mediaElement->hasAudio()) |
| 449 return; | 449 return; |
| 450 | 450 |
| 451 if (m_volumeSliderContainer) | 451 if (m_volumeSliderContainer) |
| 452 m_volumeSliderContainer->show(); | 452 m_volumeSliderContainer->show(); |
| 453 } | 453 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 if (shouldHideControls()) | 493 if (shouldHideControls()) |
| 494 startHideFullscreenControlsTimer(); | 494 startHideFullscreenControlsTimer(); |
| 495 } | 495 } |
| 496 } | 496 } |
| 497 } | 497 } |
| 498 | 498 |
| 499 void MediaControlRootElement::startHideFullscreenControlsTimer() | 499 void MediaControlRootElement::startHideFullscreenControlsTimer() |
| 500 { | 500 { |
| 501 if (!m_mediaElement->isFullscreen()) | 501 if (!m_mediaElement->isFullscreen()) |
| 502 return; | 502 return; |
| 503 | 503 |
| 504 m_hideFullscreenControlsTimer.startOneShot(timeWithoutMouseMovementBeforeHid
ingControls); | 504 m_hideFullscreenControlsTimer.startOneShot(timeWithoutMouseMovementBeforeHid
ingControls); |
| 505 } | 505 } |
| 506 | 506 |
| 507 void MediaControlRootElement::hideFullscreenControlsTimerFired(Timer<MediaContro
lRootElement>*) | 507 void MediaControlRootElement::hideFullscreenControlsTimerFired(Timer<MediaContro
lRootElement>*) |
| 508 { | 508 { |
| 509 if (!m_mediaElement->isPlaying()) | 509 if (!m_mediaElement->isPlaying()) |
| 510 return; | 510 return; |
| 511 | 511 |
| 512 if (!m_mediaElement->isFullscreen()) | 512 if (!m_mediaElement->isFullscreen()) |
| 513 return; | 513 return; |
| 514 | 514 |
| 515 if (!shouldHideControls()) | 515 if (!shouldHideControls()) |
| 516 return; | 516 return; |
| 517 | 517 |
| 518 if (Page* page = m_mediaElement->document()->page()) | 518 if (Page* page = m_mediaElement->document()->page()) |
| 519 page->chrome()->setCursorHiddenUntilMouseMoves(true); | 519 page->chrome()->setCursorHiddenUntilMouseMoves(true); |
| 520 | 520 |
| 521 makeTransparent(); | 521 makeTransparent(); |
| 522 } | 522 } |
| 523 | 523 |
| 524 void MediaControlRootElement::stopHideFullscreenControlsTimer() | 524 void MediaControlRootElement::stopHideFullscreenControlsTimer() |
| 525 { | 525 { |
| 526 m_hideFullscreenControlsTimer.stop(); | 526 m_hideFullscreenControlsTimer.stop(); |
| 527 } | 527 } |
| 528 | 528 |
| 529 const AtomicString& MediaControlRootElement::shadowPseudoId() const | 529 const AtomicString& MediaControlRootElement::shadowPseudoId() const |
| 530 { | 530 { |
| 531 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls")); | 531 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls")); |
| 532 return id; | 532 return id; |
| 533 } | 533 } |
| 534 | 534 |
| 535 void MediaControlRootElement::bufferingProgressed() |
| 536 { |
| 537 // We only need to update buffering progress when paused, during normal |
| 538 // playback playbackProgressed() will take care of it. |
| 539 if (m_mediaElement->paused()) |
| 540 m_timeline->setPosition(m_mediaElement->currentTime()); |
| 541 } |
| 542 |
| 535 } | 543 } |
| 536 | 544 |
| 537 #endif | 545 #endif |
| OLD | NEW |