| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights |
| 3 * reserved. | 3 * 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 2506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2517 pauseInternal(); | 2517 pauseInternal(); |
| 2518 } | 2518 } |
| 2519 } | 2519 } |
| 2520 | 2520 |
| 2521 if (!m_seeking) | 2521 if (!m_seeking) |
| 2522 scheduleTimeupdateEvent(true); | 2522 scheduleTimeupdateEvent(true); |
| 2523 | 2523 |
| 2524 if (!playbackRate()) | 2524 if (!playbackRate()) |
| 2525 return; | 2525 return; |
| 2526 | 2526 |
| 2527 if (!m_paused && mediaControls()) | |
| 2528 mediaControls()->playbackProgressed(); | |
| 2529 | |
| 2530 cueTimeline().updateActiveCues(currentTime()); | 2527 cueTimeline().updateActiveCues(currentTime()); |
| 2531 } | 2528 } |
| 2532 | 2529 |
| 2533 void HTMLMediaElement::scheduleTimeupdateEvent(bool periodicEvent) { | 2530 void HTMLMediaElement::scheduleTimeupdateEvent(bool periodicEvent) { |
| 2534 // Per spec, consult current playback position to check for changing time. | 2531 // Per spec, consult current playback position to check for changing time. |
| 2535 double mediaTime = currentPlaybackPosition(); | 2532 double mediaTime = currentPlaybackPosition(); |
| 2536 double now = WTF::currentTime(); | 2533 double now = WTF::currentTime(); |
| 2537 | 2534 |
| 2538 bool haveNotRecentlyFiredTimeupdate = | 2535 bool haveNotRecentlyFiredTimeupdate = |
| 2539 (now - m_lastTimeUpdateEventWallTime) >= maxTimeupdateEventFrequency; | 2536 (now - m_lastTimeUpdateEventWallTime) >= maxTimeupdateEventFrequency; |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3342 if (!isPlaying) { | 3339 if (!isPlaying) { |
| 3343 // Set rate, muted before calling play in case they were set before the | 3340 // Set rate, muted before calling play in case they were set before the |
| 3344 // media engine was setup. The media engine should just stash the rate | 3341 // media engine was setup. The media engine should just stash the rate |
| 3345 // and muted values since it isn't already playing. | 3342 // and muted values since it isn't already playing. |
| 3346 webMediaPlayer()->setRate(playbackRate()); | 3343 webMediaPlayer()->setRate(playbackRate()); |
| 3347 webMediaPlayer()->setVolume(effectiveMediaVolume()); | 3344 webMediaPlayer()->setVolume(effectiveMediaVolume()); |
| 3348 webMediaPlayer()->play(); | 3345 webMediaPlayer()->play(); |
| 3349 m_autoplayHelper->playbackStarted(); | 3346 m_autoplayHelper->playbackStarted(); |
| 3350 } | 3347 } |
| 3351 | 3348 |
| 3352 if (mediaControls()) | |
| 3353 mediaControls()->playbackStarted(); | |
| 3354 startPlaybackProgressTimer(); | 3349 startPlaybackProgressTimer(); |
| 3355 m_playing = true; | 3350 m_playing = true; |
| 3356 | |
| 3357 } else { // Should not be playing right now | 3351 } else { // Should not be playing right now |
| 3358 if (isPlaying) { | 3352 if (isPlaying) { |
| 3359 webMediaPlayer()->pause(); | 3353 webMediaPlayer()->pause(); |
| 3360 m_autoplayHelper->playbackStopped(); | 3354 m_autoplayHelper->playbackStopped(); |
| 3361 } | 3355 } |
| 3362 | 3356 |
| 3363 m_playbackProgressTimer.stop(); | 3357 m_playbackProgressTimer.stop(); |
| 3364 m_playing = false; | 3358 m_playing = false; |
| 3365 double time = currentTime(); | 3359 double time = currentTime(); |
| 3366 if (time > m_lastSeekTime) | 3360 if (time > m_lastSeekTime) |
| 3367 addPlayedRange(m_lastSeekTime, time); | 3361 addPlayedRange(m_lastSeekTime, time); |
| 3368 | |
| 3369 if (mediaControls()) | |
| 3370 mediaControls()->playbackStopped(); | |
| 3371 } | 3362 } |
| 3372 | 3363 |
| 3373 if (layoutObject()) | 3364 if (layoutObject()) |
| 3374 layoutObject()->updateFromElement(); | 3365 layoutObject()->updateFromElement(); |
| 3375 } | 3366 } |
| 3376 | 3367 |
| 3377 void HTMLMediaElement::stopPeriodicTimers() { | 3368 void HTMLMediaElement::stopPeriodicTimers() { |
| 3378 m_progressEventTimer.stop(); | 3369 m_progressEventTimer.stop(); |
| 3379 m_playbackProgressTimer.stop(); | 3370 m_playbackProgressTimer.stop(); |
| 3380 } | 3371 } |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4202 | 4193 |
| 4203 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() | 4194 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() |
| 4204 const { | 4195 const { |
| 4205 IntRect result; | 4196 IntRect result; |
| 4206 if (LayoutObject* object = m_element->layoutObject()) | 4197 if (LayoutObject* object = m_element->layoutObject()) |
| 4207 result = object->absoluteBoundingBoxRect(); | 4198 result = object->absoluteBoundingBoxRect(); |
| 4208 return result; | 4199 return result; |
| 4209 } | 4200 } |
| 4210 | 4201 |
| 4211 } // namespace blink | 4202 } // namespace blink |
| OLD | NEW |