Modified: branches/safari-600.1.4.17-branch/Source/WebCore/html/HTMLMediaElement.cpp (186553 => 186554)
--- branches/safari-600.1.4.17-branch/Source/WebCore/html/HTMLMediaElement.cpp 2015-07-09 01:03:30 UTC (rev 186553)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/html/HTMLMediaElement.cpp 2015-07-09 01:03:32 UTC (rev 186554)
@@ -155,7 +155,7 @@
{
value &= ~flags;
}
-
+
#if !LOG_DISABLED
static String urlForLoggingMedia(const URL& url)
{
@@ -173,7 +173,7 @@
#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
@@ -245,7 +245,7 @@
ASSERT(m_mediaElement);
m_mediaElement->endIgnoringTrackDisplayUpdateRequests();
}
-
+
private:
HTMLMediaElement* m_mediaElement;
};
@@ -648,7 +648,7 @@
{
HTMLElement::finishParsingChildren();
m_parsingInProgress = false;
-
+
#if ENABLE(VIDEO_TRACK)
if (!RuntimeEnabledFeatures::sharedFeatures().webkitVideoTrackEnabled())
return;
@@ -791,7 +791,7 @@
LOG(Media, "HTMLMediaElement::scheduleEvent - scheduling '%s'", eventName.string().ascii().data());
#endif
RefPtr<Event> event = Event::create(eventName, false, true);
-
+
// Don't set the event target, the event queue will set it in GenericEventQueue::timerFired and setting it here
// will trigger an ASSERT if this element has been marked for deletion.
@@ -822,7 +822,7 @@
m_pendingActionFlags = 0;
}
-PassRefPtr<MediaError> HTMLMediaElement::error() const
+PassRefPtr<MediaError> HTMLMediaElement::error() const
{
return m_error;
}
@@ -879,7 +879,7 @@
canPlay = ASCIILiteral("probably");
break;
}
-
+
LOG(Media, "HTMLMediaElement::canPlayType(%s, %s, %s) -> %s", mimeType.utf8().data(), keySystem.utf8().data(), url.stringCenterEllipsizedToLength().utf8().data(), canPlay.utf8().data());
return canPlay;
@@ -888,9 +888,9 @@
void HTMLMediaElement::load()
{
Ref<HTMLMediaElement> protect(*this); // loadInternal may result in a 'beforeload' event, which can make arbitrary DOM mutations.
-
+
LOG(Media, "HTMLMediaElement::load()");
-
+
if (!m_mediaSession->dataLoadingPermitted(*this))
return;
if (ScriptController::processingUserGesture())
@@ -922,7 +922,7 @@
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();
@@ -1004,7 +1004,7 @@
m_lastSeekTime = 0;
// 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.
MediaPlayer::Preload effectivePreload = m_mediaSession->effectivePreloadForElement(*this);
if (effectivePreload != MediaPlayer::None)
@@ -1038,8 +1038,8 @@
clearFlags(m_pendingActionFlags, LoadMediaResource);
- // 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 into the background.
m_mediaSession->removeBehaviorRestriction(HTMLMediaSession::RequirePageConsentToLoadMedia);
@@ -1073,16 +1073,16 @@
// 3 - If the media element has a src attribute, then let mode be attribute.
Mode mode = attribute;
if (!fastHasAttribute(srcAttr)) {
- // 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 (auto firstSource = childrenOfType<HTMLSourceElement>(*this).first()) {
mode = children;
m_nextChildNodeToConsider = firstSource;
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);
@@ -1093,7 +1093,7 @@
}
}
- // 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;
@@ -1184,8 +1184,8 @@
mediaLoadingFailed(MediaPlayer::FormatError);
return;
}
-
- // The resource fetch algorithm
+
+ // The resource fetch algorithm
m_networkState = NETWORK_LOADING;
// If the url should be loaded from the application cache, pass the url of the cached file
@@ -1221,7 +1221,7 @@
m_mediaSession->removeBehaviorRestriction(HTMLMediaSession::RequireUserGestureForRateChange);
#endif
- if (m_sendProgressEvents)
+ if (m_sendProgressEvents)
startProgressEventTimer();
bool privateMode = document().page() && document().page()->usesEphemeralSession();
@@ -1520,7 +1520,7 @@
HTMLTrackElement* trackElement = static_cast<LoadableTextTrack*>(affectedTracks[i])->trackElement();
ASSERT(trackElement);
event->setTarget(trackElement);
-
+
m_asyncEventQueue.enqueueEvent(event.release());
}
}
@@ -1546,7 +1546,7 @@
{
// 4.8.10.12.1 Text track model
// ...
- // The text tracks of a media element are ready if all the text tracks whose mode was not
+ // The text tracks of a media element are ready if all the text tracks whose mode was not
// in the disabled state when the element's resource selection algorithm last started now
// have a text track readiness state of loaded or failed to load.
for (unsigned i = 0; i < m_textTracksWhenResourceSelectionBegan.size(); ++i) {
@@ -1597,10 +1597,10 @@
// If this is the first added track, create the list of text tracks.
if (!m_textTracks)
m_textTracks = TextTrackList::create(this, ActiveDOMObject::scriptExecutionContext());
-
+
// Mark this track as "configured" so configureTextTracks won't change the mode again.
track->setHasBeenConfigured(true);
-
+
if (track->mode() != TextTrack::disabledKeyword() && trackIsLoaded)
textTrackAddCues(track, track->cues());
@@ -1608,7 +1608,7 @@
if (platformTextTrackMenu())
platformTextTrackMenu()->trackWasSelected(track->platformTextTrack());
#endif
-
+
configureTextTrackDisplay(AssumeTextTrackVisibilityChanged);
if (m_textTracks && m_textTracks->contains(track))
@@ -1647,7 +1647,7 @@
updateActiveTextTrackCues(currentTime());
}
-void HTMLMediaElement::textTrackAddCues(TextTrack* track, const TextTrackCueList* cues)
+void HTMLMediaElement::textTrackAddCues(TextTrack* track, const TextTrackCueList* cues)
{
if (track->mode() == TextTrack::disabledKeyword())
return;
@@ -1657,7 +1657,7 @@
textTrackAddCue(track, cues->item(i));
}
-void HTMLMediaElement::textTrackRemoveCues(TextTrack*, const TextTrackCueList* cues)
+void HTMLMediaElement::textTrackRemoveCues(TextTrack*, const TextTrackCueList* cues)
{
TrackDisplayUpdateScope scope(this);
for (size_t i = 0; i < cues->length(); ++i)
@@ -1774,8 +1774,8 @@
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
@@ -1798,7 +1798,7 @@
// 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();
@@ -1815,7 +1815,7 @@
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.
if (error == MediaPlayer::NetworkError)
m_error = MediaError::create(MediaError::MEDIA_ERR_NETWORK);
@@ -1909,20 +1909,20 @@
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) {
-
+
// resource selection algorithm
// Step 9.Otherwise.9 - Failed with elements: Queue a task, using the DOM manipulation task source, to fire a simple event named error at the candidate element.
if (m_currentSourceNode)
m_currentSourceNode->scheduleErrorEvent();
else
LOG(Media, "HTMLMediaElement::setNetworkState - error event not sent, <source> was removed");
-
+
// 9.Otherwise.10 - Asynchronously await a stable state. The synchronous section consists of all the remaining steps of this algorithm until the algorithm says the synchronous section has ended.
-
+
// 9.Otherwise.11 - Forget the media element's media-resource-specific tracks.
forgetResourceSpecificTracks();
@@ -1933,15 +1933,15 @@
LOG(Media, "HTMLMediaElement::setNetworkState - no more <source> elements, waiting");
waitForSourceChange();
}
-
+
return;
}
-
+
if ((error == MediaPlayer::NetworkError && m_readyState >= HAVE_METADATA) || error == MediaPlayer::DecodeError)
mediaLoadingFailedFatally(error);
else if ((error == MediaPlayer::FormatError || error == MediaPlayer::NetworkError) && m_loadState == LoadingFromSrcAttr)
noneSupported();
-
+
updateDisplayState();
if (hasMediaControls()) {
mediaControls()->reset();
@@ -2035,7 +2035,7 @@
return;
bool tracksAreReady = true;
#endif
-
+
if (tracksAreReady)
m_readyState = newState;
else {
@@ -2046,7 +2046,7 @@
else
m_readyState = HAVE_CURRENT_DATA;
}
-
+
if (oldState > m_readyStateMaximum)
m_readyStateMaximum = oldState;
@@ -2192,7 +2192,7 @@
initializer.keySystem = keySystem;
initializer.sessionId = sessionId;
initializer.message = Uint8Array::create(message, messageLength);
- initializer.defaultURL = defaultURL;
+ initializer.defaultURL = defaultURL;
initializer.bubbles = false;
initializer.cancelable = false;
@@ -2299,7 +2299,7 @@
if (!m_playedTimeRanges)
m_playedTimeRanges = TimeRanges::create();
m_playedTimeRanges->add(start, end);
-}
+}
bool HTMLMediaElement::supportsSave() const
{
@@ -2408,7 +2408,7 @@
double positiveTolerance = m_pendingSeek->positiveTolerance;
m_pendingSeek = nullptr;
- // 6 - If the new playback position is later than the end of the media resource, then let it be the end
+ // 6 - 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 = std::min(time, duration());
@@ -2419,7 +2419,7 @@
// 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
double mediaTime = m_player->mediaTimeForTimeValue(time);
@@ -2429,13 +2429,13 @@
time = m_player->mediaTimeForTimeValue(time);
// 8 - 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
+ // 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);
@@ -2517,14 +2517,14 @@
void HTMLMediaElement::refreshCachedTime() const
{
m_cachedTime = m_player->currentTime();
- if (!m_cachedTime) {
- // Do not use m_cachedTime until the media engine returns a non-zero value because we can't
- // estimate current time until playback actually begins.
- invalidateCachedTime();
- return;
- }
+ if (!m_cachedTime) {
+ // Do not use m_cachedTime until the media engine returns a non-zero value because we can't
+ // estimate current time until playback actually begins.
+ invalidateCachedTime();
+ return;
+ }
- LOG(Media, "HTMLMediaElement::refreshCachedTime - caching time %f", m_cachedTime);
+ LOG(Media, "HTMLMediaElement::refreshCachedTime - caching time %f", m_cachedTime);
m_clockTimeAtLastCachedTimeUpdate = monotonicallyIncreasingTime();
}
@@ -2600,7 +2600,7 @@
if (m_cachedTime == MediaPlayer::invalidTime())
return 0;
-
+
return m_cachedTime;
}
@@ -2698,7 +2698,7 @@
LOG(Media, "HTMLMediaElement::setWebkitPreservesPitch(%s)", boolString(preservesPitch));
m_webkitPreservesPitch = preservesPitch;
-
+
if (!m_player)
return;
@@ -2708,7 +2708,7 @@
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() && effectivePlaybackRate() > 0;
}
@@ -2764,12 +2764,12 @@
void HTMLMediaElement::playInternal()
{
LOG(Media, "HTMLMediaElement::playInternal");
-
+
if (!m_mediaSession->clientWillBeginPlayback()) {
LOG(Media, " returning because of interruption");
return;
}
-
+
// 4.8.10.9. Playing the media resource
if (!m_player || m_networkState == NETWORK_EMPTY)
scheduleDelayedAction(LoadMediaResource);
@@ -2817,7 +2817,7 @@
LOG(Media, " returning because of interruption");
return;
}
-
+
// 4.8.10.9. Playing the media resource
if (!m_player || m_networkState == NETWORK_EMPTY) {
#if PLATFORM(IOS)
@@ -3001,7 +3001,7 @@
ec = INDEX_SIZE_ERR;
return;
}
-
+
#if !PLATFORM(IOS)
if (m_volume != vol) {
m_volume = vol;
@@ -3049,7 +3049,7 @@
if (canPlay()) {
updatePlaybackRate();
playInternal();
- } else
+ } else
pauseInternal();
}
@@ -3059,13 +3059,13 @@
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);
}
@@ -3157,7 +3157,7 @@
pauseInternal();
}
}
-
+
scheduleTimeupdateEvent(true);
if (!effectivePlaybackRate())
@@ -3235,12 +3235,12 @@
{
if (!RuntimeEnabledFeatures::sharedFeatures().webkitVideoTrackEnabled())
return;
-
+
// 4.8.10.12.2 Sourcing in-band text tracks
// 1. Associate the relevant data with a new text track and its corresponding new TextTrack object.
RefPtr<InbandTextTrack> textTrack = InbandTextTrack::create(ActiveDOMObject::scriptExecutionContext(), this, prpTrack);
textTrack->setMediaElement(this);
-
+
// 2. Set the new text track's kind, label, and language based on the semantics of the relevant data,
// as defined by the relevant specification. If there is no label in that data, then the label must
// be set to the empty string.
@@ -3251,15 +3251,15 @@
// 5. Populate the new text track's list of cues with the cues parsed so far, folllowing the guidelines for exposing
// cues, and begin updating it dynamically as necessary.
// - Thess are all done by the media engine.
-
+
// 6. Set the new text track's readiness state to loaded.
textTrack->setReadinessState(TextTrack::Loaded);
-
+
// 7. Set the new text track's mode to the mode consistent with the user's preferences and the requirements of
// the relevant specification for the data.
// - This will happen in configureTextTracks()
scheduleDelayedAction(ConfigureTextTracks);
-
+
// 8. Add the new text track to the media element's list of text tracks.
// 9. Fire an event with the name addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent
// interface, with the track attribute initialized to the text track's TextTrack object, at the media element's
@@ -3312,7 +3312,7 @@
size_t i;
for (i = 0; i < m_textTracks->length(); ++i) {
textTrack = m_textTracks->item(i);
-
+
if (textTrack->platformTextTrack() == platformTrack)
break;
}
@@ -3327,11 +3327,11 @@
{
if (!m_textTracks || !m_textTracks->length())
return Vector<RefPtr<PlatformTextTrack>>();
-
+
Vector<RefPtr<PlatformTextTrack>> platformTracks;
for (size_t i = 0; i < m_textTracks->length(); ++i)
platformTracks.append(m_textTracks->item(i)->platformTextTrack());
-
+
return platformTracks;
}
@@ -3339,7 +3339,7 @@
{
if (!m_textTracks || !m_textTracks->length() || !platformTextTrackMenu())
return;
-
+
m_platformMenu->tracksDidChange();
}
@@ -3360,7 +3360,7 @@
return m_platformMenu.get();
}
#endif // #if USE(PLATFORM_TEXT_TRACK_MENU)
-
+
void HTMLMediaElement::closeCaptionTracksChanged()
{
if (hasMediaControls())
@@ -3466,7 +3466,7 @@
// 3. If the language argument was omitted, let language be the empty string.
// 4. Create a new TextTrack object.
- // 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...
RefPtr<TextTrack> textTrack = TextTrack::create(ActiveDOMObject::scriptExecutionContext(), this, kind, emptyString(), label, language);
@@ -3496,7 +3496,7 @@
return m_audioTracks.get();
}
-TextTrackList* HTMLMediaElement::textTracks()
+TextTrackList* HTMLMediaElement::textTracks()
{
if (!RuntimeEnabledFeatures::sharedFeatures().webkitVideoTrackEnabled())
return 0;
@@ -3526,15 +3526,15 @@
return;
// 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.release());
-
+
// Do not schedule the track loading until parsing finishes so we don't start before all tracks
// in the markup have been added.
if (!m_parsingInProgress)
@@ -3561,15 +3561,15 @@
RefPtr<TextTrack> textTrack = trackElement->track();
if (!textTrack)
return;
-
+
textTrack->setHasBeenConfigured(false);
if (!m_textTracks)
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.
removeTextTrack(textTrack.get());
@@ -3649,7 +3649,7 @@
if (!trackToEnable && defaultTrack)
trackToEnable = defaultTrack;
-
+
// If no track matches the user's preferred language, none was marked as 'default', and there is a forced subtitle track
// in the same language as the language of the primary audio track, enable it.
if (!trackToEnable && forcedSubitleTrack)
@@ -3660,7 +3660,7 @@
if (!trackToEnable && !defaultTrack && group.visibleTrack)
trackToEnable = group.visibleTrack;
}
-
+
// If no track matches the user's preferred language and non was marked 'default', enable the first track
// because the user has explicitly stated a preference for this kind of track.
if (!trackToEnable && fallbackTrack)
@@ -3670,7 +3670,7 @@
m_subtitleTrackLanguage = trackToEnable->language();
else
m_subtitleTrackLanguage = emptyString();
-
+
if (currentlyEnabledTracks.size()) {
for (size_t i = 0; i < currentlyEnabledTracks.size(); ++i) {
RefPtr<TextTrack> textTrack = currentlyEnabledTracks[i];
@@ -3696,12 +3696,12 @@
static JSC::JSValue controllerJSValue(JSC::ExecState& exec, JSDOMGlobalObject& globalObject, HTMLMediaElement& media)
{
auto mediaJSWrapper = toJS(&exec, &globalObject, &media);
-
+
// Retrieve the controller through the JS object graph
JSC::JSObject* mediaJSWrapperObject = JSC::jsDynamicCast<JSC::JSObject*>(mediaJSWrapper);
if (!mediaJSWrapperObject)
return JSC::jsNull();
-
+
JSC::Identifier controlsHost(&exec.vm(), "controlsHost");
JSC::JSValue controlsHostJSWrapper = mediaJSWrapperObject->get(&exec, controlsHost);
if (exec.hadException())
@@ -3718,7 +3718,7 @@
return controllerJSWrapper;
}
-
+
void HTMLMediaElement::updateCaptionContainer()
{
LOG(Media, "HTMLMediaElement::updateCaptionContainer");
@@ -3770,7 +3770,7 @@
exec->clearException();
#endif
}
-
+
void HTMLMediaElement::setSelectedTextTrack(TextTrack* trackToSelect)
{
TextTrackList* trackList = textTracks();
@@ -3780,7 +3780,7 @@
if (trackToSelect != TextTrack::captionMenuOffItem() && trackToSelect != TextTrack::captionMenuAutomaticItem()) {
if (!trackList->contains(trackToSelect))
return;
-
+
for (int i = 0, length = trackList->length(); i < length; ++i) {
TextTrack* track = trackList->item(i);
if (!trackToSelect || track != trackToSelect)
@@ -3846,19 +3846,19 @@
currentGroup->defaultTrack = textTrack;
// Do not add this track to the group if it has already been automatically configured
- // as we only want to call configureTextTrack once per track so that adding another
- // track after the initial configuration doesn't reconfigure every track - only those
- // that should be changed by the new addition. For example all metadata tracks are
- // disabled by default, and we don't want a track that has been enabled by script
+ // as we only want to call configureTextTrack once per track so that adding another
+ // track after the initial configuration doesn't reconfigure every track - only those
+ // that should be changed by the new addition. For example all metadata tracks are
+ // disabled by default, and we don't want a track that has been enabled by script
// to be disabled automatically when a new metadata track is added later.
if (textTrack->hasBeenConfigured())
continue;
-
+
if (textTrack->language().length())
currentGroup->hasSrcLang = true;
currentGroup->tracks.append(textTrack);
}
-
+
if (captionAndSubtitleTracks.tracks.size())
configureTextTrackGroup(captionAndSubtitleTracks);
if (descriptionTracks.tracks.size())
@@ -3940,7 +3940,7 @@
#endif
if (mediaURL.isEmpty())
goto check_again;
-
+
if (source->fastHasAttribute(mediaAttr)) {
MediaQueryEvaluator screenEval("screen", document().frame(), renderer() ? &renderer()->style() : nullptr);
RefPtr<MediaQuerySet> media = MediaQuerySet::createAllowingDescriptionSyntax(source->media());
@@ -3948,7 +3948,7 @@
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;
}
@@ -4026,13 +4026,13 @@
LOG(Media, "HTMLMediaElement::sourceWasAdded - 'src' is %s", urlForLoggingMedia(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) {
scheduleDelayedAction(LoadMediaResource);
@@ -4048,17 +4048,17 @@
if (m_nextChildNodeToConsider)
return;
-
+
// 4.8.9.5, resource selection algorithm, source elements section:
// 21. Wait until the node after pointer is a node other than the end of the list. (This step might wait forever.)
// 22. Asynchronously await a stable state...
- // 23. Set the element's delaying-the-load-event flag back to true (this delays the load event again, in case
+ // 23. 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);
// 24. Set the networkState back to NETWORK_LOADING.
m_networkState = NETWORK_LOADING;
-
+
// 25. Jump back to the find next candidate step above.
m_nextChildNodeToConsider = source;
scheduleNextSourceChild();
@@ -4084,7 +4084,7 @@
LOG(Media, "HTMLMediaElement::sourceRemoved - m_nextChildNodeToConsider set to %p", m_nextChildNodeToConsider.get());
} 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");
@@ -4107,8 +4107,8 @@
// 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 && !m_player->seeking())
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.
else
@@ -4117,7 +4117,7 @@
double now = currentTime();
double dur = duration();
double playbackRate = effectivePlaybackRate();
-
+
// When the current playback position reaches the end of the media resource then the user agent must follow these steps:
if (!std::isnan(dur) && dur) {
// If the media element has a loop attribute specified and does not have a current media controller,
@@ -4336,7 +4336,7 @@
void HTMLMediaElement::mediaPlayerCharacteristicChanged(MediaPlayer*)
{
LOG(Media, "HTMLMediaElement::mediaPlayerCharacteristicChanged");
-
+
beginProcessingMediaPlayerCallback();
#if ENABLE(VIDEO_TRACK)
@@ -4395,7 +4395,7 @@
{
if (isBlockedOnMediaController())
return false;
-
+
if (!couldPlayIfEnoughData())
return false;
@@ -4430,8 +4430,8 @@
// 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;
@@ -4442,7 +4442,7 @@
if (effectivePlaybackRate() > 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 (effectivePlaybackRate() < 0)
return now <= 0;
@@ -4457,7 +4457,7 @@
if (!seekableRanges->contain(currentTime()))
return true;
}
-
+
return false;
}
@@ -4478,7 +4478,7 @@
{
return m_player ? m_player->maxTimeSeekable() : 0;
}
-
+
void HTMLMediaElement::updateVolume()
{
#if PLATFORM(IOS)
@@ -4528,7 +4528,7 @@
m_activityToken = nullptr;
return;
}
-
+
bool shouldBePlaying = potentiallyPlaying();
bool playerPaused = m_player->paused();
@@ -4585,7 +4585,7 @@
mediaControls()->playbackStopped();
m_activityToken = nullptr;
}
-
+
#if PLATFORM(IOS)
m_requestingPlay = false;
#endif
@@ -4636,9 +4636,9 @@
closeMediaSource();
#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;
@@ -4699,7 +4699,7 @@
bool HTMLMediaElement::canSuspend() const
{
- return true;
+ return true;
}
void HTMLMediaElement::stop()
@@ -4707,7 +4707,7 @@
LOG(Media, "HTMLMediaElement::stop");
if (m_isFullscreen)
exitFullscreen();
-
+
m_inActiveDocument = false;
// Stop the playback without generating events
@@ -4718,7 +4718,7 @@
if (renderer())
renderer()->updateFromElement();
-
+
stopPeriodicTimers();
cancelPendingEventsAndCallbacks();
@@ -4853,7 +4853,7 @@
m_mediaSession->setHasPlaybackTargetAvailabilityListeners(*this, true);
LOG(Media, "HTMLMediaElement::addEventListener('webkitplaybacktargetavailabilitychanged')");
-
+
enqueuePlaybackTargetAvailabilityChangedEvent(); // Ensure the event listener gets at least one event.
return true;
}
@@ -4892,24 +4892,24 @@
{
return m_player ? m_player->maxFastForwardRate() : 0;
}
-
+
bool HTMLMediaElement::isFullscreen() const
{
if (m_isFullscreen)
return true;
-
+
#if ENABLE(FULLSCREEN_API)
if (document().webkitIsFullScreen() && document().webkitCurrentFullScreenElement() == this)
return true;
#endif
-
+
return false;
}
void HTMLMediaElement::toggleFullscreenState()
{
LOG(Media, "HTMLMediaElement::toggleFullscreenState - isFullscreen() is %s", boolString(isFullscreen()));
-
+
if (isFullscreen())
exitFullscreen();
else
@@ -4994,7 +4994,7 @@
m_videoFullscreenLayer = platformLayer;
if (!m_player)
return;
-
+
m_player->setVideoFullscreenLayer(platformLayer);
setNeedsStyleRecalc(SyntheticStyleChange);
#if ENABLE(VIDEO_TRACK)
@@ -5002,7 +5002,7 @@
updateTextTrackDisplay();
#endif
}
-
+
void HTMLMediaElement::setVideoFullscreenFrame(FloatRect frame)
{
m_videoFullscreenFrame = frame;
@@ -5056,7 +5056,7 @@
#endif
if (!hasMediaControls() && !createMediaControls())
return;
-
+
mediaControls()->updateTextTrackDisplay();
}
#endif
@@ -5148,8 +5148,8 @@
else
document().decrementLoadEventDelayCount();
}
-
+
void HTMLMediaElement::getSitesInMediaCache(Vector<String>& sites)
{
MediaPlayer::getSitesInMediaCache(sites);
@@ -5235,14 +5235,14 @@
void HTMLMediaElement::configureMediaControls()
{
#if ENABLE(MEDIA_CONTROLS_SCRIPT)
- if (!controls() || !inDocument())
+ if (!controls() || !inDocument() || !inActiveDocument())
return;
ensureUserAgentShadowRoot();
return;
#endif
- if (!controls() || !inDocument()) {
+ if (!controls() || !inDocument() || !inActiveDocument()) {
if (hasMediaControls())
mediaControls()->hide();
return;
@@ -5294,7 +5294,7 @@
return;
mediaControls()->changedClosedCaptionsVisibility();
-
+
if (RuntimeEnabledFeatures::sharedFeatures().webkitVideoTrackEnabled()) {
updateTextTrackDisplay();
updateActiveTextTrackCues(currentTime());
@@ -5338,7 +5338,7 @@
// captions and non-default tracks should be displayed based on language
// preferences if the user has turned captions on).
for (unsigned i = 0; i < m_textTracks->length(); ++i) {
-
+
RefPtr<TextTrack> textTrack = m_textTracks->item(i);
String kind = textTrack->kind();
@@ -5422,7 +5422,7 @@
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.
@@ -5433,14 +5433,14 @@
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());
@@ -5493,13 +5493,13 @@
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.
double mediaControllerPosition = m_mediaController->currentTime();
if (mediaControllerPosition < 0 || mediaControllerPosition > duration())
@@ -5512,7 +5512,7 @@
{
MediaFragmentURIParser fragmentParser(m_currentSrc);
double dur = duration();
-
+
double start = fragmentParser.startTime();
if (start != MediaFragmentURIParser::invalidTimeValue() && start > 0) {
m_fragmentStartTime = start;
@@ -5520,7 +5520,7 @@
m_fragmentStartTime = dur;
} else
m_fragmentStartTime = MediaPlayer::invalidTime();
-
+
double end = fragmentParser.endTime();
if (end != MediaFragmentURIParser::invalidTimeValue() && end > 0 && end > m_fragmentStartTime) {
m_fragmentEndTime = end;
@@ -5528,7 +5528,7 @@
m_fragmentEndTime = dur;
} else
m_fragmentEndTime = MediaPlayer::invalidTime();
-
+
if (m_fragmentStartTime != MediaPlayer::invalidTime() && m_readyState < HAVE_FUTURE_DATA)
prepareToPlay();
}
@@ -5585,14 +5585,14 @@
{
Vector<RefPtr<PlatformTextTrack>> outOfBandTrackSources;
for (auto& trackElement : childrenOfType<HTMLTrackElement>(*this)) {
-
+
if (!trackElement.fastHasAttribute(srcAttr))
continue;
-
+
URL url = ""
if (url.isEmpty())
continue;
-
+
if (!document().contentSecurityPolicy()->allowMediaFromSource(url, trackElement.isInUserAgentShadowTree()))
continue;
@@ -5607,9 +5607,9 @@
platformKind = PlatformTextTrack::Forced;
else
continue;
-
+
const AtomicString& mode = trackElement.track()->mode();
-
+
PlatformTextTrack::TrackMode platformMode = PlatformTextTrack::Disabled;
if (TextTrack::hiddenKeyword() == mode)
platformMode = PlatformTextTrack::Hidden;
@@ -5617,10 +5617,10 @@
platformMode = PlatformTextTrack::Disabled;
else if (TextTrack::showingKeyword() == mode)
platformMode = PlatformTextTrack::Showing;
-
+
outOfBandTrackSources.append(PlatformTextTrack::createOutOfBand(trackElement.label(), trackElement.srclang(), url.string(), platformMode, platformKind, trackElement.track()->uniqueId(), trackElement.isDefault()));
}
-
+
return outOfBandTrackSources;
}
#endif
@@ -5768,7 +5768,7 @@
return getRawCookies(&document(), url, cookies);
}
#endif
-
+
void HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture()
{
m_mediaSession->removeBehaviorRestriction(HTMLMediaSession::RequireUserGestureForLoad);
@@ -5888,7 +5888,7 @@
auto mediaJSWrapper = toJS(exec, globalObject, this);
auto mediaControlsHostJSWrapper = toJS(exec, globalObject, m_mediaControlsHost.get());
-
+
JSC::MarkedArgumentBuffer argList;
argList.append(toJS(exec, globalObject, root));
argList.append(mediaJSWrapper);
@@ -5908,7 +5908,7 @@
// Connect the Media, MediaControllerHost, and Controller so the GC knows about their relationship
JSC::JSObject* mediaJSWrapperObject = mediaJSWrapper.toObject(exec);
JSC::Identifier controlsHost(&exec->vm(), "controlsHost");
-
+
ASSERT(!mediaJSWrapperObject->hasProperty(exec, controlsHost));
mediaJSWrapperObject->putDirect(exec->vm(), controlsHost, mediaControlsHostJSWrapper, JSC::DontDelete | JSC::DontEnum | JSC::ReadOnly);
@@ -5916,7 +5916,7 @@
JSC::JSObject* mediaControlsHostJSWrapperObject = JSC::jsDynamicCast<JSC::JSObject*>(mediaControlsHostJSWrapper);
if (!mediaControlsHostJSWrapperObject)
return;
-
+
JSC::Identifier controller(&exec->vm(), "controller");
ASSERT(!controllerObject->hasProperty(exec, controller));
@@ -5966,7 +5966,7 @@
{
if (m_player)
return m_player->fileSize();
-
+
return 0;
}
@@ -6002,12 +6002,12 @@
if (paused())
play();
}
-
+
String HTMLMediaElement::mediaSessionTitle() const
{
if (fastHasAttribute(titleAttr))
return fastGetAttribute(titleAttr);
-
+
return m_currentSrc;
}
@@ -6056,7 +6056,7 @@
AtomicString elementValue = fastGetAttribute(attributeName);
if (elementValue.isNull())
return false;
-
+
if (Settings* settings = document().settings()) {
if (attributeName == HTMLNames::x_itunes_inherit_uri_query_componentAttr && !settings->enableInheritURIQueryComponent())
return false;
@@ -6064,7 +6064,7 @@
if (value)
*value = elementValue;
-
+
return true;
}
@@ -6073,7 +6073,7 @@
if (m_player)
return m_player->setShouldBufferData(shouldBuffer);
}
-
+
}
#endif