| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights 
      reserved. | 2  * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights 
      reserved. | 
| 3  * | 3  * | 
| 4  * Redistribution and use in source and binary forms, with or without | 4  * Redistribution and use in source and binary forms, with or without | 
| 5  * modification, are permitted provided that the following conditions | 5  * modification, are permitted provided that the following conditions | 
| 6  * are met: | 6  * are met: | 
| 7  * 1. Redistributions of source code must retain the above copyright | 7  * 1. Redistributions of source code must retain the above copyright | 
| 8  *    notice, this list of conditions and the following disclaimer. | 8  *    notice, this list of conditions and the following disclaimer. | 
| 9  * 2. Redistributions in binary form must reproduce the above copyright | 9  * 2. Redistributions in binary form must reproduce the above copyright | 
| 10  *    notice, this list of conditions and the following disclaimer in the | 10  *    notice, this list of conditions and the following disclaimer in the | 
| (...skipping 2155 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2166 | 2166 | 
| 2167 void HTMLMediaElement::playInternal() | 2167 void HTMLMediaElement::playInternal() | 
| 2168 { | 2168 { | 
| 2169     LOG(Media, "HTMLMediaElement::playInternal"); | 2169     LOG(Media, "HTMLMediaElement::playInternal"); | 
| 2170 | 2170 | 
| 2171     // 4.8.10.9. Playing the media resource | 2171     // 4.8.10.9. Playing the media resource | 
| 2172     if (!m_player || m_networkState == NETWORK_EMPTY) | 2172     if (!m_player || m_networkState == NETWORK_EMPTY) | 
| 2173         scheduleDelayedAction(LoadMediaResource); | 2173         scheduleDelayedAction(LoadMediaResource); | 
| 2174 | 2174 | 
| 2175     if (endedPlayback()) | 2175     if (endedPlayback()) | 
| 2176         seek(0, IGNORE_EXCEPTION_STATE); | 2176         seek(0, IGNORE_EXCEPTION); | 
| 2177 | 2177 | 
| 2178     if (m_mediaController) | 2178     if (m_mediaController) | 
| 2179         m_mediaController->bringElementUpToSpeed(this); | 2179         m_mediaController->bringElementUpToSpeed(this); | 
| 2180 | 2180 | 
| 2181     if (m_paused) { | 2181     if (m_paused) { | 
| 2182         m_paused = false; | 2182         m_paused = false; | 
| 2183         invalidateCachedTime(); | 2183         invalidateCachedTime(); | 
| 2184         scheduleEvent(eventNames().playEvent); | 2184         scheduleEvent(eventNames().playEvent); | 
| 2185 | 2185 | 
| 2186         if (m_readyState <= HAVE_CURRENT_DATA) | 2186         if (m_readyState <= HAVE_CURRENT_DATA) | 
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2495     if (!m_player) | 2495     if (!m_player) | 
| 2496         return 0; | 2496         return 0; | 
| 2497     double duration = m_player->duration(); | 2497     double duration = m_player->duration(); | 
| 2498 | 2498 | 
| 2499     if (!duration || std::isinf(duration)) | 2499     if (!duration || std::isinf(duration)) | 
| 2500         return 0; | 2500         return 0; | 
| 2501 | 2501 | 
| 2502     double buffered = 0; | 2502     double buffered = 0; | 
| 2503     RefPtr<TimeRanges> timeRanges = m_player->buffered(); | 2503     RefPtr<TimeRanges> timeRanges = m_player->buffered(); | 
| 2504     for (unsigned i = 0; i < timeRanges->length(); ++i) { | 2504     for (unsigned i = 0; i < timeRanges->length(); ++i) { | 
| 2505         double start = timeRanges->start(i, IGNORE_EXCEPTION_STATE); | 2505         double start = timeRanges->start(i, IGNORE_EXCEPTION); | 
| 2506         double end = timeRanges->end(i, IGNORE_EXCEPTION_STATE); | 2506         double end = timeRanges->end(i, IGNORE_EXCEPTION); | 
| 2507         buffered += end - start; | 2507         buffered += end - start; | 
| 2508     } | 2508     } | 
| 2509     return buffered / duration; | 2509     return buffered / duration; | 
| 2510 } | 2510 } | 
| 2511 | 2511 | 
| 2512 void HTMLMediaElement::mediaPlayerDidAddTrack(PassRefPtr<InbandTextTrackPrivate>
       prpTrack) | 2512 void HTMLMediaElement::mediaPlayerDidAddTrack(PassRefPtr<InbandTextTrackPrivate>
       prpTrack) | 
| 2513 { | 2513 { | 
| 2514     if (!RuntimeEnabledFeatures::videoTrackEnabled()) | 2514     if (!RuntimeEnabledFeatures::videoTrackEnabled()) | 
| 2515         return; | 2515         return; | 
| 2516 | 2516 | 
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3101     double now = currentTime(); | 3101     double now = currentTime(); | 
| 3102     double dur = duration(); | 3102     double dur = duration(); | 
| 3103 | 3103 | 
| 3104     // When the current playback position reaches the end of the media resource 
      when the direction of | 3104     // When the current playback position reaches the end of the media resource 
      when the direction of | 
| 3105     // playback is forwards, then the user agent must follow these steps: | 3105     // playback is forwards, then the user agent must follow these steps: | 
| 3106     if (!std::isnan(dur) && dur && now >= dur && m_playbackRate > 0) { | 3106     if (!std::isnan(dur) && dur && now >= dur && m_playbackRate > 0) { | 
| 3107         // If the media element has a loop attribute specified and does not have
       a current media controller, | 3107         // If the media element has a loop attribute specified and does not have
       a current media controller, | 
| 3108         if (loop() && !m_mediaController) { | 3108         if (loop() && !m_mediaController) { | 
| 3109             m_sentEndEvent = false; | 3109             m_sentEndEvent = false; | 
| 3110             //  then seek to the earliest possible position of the media resourc
      e and abort these steps. | 3110             //  then seek to the earliest possible position of the media resourc
      e and abort these steps. | 
| 3111             seek(startTime(), IGNORE_EXCEPTION_STATE); | 3111             seek(startTime(), IGNORE_EXCEPTION); | 
| 3112         } else { | 3112         } else { | 
| 3113             // If the media element does not have a current media controller, an
      d the media element | 3113             // If the media element does not have a current media controller, an
      d the media element | 
| 3114             // has still ended playback, and the direction of playback is still 
      forwards, and paused | 3114             // has still ended playback, and the direction of playback is still 
      forwards, and paused | 
| 3115             // is false, | 3115             // is false, | 
| 3116             if (!m_mediaController && !m_paused) { | 3116             if (!m_mediaController && !m_paused) { | 
| 3117                 // changes paused to true and fires a simple event named pause a
      t the media element. | 3117                 // changes paused to true and fires a simple event named pause a
      t the media element. | 
| 3118                 m_paused = true; | 3118                 m_paused = true; | 
| 3119                 scheduleEvent(eventNames().pauseEvent); | 3119                 scheduleEvent(eventNames().pauseEvent); | 
| 3120             } | 3120             } | 
| 3121             // Queue a task to fire a simple event named ended at the media elem
      ent. | 3121             // Queue a task to fire a simple event named ended at the media elem
      ent. | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 3141     scheduleEvent(eventNames().durationchangeEvent); | 3141     scheduleEvent(eventNames().durationchangeEvent); | 
| 3142 | 3142 | 
| 3143     if (hasMediaControls()) | 3143     if (hasMediaControls()) | 
| 3144         mediaControls()->reset(); | 3144         mediaControls()->reset(); | 
| 3145     if (renderer()) | 3145     if (renderer()) | 
| 3146         renderer()->updateFromElement(); | 3146         renderer()->updateFromElement(); | 
| 3147 | 3147 | 
| 3148     double now = currentTime(); | 3148     double now = currentTime(); | 
| 3149     double dur = duration(); | 3149     double dur = duration(); | 
| 3150     if (now > dur) | 3150     if (now > dur) | 
| 3151         seek(dur, IGNORE_EXCEPTION_STATE); | 3151         seek(dur, IGNORE_EXCEPTION); | 
| 3152 } | 3152 } | 
| 3153 | 3153 | 
| 3154 void HTMLMediaElement::mediaPlayerPlaybackStateChanged() | 3154 void HTMLMediaElement::mediaPlayerPlaybackStateChanged() | 
| 3155 { | 3155 { | 
| 3156     LOG(Media, "HTMLMediaElement::mediaPlayerPlaybackStateChanged"); | 3156     LOG(Media, "HTMLMediaElement::mediaPlayerPlaybackStateChanged"); | 
| 3157 | 3157 | 
| 3158     if (!m_player || m_pausedInternal) | 3158     if (!m_player || m_pausedInternal) | 
| 3159         return; | 3159         return; | 
| 3160 | 3160 | 
| 3161     if (m_player->paused()) | 3161     if (m_player->paused()) | 
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3668 | 3668 | 
| 3669     RefPtr<MediaControls> mediaControls = MediaControls::create(document()); | 3669     RefPtr<MediaControls> mediaControls = MediaControls::create(document()); | 
| 3670     if (!mediaControls) | 3670     if (!mediaControls) | 
| 3671         return false; | 3671         return false; | 
| 3672 | 3672 | 
| 3673     mediaControls->setMediaController(m_mediaController ? m_mediaController.get(
      ) : static_cast<MediaControllerInterface*>(this)); | 3673     mediaControls->setMediaController(m_mediaController ? m_mediaController.get(
      ) : static_cast<MediaControllerInterface*>(this)); | 
| 3674     mediaControls->reset(); | 3674     mediaControls->reset(); | 
| 3675     if (isFullscreen()) | 3675     if (isFullscreen()) | 
| 3676         mediaControls->enteredFullscreen(); | 3676         mediaControls->enteredFullscreen(); | 
| 3677 | 3677 | 
| 3678     ensureUserAgentShadowRoot()->appendChild(mediaControls, ASSERT_NO_EXCEPTION_
      STATE); | 3678     ensureUserAgentShadowRoot()->appendChild(mediaControls, ASSERT_NO_EXCEPTION)
      ; | 
| 3679 | 3679 | 
| 3680     if (!controls() || !inDocument()) | 3680     if (!controls() || !inDocument()) | 
| 3681         mediaControls->hide(); | 3681         mediaControls->hide(); | 
| 3682 | 3682 | 
| 3683     return true; | 3683     return true; | 
| 3684 } | 3684 } | 
| 3685 | 3685 | 
| 3686 void HTMLMediaElement::configureMediaControls() | 3686 void HTMLMediaElement::configureMediaControls() | 
| 3687 { | 3687 { | 
| 3688     if (!controls() || !inDocument()) { | 3688     if (!controls() || !inDocument()) { | 
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3936         m_fragmentEndTime = MediaPlayer::invalidTime(); | 3936         m_fragmentEndTime = MediaPlayer::invalidTime(); | 
| 3937 | 3937 | 
| 3938     if (m_fragmentStartTime != MediaPlayer::invalidTime() && m_readyState < HAVE
      _FUTURE_DATA) | 3938     if (m_fragmentStartTime != MediaPlayer::invalidTime() && m_readyState < HAVE
      _FUTURE_DATA) | 
| 3939         prepareToPlay(); | 3939         prepareToPlay(); | 
| 3940 } | 3940 } | 
| 3941 | 3941 | 
| 3942 void HTMLMediaElement::applyMediaFragmentURI() | 3942 void HTMLMediaElement::applyMediaFragmentURI() | 
| 3943 { | 3943 { | 
| 3944     if (m_fragmentStartTime != MediaPlayer::invalidTime()) { | 3944     if (m_fragmentStartTime != MediaPlayer::invalidTime()) { | 
| 3945         m_sentEndEvent = false; | 3945         m_sentEndEvent = false; | 
| 3946         seek(m_fragmentStartTime, IGNORE_EXCEPTION_STATE); | 3946         seek(m_fragmentStartTime, IGNORE_EXCEPTION); | 
| 3947     } | 3947     } | 
| 3948 } | 3948 } | 
| 3949 | 3949 | 
| 3950 MediaPlayerClient::CORSMode HTMLMediaElement::mediaPlayerCORSMode() const | 3950 MediaPlayerClient::CORSMode HTMLMediaElement::mediaPlayerCORSMode() const | 
| 3951 { | 3951 { | 
| 3952     if (!fastHasAttribute(HTMLNames::crossoriginAttr)) | 3952     if (!fastHasAttribute(HTMLNames::crossoriginAttr)) | 
| 3953         return Unspecified; | 3953         return Unspecified; | 
| 3954     if (equalIgnoringCase(fastGetAttribute(HTMLNames::crossoriginAttr), "use-cre
      dentials")) | 3954     if (equalIgnoringCase(fastGetAttribute(HTMLNames::crossoriginAttr), "use-cre
      dentials")) | 
| 3955         return UseCredentials; | 3955         return UseCredentials; | 
| 3956     return Anonymous; | 3956     return Anonymous; | 
| 3957 } | 3957 } | 
| 3958 | 3958 | 
| 3959 void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture() | 3959 void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture() | 
| 3960 { | 3960 { | 
| 3961     m_restrictions = NoRestrictions; | 3961     m_restrictions = NoRestrictions; | 
| 3962 } | 3962 } | 
| 3963 | 3963 | 
| 3964 void HTMLMediaElement::mediaPlayerScheduleLayerUpdate() | 3964 void HTMLMediaElement::mediaPlayerScheduleLayerUpdate() | 
| 3965 { | 3965 { | 
| 3966     scheduleLayerUpdate(); | 3966     scheduleLayerUpdate(); | 
| 3967 } | 3967 } | 
| 3968 | 3968 | 
| 3969 } | 3969 } | 
| OLD | NEW | 
|---|