Bug 1548923 - part5 : run `TimeMarchesOn` in correct order r=jya

To run `TimeMarchesOn` in correct spec's steps order.

Differential Revision: https://phabricator.services.mozilla.com/D30391

--HG--
extra : moz-landing-system : lando
This commit is contained in:
alwu 2019-05-09 01:34:57 +00:00
Родитель 2b345c4263
Коммит 4be0d5b867
1 изменённых файлов: 9 добавлений и 10 удалений

Просмотреть файл

@ -625,12 +625,6 @@ void TextTrackManager::TimeMarchesOn() {
return;
}
nsISupports* parentObject = mMediaElement->OwnerDoc()->GetParentObject();
if (NS_WARN_IF(!parentObject)) {
return;
}
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(parentObject);
if (mMediaElement->ReadyState() == HTMLMediaElement_Binding::HAVE_NOTHING) {
WEBVTT_LOG(
"TimeMarchesOn return because media doesn't contain any data yet");
@ -642,6 +636,15 @@ void TextTrackManager::TimeMarchesOn() {
return;
}
// Step 1, 2.
nsISupports* parentObject = mMediaElement->OwnerDoc()->GetParentObject();
if (NS_WARN_IF(!parentObject)) {
return;
}
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(parentObject);
RefPtr<TextTrackCueList> currentCues = new TextTrackCueList(window);
RefPtr<TextTrackCueList> otherCues = new TextTrackCueList(window);
// Step 3.
auto currentPlaybackTime =
media::TimeUnit::FromSeconds(mMediaElement->CurrentTime());
@ -653,10 +656,6 @@ void TextTrackManager::TimeMarchesOn() {
mLastTimeMarchesOnCalled.ToSeconds(), currentPlaybackTime.ToSeconds(),
hasNormalPlayback);
// Step 1, 2.
RefPtr<TextTrackCueList> currentCues = new TextTrackCueList(window);
RefPtr<TextTrackCueList> otherCues = new TextTrackCueList(window);
// The reason we collect other cues is (1) to change active cues to inactive,
// (2) find missing cues, so we actually no need to process all cues. We just
// need to handle cues which are in the time interval [lastTime:currentTime]