| Index: Source/WebCore/html/HTMLMediaElement.cpp
|
| diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp
|
| index 41b7f63761490ec2c49cf5d3b0f2e60d3610039a..b5ab9f03761c3d98ebf15f49289b207826d9b2c8 100644
|
| --- a/Source/WebCore/html/HTMLMediaElement.cpp
|
| +++ b/Source/WebCore/html/HTMLMediaElement.cpp
|
| @@ -20,7 +20,7 @@
|
| * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
| * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| #include "config.h"
|
| @@ -120,7 +120,7 @@ static const char* boolString(bool val)
|
| #endif
|
|
|
| #ifndef LOG_MEDIA_EVENTS
|
| -// Default to not logging events because so many are generated they can overwhelm the rest of
|
| +// Default to not logging events because so many are generated they can overwhelm the rest of
|
| // the logging.
|
| #define LOG_MEDIA_EVENTS 0
|
| #endif
|
| @@ -195,7 +195,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum
|
| , m_preload(MediaPlayer::Auto)
|
| , m_displayMode(Unknown)
|
| , m_processingMediaPlayerCallback(0)
|
| -#if ENABLE(MEDIA_SOURCE)
|
| +#if ENABLE(MEDIA_SOURCE)
|
| , m_sourceState(SOURCE_CLOSED)
|
| #endif
|
| , m_cachedTime(invalidMediaTime)
|
| @@ -235,7 +235,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum
|
| document->registerForDocumentActivationCallbacks(this);
|
| document->registerForMediaVolumeCallbacks(this);
|
| document->registerForPrivateBrowsingStateChangedCallbacks(this);
|
| -
|
| +
|
| if (document->settings() && document->settings()->mediaPlaybackRequiresUserGesture())
|
| addBehaviorRestriction(RequireUserGestureForRateChangeRestriction);
|
|
|
| @@ -424,7 +424,7 @@ RenderObject* HTMLMediaElement::createRenderer(RenderArena* arena, RenderStyle*)
|
| return new (arena) RenderMedia(this);
|
| #endif
|
| }
|
| -
|
| +
|
| void HTMLMediaElement::insertedIntoDocument()
|
| {
|
| LOG(Media, "HTMLMediaElement::insertedIntoDocument");
|
| @@ -477,7 +477,7 @@ void HTMLMediaElement::scheduleLoad(LoadType loadType)
|
| #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
|
| createMediaPlayerProxy();
|
| #endif
|
| -
|
| +
|
| prepareForLoad();
|
| m_pendingLoadFlags |= MediaResource;
|
| }
|
| @@ -545,7 +545,7 @@ void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*)
|
| m_pendingLoadFlags = 0;
|
| }
|
|
|
| -PassRefPtr<MediaError> HTMLMediaElement::error() const
|
| +PassRefPtr<MediaError> HTMLMediaElement::error() const
|
| {
|
| return m_error;
|
| }
|
| @@ -578,7 +578,7 @@ String HTMLMediaElement::canPlayType(const String& mimeType) const
|
| canPlay = "probably";
|
| break;
|
| }
|
| -
|
| +
|
| LOG(Media, "HTMLMediaElement::canPlayType(%s) -> %s", mimeType.utf8().data(), canPlay.utf8().data());
|
|
|
| return canPlay;
|
| @@ -616,7 +616,7 @@ void HTMLMediaElement::prepareForLoad()
|
| m_loadState = WaitingForSource;
|
| m_currentSourceNode = 0;
|
|
|
| - // 2 - If there are any tasks from the media element's media element event task source in
|
| + // 2 - If there are any tasks from the media element's media element event task source in
|
| // one of the task queues, then remove those tasks.
|
| cancelPendingEventsAndCallbacks();
|
|
|
| @@ -674,7 +674,7 @@ void HTMLMediaElement::prepareForLoad()
|
| m_closedCaptionsVisible = false;
|
|
|
| // The spec doesn't say to block the load event until we actually run the asynchronous section
|
| - // algorithm, but do it now because we won't start that until after the timer fires and the
|
| + // algorithm, but do it now because we won't start that until after the timer fires and the
|
| // event may have already fired by then.
|
| setShouldDelayLoadEvent(true);
|
|
|
| @@ -692,9 +692,9 @@ void HTMLMediaElement::loadInternal()
|
| m_isWaitingUntilMediaCanStart = true;
|
| return;
|
| }
|
| -
|
| - // Once the page has allowed an element to load media, it is free to load at will. This allows a
|
| - // playlist that starts in a foreground tab to continue automatically if the tab is subsequently
|
| +
|
| + // Once the page has allowed an element to load media, it is free to load at will. This allows a
|
| + // playlist that starts in a foreground tab to continue automatically if the tab is subsequently
|
| // put in the the background.
|
| removeBehaviorRestriction(RequirePageConsentToLoadMediaRestriction);
|
|
|
| @@ -716,16 +716,16 @@ void HTMLMediaElement::selectMediaResource()
|
| break;
|
| }
|
|
|
| - // Otherwise, if the media element does not have a src attribute but has a source
|
| - // element child, then let mode be children and let candidate be the first such
|
| + // Otherwise, if the media element does not have a src attribute but has a source
|
| + // element child, then let mode be children and let candidate be the first such
|
| // source element child in tree order.
|
| if (node) {
|
| mode = children;
|
| m_nextChildNodeToConsider = 0;
|
| m_currentSourceNode = 0;
|
| } else {
|
| - // Otherwise the media element has neither a src attribute nor a source element
|
| - // child: set the networkState to NETWORK_EMPTY, and abort these steps; the
|
| + // Otherwise the media element has neither a src attribute nor a source element
|
| + // child: set the networkState to NETWORK_EMPTY, and abort these steps; the
|
| // synchronous section ends.
|
| m_loadState = WaitingForSource;
|
| setShouldDelayLoadEvent(false);
|
| @@ -736,7 +736,7 @@ void HTMLMediaElement::selectMediaResource()
|
| }
|
| }
|
|
|
| - // 4 - Set the media element's delaying-the-load-event flag to true (this delays the load event),
|
| + // 4 - Set the media element's delaying-the-load-event flag to true (this delays the load event),
|
| // and set its networkState to NETWORK_LOADING.
|
| setShouldDelayLoadEvent(true);
|
| m_networkState = NETWORK_LOADING;
|
| @@ -830,7 +830,7 @@ void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& content
|
| mediaLoadingFailed(MediaPlayer::FormatError);
|
| return;
|
| }
|
| -
|
| +
|
| #if ENABLE(MEDIA_SOURCE)
|
| // If this is a media source URL, make sure it is the one for this media element.
|
| if (url.protocolIs(mediaSourceURLProtocol) && url != m_mediaSourceURL) {
|
| @@ -839,7 +839,7 @@ void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& content
|
| }
|
| #endif
|
|
|
| - // The resource fetch algorithm
|
| + // The resource fetch algorithm
|
| m_networkState = NETWORK_LOADING;
|
|
|
| #if !PLATFORM(CHROMIUM)
|
| @@ -870,7 +870,7 @@ void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& content
|
|
|
| LOG(Media, "HTMLMediaElement::loadResource - m_currentSrc -> %s", urlForLogging(m_currentSrc).utf8().data());
|
|
|
| - if (m_sendProgressEvents)
|
| + if (m_sendProgressEvents)
|
| startProgressEventTimer();
|
|
|
| Settings* settings = document()->settings();
|
| @@ -905,7 +905,7 @@ void HTMLMediaElement::updateActiveTextTrackCues(float movieTime)
|
| Vector<CueIntervalTree::IntervalType> previouslyVisibleCues = m_currentlyVisibleCues;
|
|
|
| m_currentlyVisibleCues = m_cueTree.allOverlaps(m_cueTree.createInterval(movieTime, movieTime));
|
| -
|
| +
|
| // FIXME(72171): Events need to be sorted and filtered before dispatching.
|
|
|
| for (size_t i = 0; i < previouslyVisibleCues.size(); ++i) {
|
| @@ -916,7 +916,7 @@ void HTMLMediaElement::updateActiveTextTrackCues(float movieTime)
|
| if (!previouslyVisibleCues.contains(m_currentlyVisibleCues[i]))
|
| m_currentlyVisibleCues[i].data()->setIsActive(true);
|
| }
|
| -
|
| +
|
| // FIXME(72173): Pause the media element for cues going past their endTime
|
| // during a monotonic time increase.
|
| }
|
| @@ -936,13 +936,13 @@ void HTMLMediaElement::textTrackKindChanged(TextTrack*)
|
| // FIXME(62885): Implement.
|
| }
|
|
|
| -void HTMLMediaElement::textTrackAddCues(TextTrack*, const TextTrackCueList* cues)
|
| +void HTMLMediaElement::textTrackAddCues(TextTrack*, const TextTrackCueList* cues)
|
| {
|
| for (size_t i = 0; i < cues->length(); ++i)
|
| textTrackAddCue(cues->item(i)->track(), cues->item(i));
|
| }
|
|
|
| -void HTMLMediaElement::textTrackRemoveCues(TextTrack*, const TextTrackCueList* cues)
|
| +void HTMLMediaElement::textTrackRemoveCues(TextTrack*, const TextTrackCueList* cues)
|
| {
|
| for (size_t i = 0; i < cues->length(); ++i)
|
| textTrackRemoveCue(cues->item(i)->track(), cues->item(i));
|
| @@ -1021,8 +1021,8 @@ void HTMLMediaElement::noneSupported()
|
| m_loadState = WaitingForSource;
|
| m_currentSourceNode = 0;
|
|
|
| - // 4.8.10.5
|
| - // 6 - Reaching this step indicates that the media resource failed to load or that the given
|
| + // 4.8.10.5
|
| + // 6 - Reaching this step indicates that the media resource failed to load or that the given
|
| // URL could not be resolved. In one atomic operation, run the following steps:
|
|
|
| // 6.1 - Set the error attribute to a new MediaError object whose code attribute is set to
|
| @@ -1040,7 +1040,7 @@ void HTMLMediaElement::noneSupported()
|
| // 8 - Set the element's delaying-the-load-event flag to false. This stops delaying the load event.
|
| setShouldDelayLoadEvent(false);
|
|
|
| - // 9 - Abort these steps. Until the load() method is invoked or the src attribute is changed,
|
| + // 9 - Abort these steps. Until the load() method is invoked or the src attribute is changed,
|
| // the element won't attempt to load another resource.
|
|
|
| updateDisplayState();
|
| @@ -1057,7 +1057,7 @@ void HTMLMediaElement::mediaEngineError(PassRefPtr<MediaError> err)
|
| stopPeriodicTimers();
|
| m_loadState = WaitingForSource;
|
|
|
| - // 2 - Set the error attribute to a new MediaError object whose code attribute is
|
| + // 2 - Set the error attribute to a new MediaError object whose code attribute is
|
| // set to MEDIA_ERR_NETWORK/MEDIA_ERR_DECODE.
|
| m_error = err;
|
|
|
| @@ -1096,10 +1096,10 @@ void HTMLMediaElement::cancelPendingEventsAndCallbacks()
|
| Document* HTMLMediaElement::mediaPlayerOwningDocument()
|
| {
|
| Document* d = document();
|
| -
|
| +
|
| if (!d)
|
| d = ownerDocument();
|
| -
|
| +
|
| return d;
|
| }
|
|
|
| @@ -1113,16 +1113,16 @@ void HTMLMediaElement::mediaPlayerNetworkStateChanged(MediaPlayer*)
|
| void HTMLMediaElement::mediaLoadingFailed(MediaPlayer::NetworkState error)
|
| {
|
| stopPeriodicTimers();
|
| -
|
| +
|
| // If we failed while trying to load a <source> element, the movie was never parsed, and there are more
|
| // <source> children, schedule the next one
|
| if (m_readyState < HAVE_METADATA && m_loadState == LoadingFromSourceElement) {
|
| -
|
| +
|
| if (m_currentSourceNode)
|
| m_currentSourceNode->scheduleErrorEvent();
|
| else
|
| LOG(Media, "HTMLMediaElement::setNetworkState - error event not sent, <source> was removed");
|
| -
|
| +
|
| if (havePotentialSourceChild()) {
|
| LOG(Media, "HTMLMediaElement::setNetworkState - scheduling next <source>");
|
| scheduleNextSourceChild();
|
| @@ -1130,17 +1130,17 @@ void HTMLMediaElement::mediaLoadingFailed(MediaPlayer::NetworkState error)
|
| LOG(Media, "HTMLMediaElement::setNetworkState - no more <source> elements, waiting");
|
| waitForSourceChange();
|
| }
|
| -
|
| +
|
| return;
|
| }
|
| -
|
| +
|
| if (error == MediaPlayer::NetworkError && m_readyState >= HAVE_METADATA)
|
| mediaEngineError(MediaError::create(MediaError::MEDIA_ERR_NETWORK));
|
| else if (error == MediaPlayer::DecodeError)
|
| mediaEngineError(MediaError::create(MediaError::MEDIA_ERR_DECODE));
|
| else if ((error == MediaPlayer::FormatError || error == MediaPlayer::NetworkError) && m_loadState == LoadingFromSrcAttr)
|
| noneSupported();
|
| -
|
| +
|
| updateDisplayState();
|
| if (hasMediaControls()) {
|
| mediaControls()->reset();
|
| @@ -1166,6 +1166,9 @@ void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state)
|
| if (state == MediaPlayer::Idle) {
|
| if (m_networkState > NETWORK_IDLE) {
|
| m_progressEventTimer.stop();
|
| + if (hasMediaControls() && m_player->bytesLoaded() != m_previousProgress)
|
| + mediaControls()->bufferingProgressed();
|
| +
|
| scheduleEvent(eventNames().suspendEvent);
|
| setShouldDelayLoadEvent(false);
|
| }
|
| @@ -1181,6 +1184,8 @@ void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state)
|
| if (state == MediaPlayer::Loaded) {
|
| if (m_networkState != NETWORK_IDLE) {
|
| m_progressEventTimer.stop();
|
| + if (hasMediaControls() && m_player->bytesLoaded() != m_previousProgress)
|
| + mediaControls()->bufferingProgressed();
|
|
|
| // Schedule one last progress event so we guarantee that at least one is fired
|
| // for files that load very quickly.
|
| @@ -1215,7 +1220,7 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state)
|
|
|
| if (m_readyState == oldState)
|
| return;
|
| -
|
| +
|
| if (oldState > m_readyStateMaximum)
|
| m_readyStateMaximum = oldState;
|
|
|
| @@ -1332,6 +1337,8 @@ void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*)
|
| m_sentStalledEvent = false;
|
| if (renderer())
|
| renderer()->updateFromElement();
|
| + if (hasMediaControls())
|
| + mediaControls()->bufferingProgressed();
|
| }
|
| }
|
|
|
| @@ -1348,7 +1355,7 @@ void HTMLMediaElement::returnToRealtime()
|
| LOG(Media, "HTMLMediaElement::returnToRealtime");
|
| ExceptionCode e;
|
| setCurrentTime(maxTimeSeekable(), e);
|
| -}
|
| +}
|
|
|
| void HTMLMediaElement::addPlayedRange(float start, float end)
|
| {
|
| @@ -1356,7 +1363,7 @@ void HTMLMediaElement::addPlayedRange(float start, float end)
|
| if (!m_playedTimeRanges)
|
| m_playedTimeRanges = TimeRanges::create();
|
| m_playedTimeRanges->add(start, end);
|
| -}
|
| +}
|
|
|
| bool HTMLMediaElement::supportsSave() const
|
| {
|
| @@ -1406,7 +1413,7 @@ void HTMLMediaElement::seek(float time, ExceptionCode& ec)
|
| // The flag will be cleared when the engine tells us the time has actually changed.
|
| m_seeking = true;
|
|
|
| - // 5 - If the new playback position is later than the end of the media resource, then let it be the end
|
| + // 5 - If the new playback position is later than the end of the media resource, then let it be the end
|
| // of the media resource instead.
|
| time = min(time, duration());
|
|
|
| @@ -1417,7 +1424,7 @@ void HTMLMediaElement::seek(float time, ExceptionCode& ec)
|
| // Ask the media engine for the time value in the movie's time scale before comparing with current time. This
|
| // is necessary because if the seek time is not equal to currentTime but the delta is less than the movie's
|
| // time scale, we will ask the media engine to "seek" to the current movie time, which may be a noop and
|
| - // not generate a timechanged callback. This means m_seeking will never be cleared and we will never
|
| + // not generate a timechanged callback. This means m_seeking will never be cleared and we will never
|
| // fire a 'seeked' event.
|
| #if !LOG_DISABLED
|
| float mediaTime = m_player->mediaTimeForTimeValue(time);
|
| @@ -1426,14 +1433,14 @@ void HTMLMediaElement::seek(float time, ExceptionCode& ec)
|
| #endif
|
| time = m_player->mediaTimeForTimeValue(time);
|
|
|
| - // 7 - If the (possibly now changed) new playback position is not in one of the ranges given in the
|
| - // seekable attribute, then let it be the position in one of the ranges given in the seekable attribute
|
| + // 7 - If the (possibly now changed) new playback position is not in one of the ranges given in the
|
| + // seekable attribute, then let it be the position in one of the ranges given in the seekable attribute
|
| // that is the nearest to the new playback position. ... If there are no ranges given in the seekable
|
| // attribute then set the seeking IDL attribute to false and abort these steps.
|
| RefPtr<TimeRanges> seekableRanges = seekable();
|
|
|
| // Short circuit seeking to the current time by just firing the events if no seek is required.
|
| - // Don't skip calling the media engine if we are in poster mode because a seek should always
|
| + // Don't skip calling the media engine if we are in poster mode because a seek should always
|
| // cancel poster display.
|
| bool noSeekRequired = !seekableRanges->length() || (time == now && displayMode() != Poster);
|
|
|
| @@ -1645,7 +1652,7 @@ float HTMLMediaElement::playbackRate() const
|
| void HTMLMediaElement::setPlaybackRate(float rate)
|
| {
|
| LOG(Media, "HTMLMediaElement::setPlaybackRate(%f)", rate);
|
| -
|
| +
|
| if (m_playbackRate != rate) {
|
| m_playbackRate = rate;
|
| invalidateCachedTime();
|
| @@ -1673,7 +1680,7 @@ void HTMLMediaElement::setWebkitPreservesPitch(bool preservesPitch)
|
| LOG(Media, "HTMLMediaElement::setWebkitPreservesPitch(%s)", boolString(preservesPitch));
|
|
|
| m_webkitPreservesPitch = preservesPitch;
|
| -
|
| +
|
| if (!m_player)
|
| return;
|
|
|
| @@ -1683,7 +1690,7 @@ void HTMLMediaElement::setWebkitPreservesPitch(bool preservesPitch)
|
| bool HTMLMediaElement::ended() const
|
| {
|
| // 4.8.10.8 Playing the media resource
|
| - // The ended attribute must return true if the media element has ended
|
| + // The ended attribute must return true if the media element has ended
|
| // playback and the direction of playback is forwards, and false otherwise.
|
| return endedPlayback() && m_playbackRate > 0;
|
| }
|
| @@ -1795,7 +1802,7 @@ void HTMLMediaElement::pauseInternal()
|
| scheduleLoad(MediaResource);
|
|
|
| m_autoplaying = false;
|
| -
|
| +
|
| if (!m_paused) {
|
| m_paused = true;
|
| scheduleTimeupdateEvent(false);
|
| @@ -1926,7 +1933,7 @@ void HTMLMediaElement::setVolume(float vol, ExceptionCode& ec)
|
| ec = INDEX_SIZE_ERR;
|
| return;
|
| }
|
| -
|
| +
|
| if (m_volume != vol) {
|
| m_volume = vol;
|
| updateVolume();
|
| @@ -1966,7 +1973,7 @@ void HTMLMediaElement::togglePlayState()
|
| if (canPlay()) {
|
| updatePlaybackRate();
|
| playInternal();
|
| - } else
|
| + } else
|
| pauseInternal();
|
| }
|
|
|
| @@ -1976,13 +1983,13 @@ void HTMLMediaElement::beginScrubbing()
|
|
|
| if (!paused()) {
|
| if (ended()) {
|
| - // Because a media element stays in non-paused state when it reaches end, playback resumes
|
| - // when the slider is dragged from the end to another position unless we pause first. Do
|
| + // Because a media element stays in non-paused state when it reaches end, playback resumes
|
| + // when the slider is dragged from the end to another position unless we pause first. Do
|
| // a "hard pause" so an event is generated, since we want to stay paused after scrubbing finishes.
|
| pause();
|
| } else {
|
| // Not at the end but we still want to pause playback so the media engine doesn't try to
|
| - // continue playing during scrubbing. Pause without generating an event as we will
|
| + // continue playing during scrubbing. Pause without generating an event as we will
|
| // unpause after scrubbing finishes.
|
| setPausedInternal(true);
|
| }
|
| @@ -2023,7 +2030,7 @@ void HTMLMediaElement::playbackProgressTimerFired(Timer<HTMLMediaElement>*)
|
| if (hasMediaControls())
|
| mediaControls()->playbackProgressed();
|
| // FIXME: deal with cue ranges here
|
| -
|
| +
|
| #if ENABLE(VIDEO_TRACK)
|
| updateActiveTextTrackCues(currentTime());
|
| #endif
|
| @@ -2081,7 +2088,7 @@ PassRefPtr<TextTrack> HTMLMediaElement::addTrack(const String& kind, const Strin
|
|
|
| // 4.8.10.12.4 Text track API
|
| // The addTextTrack(kind, label, language) method of media elements, when invoked, must run the following steps:
|
| -
|
| +
|
| // 1. If kind is not one of the following strings, then throw a SyntaxError exception and abort these steps
|
| if (!TextTrack::isValidKindKeyword(kind)) {
|
| ec = SYNTAX_ERR;
|
| @@ -2093,10 +2100,10 @@ PassRefPtr<TextTrack> HTMLMediaElement::addTrack(const String& kind, const Strin
|
| // 4. Create a new TextTrack object.
|
| RefPtr<TextTrack> textTrack = TextTrack::create(ActiveDOMObject::scriptExecutionContext(), this, kind, label, language);
|
|
|
| - // 5. Create a new text track corresponding to the new object, and set its text track kind to kind, its text
|
| + // 5. Create a new text track corresponding to the new object, and set its text track kind to kind, its text
|
| // track label to label, its text track language to language, its text track readiness state to the text track
|
| // loaded state, its text track mode to the text track hidden mode, and its text track list of cues to an empty list.
|
| -
|
| +
|
| // 6. Add the new text track to the media element's list of text tracks.
|
| addTextTrack(textTrack);
|
|
|
| @@ -2115,34 +2122,34 @@ void HTMLMediaElement::configureTextTracks()
|
| return;
|
|
|
| // 4.8.10.12.3 Sourcing out-of-band text tracks
|
| -
|
| +
|
| // When a text track corresponding to a track element is added to a media element's list of text tracks,
|
| // the user agent must set the text track mode appropriately, as determined by the following conditions:
|
| -
|
| +
|
| // * If the text track kind is subtitles or captions and the user has indicated an interest in having a
|
| // track with this text track kind, text track language, and text track label enabled, and there is no
|
| // other text track in the media element's list of text tracks with a text track kind of either subtitles
|
| // or captions whose text track mode is showing
|
| - // * If the text track kind is descriptions and the user has indicated an interest in having text
|
| - // descriptions with this text track language and text track label enabled, and there is no other text
|
| - // track in the media element's list of text tracks with a text track kind of descriptions whose text
|
| + // * If the text track kind is descriptions and the user has indicated an interest in having text
|
| + // descriptions with this text track language and text track label enabled, and there is no other text
|
| + // track in the media element's list of text tracks with a text track kind of descriptions whose text
|
| // track mode is showing
|
| // Let the text track mode be showing.
|
| - // If there is a text track in the media element's list of text tracks whose text track mode is showing
|
| + // If there is a text track in the media element's list of text tracks whose text track mode is showing
|
| // by default, the user agent must furthermore change that text track's text track mode to hidden.
|
| -
|
| +
|
| // * If the text track kind is chapters and the text track language is one that the user agent has reason
|
| // to believe is appropriate for the user, and there is no other text track in the media element's list of
|
| // text tracks with a text track kind of chapters whose text track mode is showing
|
| // Let the text track mode be showing.
|
| -
|
| +
|
| // * If the track element has a default attribute specified, and there is no other text track in the media
|
| // element's list of text tracks whose text track mode is showing or showing by default
|
| // Let the text track mode be showing by default.
|
| -
|
| +
|
| // Otherwise
|
| // Let the text track mode be disabled.
|
| -
|
| +
|
| // FIXME(71123): Until the above logic has been implemented, just tell all text tracks to load.
|
| for (Node* node = firstChild(); node; node = node->nextSibling()) {
|
| if (node->hasTagName(trackTag))
|
| @@ -2150,7 +2157,7 @@ void HTMLMediaElement::configureTextTracks()
|
| }
|
| }
|
|
|
| -TextTrackList* HTMLMediaElement::textTracks()
|
| +TextTrackList* HTMLMediaElement::textTracks()
|
| {
|
| if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
|
| return 0;
|
| @@ -2174,16 +2181,16 @@ void HTMLMediaElement::trackWasAdded(HTMLTrackElement* trackElement)
|
| #endif
|
|
|
| // 4.8.10.12.3 Sourcing out-of-band text tracks
|
| - // When a track element's parent element changes and the new parent is a media element,
|
| - // then the user agent must add the track element's corresponding text track to the
|
| + // When a track element's parent element changes and the new parent is a media element,
|
| + // then the user agent must add the track element's corresponding text track to the
|
| // media element's list of text tracks ... [continues in TextTrackList::append]
|
| RefPtr<TextTrack> textTrack = trackElement->track();
|
| if (!textTrack)
|
| return;
|
| - addTextTrack(textTrack);
|
| + addTextTrack(textTrack);
|
| scheduleLoad(TextTrackResource);
|
| }
|
| -
|
| +
|
| void HTMLMediaElement::trackWillBeRemoved(HTMLTrackElement* trackElement)
|
| {
|
| #if !LOG_DISABLED
|
| @@ -2198,8 +2205,8 @@ void HTMLMediaElement::trackWillBeRemoved(HTMLTrackElement* trackElement)
|
| return;
|
|
|
| // 4.8.10.12.3 Sourcing out-of-band text tracks
|
| - // When a track element's parent element changes and the old parent was a media element,
|
| - // then the user agent must remove the track element's corresponding text track from the
|
| + // When a track element's parent element changes and the old parent was a media element,
|
| + // then the user agent must remove the track element's corresponding text track from the
|
| // media element's list of text tracks.
|
| m_textTracks->remove(textTrack);
|
| }
|
| @@ -2247,7 +2254,7 @@ KURL HTMLMediaElement::selectNextSourceChild(ContentType *contentType, InvalidUR
|
| if (lookingForStartNode && m_nextChildNodeToConsider != node)
|
| continue;
|
| lookingForStartNode = false;
|
| -
|
| +
|
| if (!node->hasTagName(sourceTag))
|
| continue;
|
|
|
| @@ -2261,7 +2268,7 @@ KURL HTMLMediaElement::selectNextSourceChild(ContentType *contentType, InvalidUR
|
| #endif
|
| if (mediaURL.isEmpty())
|
| goto check_again;
|
| -
|
| +
|
| if (source->fastHasAttribute(mediaAttr)) {
|
| MediaQueryEvaluator screenEval("screen", document()->frame(), renderer() ? renderer()->style() : 0);
|
| RefPtr<MediaList> media = MediaList::createAllowingDescriptionSyntax(source->media());
|
| @@ -2269,7 +2276,7 @@ KURL HTMLMediaElement::selectNextSourceChild(ContentType *contentType, InvalidUR
|
| if (shouldLog)
|
| LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'media' is %s", source->media().utf8().data());
|
| #endif
|
| - if (!screenEval.eval(media.get()))
|
| + if (!screenEval.eval(media.get()))
|
| goto check_again;
|
| }
|
|
|
| @@ -2323,13 +2330,13 @@ void HTMLMediaElement::sourceWasAdded(HTMLSourceElement* source)
|
| LOG(Media, "HTMLMediaElement::sourceWasAdded - 'src' is %s", urlForLogging(url).utf8().data());
|
| }
|
| #endif
|
| -
|
| +
|
| // We should only consider a <source> element when there is not src attribute at all.
|
| if (fastHasAttribute(srcAttr))
|
| return;
|
|
|
| - // 4.8.8 - If a source element is inserted as a child of a media element that has no src
|
| - // attribute and whose networkState has the value NETWORK_EMPTY, the user agent must invoke
|
| + // 4.8.8 - If a source element is inserted as a child of a media element that has no src
|
| + // attribute and whose networkState has the value NETWORK_EMPTY, the user agent must invoke
|
| // the media element's resource selection algorithm.
|
| if (networkState() == HTMLMediaElement::NETWORK_EMPTY) {
|
| scheduleLoad(MediaResource);
|
| @@ -2344,17 +2351,17 @@ void HTMLMediaElement::sourceWasAdded(HTMLSourceElement* source)
|
|
|
| if (m_nextChildNodeToConsider != sourceChildEndOfListValue())
|
| return;
|
| -
|
| +
|
| // 4.8.9.5, resource selection algorithm, source elements section:
|
| // 20 - Wait until the node after pointer is a node other than the end of the list. (This step might wait forever.)
|
| // 21 - Asynchronously await a stable state...
|
| - // 22 - Set the element's delaying-the-load-event flag back to true (this delays the load event again, in case
|
| + // 22 - Set the element's delaying-the-load-event flag back to true (this delays the load event again, in case
|
| // it hasn't been fired yet).
|
| setShouldDelayLoadEvent(true);
|
|
|
| // 23 - Set the networkState back to NETWORK_LOADING.
|
| m_networkState = NETWORK_LOADING;
|
| -
|
| +
|
| // 24 - Jump back to the find next candidate step above.
|
| m_nextChildNodeToConsider = source;
|
| scheduleNextSourceChild();
|
| @@ -2381,7 +2388,7 @@ void HTMLMediaElement::sourceWillBeRemoved(HTMLSourceElement* source)
|
| LOG(Media, "HTMLMediaElement::sourceRemoved - m_nextChildNodeToConsider set to %p", m_nextChildNodeToConsider);
|
| } else if (source == m_currentSourceNode) {
|
| // Clear the current source node pointer, but don't change the movie as the spec says:
|
| - // 4.8.8 - Dynamically modifying a source element and its attribute when the element is already
|
| + // 4.8.8 - Dynamically modifying a source element and its attribute when the element is already
|
| // inserted in a video or audio element will have no effect.
|
| m_currentSourceNode = 0;
|
| LOG(Media, "HTMLMediaElement::sourceRemoved - m_currentSourceNode set to 0");
|
| @@ -2399,15 +2406,15 @@ void HTMLMediaElement::mediaPlayerTimeChanged(MediaPlayer*)
|
| // 4.8.10.9 step 14 & 15. Needed if no ReadyState change is associated with the seek.
|
| if (m_seeking && m_readyState >= HAVE_CURRENT_DATA)
|
| finishSeek();
|
| -
|
| - // Always call scheduleTimeupdateEvent when the media engine reports a time discontinuity,
|
| +
|
| + // Always call scheduleTimeupdateEvent when the media engine reports a time discontinuity,
|
| // it will only queue a 'timeupdate' event if we haven't already posted one at the current
|
| // movie time.
|
| scheduleTimeupdateEvent(false);
|
|
|
| float now = currentTime();
|
| float dur = duration();
|
| -
|
| +
|
| // When the current playback position reaches the end of the media resource when the direction of
|
| // playback is forwards, then the user agent must follow these steps:
|
| if (!isnan(dur) && dur && now >= dur && m_playbackRate > 0) {
|
| @@ -2588,7 +2595,7 @@ void HTMLMediaElement::mediaPlayerFirstVideoFrameAvailable(MediaPlayer*)
|
| void HTMLMediaElement::mediaPlayerCharacteristicChanged(MediaPlayer*)
|
| {
|
| LOG(Media, "HTMLMediaElement::mediaPlayerCharacteristicChanged");
|
| -
|
| +
|
| beginProcessingMediaPlayerCallback();
|
| if (hasMediaControls())
|
| mediaControls()->reset();
|
| @@ -2645,8 +2652,8 @@ bool HTMLMediaElement::endedPlayback() const
|
|
|
| // 4.8.10.8 Playing the media resource
|
|
|
| - // A media element is said to have ended playback when the element's
|
| - // readyState attribute is HAVE_METADATA or greater,
|
| + // A media element is said to have ended playback when the element's
|
| + // readyState attribute is HAVE_METADATA or greater,
|
| if (m_readyState < HAVE_METADATA)
|
| return false;
|
|
|
| @@ -2657,7 +2664,7 @@ bool HTMLMediaElement::endedPlayback() const
|
| if (m_playbackRate > 0)
|
| return dur > 0 && now >= dur && (!loop() || m_mediaController);
|
|
|
| - // or the current playback position is the earliest possible position and the direction
|
| + // or the current playback position is the earliest possible position and the direction
|
| // of playback is backwards
|
| if (m_playbackRate < 0)
|
| return now <= 0;
|
| @@ -2672,7 +2679,7 @@ bool HTMLMediaElement::stoppedDueToErrors() const
|
| if (!seekableRanges->contain(currentTime()))
|
| return true;
|
| }
|
| -
|
| +
|
| return false;
|
| }
|
|
|
| @@ -2691,7 +2698,7 @@ float HTMLMediaElement::maxTimeSeekable() const
|
| {
|
| return m_player ? m_player->maxTimeSeekable() : 0;
|
| }
|
| -
|
| +
|
| void HTMLMediaElement::updateVolume()
|
| {
|
| if (!m_player)
|
| @@ -2730,11 +2737,11 @@ void HTMLMediaElement::updatePlayState()
|
| mediaControls()->playbackStopped();
|
| return;
|
| }
|
| -
|
| +
|
| bool shouldBePlaying = potentiallyPlaying();
|
| bool playerPaused = m_player->paused();
|
|
|
| - LOG(Media, "HTMLMediaElement::updatePlayState - shouldBePlaying = %s, playerPaused = %s",
|
| + LOG(Media, "HTMLMediaElement::updatePlayState - shouldBePlaying = %s, playerPaused = %s",
|
| boolString(shouldBePlaying), boolString(playerPaused));
|
|
|
| if (shouldBePlaying) {
|
| @@ -2822,9 +2829,9 @@ void HTMLMediaElement::userCancelledLoad()
|
| setSourceState(SOURCE_CLOSED);
|
| #endif
|
|
|
| - // 4 - If the media element's readyState attribute has a value equal to HAVE_NOTHING, set the
|
| - // element's networkState attribute to the NETWORK_EMPTY value and queue a task to fire a
|
| - // simple event named emptied at the element. Otherwise, set the element's networkState
|
| + // 4 - If the media element's readyState attribute has a value equal to HAVE_NOTHING, set the
|
| + // element's networkState attribute to the NETWORK_EMPTY value and queue a task to fire a
|
| + // simple event named emptied at the element. Otherwise, set the element's networkState
|
| // attribute to the NETWORK_IDLE value.
|
| if (m_readyState == HAVE_NOTHING) {
|
| m_networkState = NETWORK_EMPTY;
|
| @@ -2846,7 +2853,7 @@ void HTMLMediaElement::userCancelledLoad()
|
|
|
| bool HTMLMediaElement::canSuspend() const
|
| {
|
| - return true;
|
| + return true;
|
| }
|
|
|
| void HTMLMediaElement::stop()
|
| @@ -2854,16 +2861,16 @@ void HTMLMediaElement::stop()
|
| LOG(Media, "HTMLMediaElement::stop");
|
| if (m_isFullscreen)
|
| exitFullscreen();
|
| -
|
| +
|
| m_inActiveDocument = false;
|
| userCancelledLoad();
|
| -
|
| +
|
| // Stop the playback without generating events
|
| setPausedInternal(true);
|
| -
|
| +
|
| if (renderer())
|
| renderer()->updateFromElement();
|
| -
|
| +
|
| stopPeriodicTimers();
|
| cancelPendingEventsAndCallbacks();
|
| }
|
| @@ -2871,7 +2878,7 @@ void HTMLMediaElement::stop()
|
| void HTMLMediaElement::suspend(ReasonForSuspension why)
|
| {
|
| LOG(Media, "HTMLMediaElement::suspend");
|
| -
|
| +
|
| switch (why)
|
| {
|
| case DocumentWillBecomeInactive:
|
| @@ -2906,7 +2913,7 @@ void HTMLMediaElement::resume()
|
|
|
| bool HTMLMediaElement::hasPendingActivity() const
|
| {
|
| - // Return true when we have pending events so we can't fire events after the JS
|
| + // Return true when we have pending events so we can't fire events after the JS
|
| // object gets collected.
|
| bool pending = m_pendingEvents.size();
|
| LOG(Media, "HTMLMediaElement::hasPendingActivity -> %s", boolString(pending));
|
| @@ -3012,7 +3019,7 @@ void HTMLMediaElement::createMediaPlayerProxy()
|
| Vector<String> paramValues;
|
|
|
| getPluginProxyParams(url, paramNames, paramValues);
|
| -
|
| +
|
| // Hang onto the proxy widget so it won't be destroyed if the plug-in is set to
|
| // display:none
|
| m_proxyWidget = frame->loader()->subframeLoader()->loadMediaPlayerProxyPlugin(this, url, paramNames, paramValues);
|
| @@ -3041,12 +3048,12 @@ bool HTMLMediaElement::isFullscreen() const
|
| {
|
| if (m_isFullscreen)
|
| return true;
|
| -
|
| +
|
| #if ENABLE(FULLSCREEN_API)
|
| if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScreenElement() == this)
|
| return true;
|
| #endif
|
| -
|
| +
|
| return false;
|
| }
|
|
|
| @@ -3199,7 +3206,7 @@ void HTMLMediaElement::setShouldDelayLoadEvent(bool shouldDelay)
|
| else
|
| document()->decrementLoadEventDelayCount();
|
| }
|
| -
|
| +
|
|
|
| void HTMLMediaElement::getSitesInMediaCache(Vector<String>& sites)
|
| {
|
| @@ -3290,7 +3297,7 @@ void HTMLMediaElement::createMediaPlayer()
|
| if (m_audioSourceNode)
|
| m_audioSourceNode->lock();
|
| #endif
|
| -
|
| +
|
| m_player = MediaPlayer::create(this);
|
|
|
| #if ENABLE(WEB_AUDIO)
|
| @@ -3345,7 +3352,7 @@ void HTMLMediaElement::setMediaGroup(const String& group)
|
| return;
|
| m_mediaGroup = group;
|
|
|
| - // When a media element is created with a mediagroup attribute, and when a media element's mediagroup
|
| + // When a media element is created with a mediagroup attribute, and when a media element's mediagroup
|
| // attribute is set, changed, or removed, the user agent must run the following steps:
|
| // 1. Let m [this] be the media element in question.
|
| // 2. Let m have no current media controller, if it currently has one.
|
| @@ -3356,14 +3363,14 @@ void HTMLMediaElement::setMediaGroup(const String& group)
|
| return;
|
|
|
| // 4. If there is another media element whose Document is the same as m's Document (even if one or both
|
| - // of these elements are not actually in the Document),
|
| + // of these elements are not actually in the Document),
|
| HashSet<HTMLMediaElement*> elements = documentToElementSetMap().get(document());
|
| for (HashSet<HTMLMediaElement*>::iterator i = elements.begin(); i != elements.end(); ++i) {
|
| if (*i == this)
|
| continue;
|
|
|
| // and which also has a mediagroup attribute, and whose mediagroup attribute has the same value as
|
| - // the new value of m's mediagroup attribute,
|
| + // the new value of m's mediagroup attribute,
|
| if ((*i)->mediaGroup() == group) {
|
| // then let controller be that media element's current media controller.
|
| setController((*i)->controller());
|
| @@ -3413,13 +3420,13 @@ bool HTMLMediaElement::isBlockedOnMediaController() const
|
| if (!m_mediaController)
|
| return false;
|
|
|
| - // A media element is blocked on its media controller if the MediaController is a blocked
|
| + // A media element is blocked on its media controller if the MediaController is a blocked
|
| // media controller,
|
| if (m_mediaController->isBlocked())
|
| return true;
|
|
|
| - // or if its media controller position is either before the media resource's earliest possible
|
| - // position relative to the MediaController's timeline or after the end of the media resource
|
| + // or if its media controller position is either before the media resource's earliest possible
|
| + // position relative to the MediaController's timeline or after the end of the media resource
|
| // relative to the MediaController's timeline.
|
| float mediaControllerPosition = m_mediaController->currentTime();
|
| if (mediaControllerPosition < startTime() || mediaControllerPosition > startTime() + duration())
|
|
|