Bug 882718 - triggerTimeMarchesOn. r=rillian
MozReview-Commit-ID: 2OOqr1Z6X9
This commit is contained in:
@@ -172,6 +172,7 @@ TextTrackManager::AddCues(TextTrack* aTextTrack)
|
||||
for (uint32_t i = 0; i < cueList->Length(); ++i) {
|
||||
mNewCues->AddCue(*cueList->IndexedGetter(i, dummy));
|
||||
}
|
||||
DispatchTimeMarchesOn();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,6 +189,15 @@ TextTrackManager::RemoveTextTrack(TextTrack* aTextTrack, bool aPendingListOnly)
|
||||
}
|
||||
|
||||
mTextTracks->RemoveTextTrack(aTextTrack);
|
||||
// Remove the cues in mNewCues belong to aTextTrack.
|
||||
TextTrackCueList* removeCueList = aTextTrack->GetCues();
|
||||
if (removeCueList) {
|
||||
for (uint32_t i = 0; i < removeCueList->Length(); ++i) {
|
||||
ErrorResult dummyRv;
|
||||
mNewCues->RemoveCue(*((*removeCueList)[i]), dummyRv);
|
||||
}
|
||||
DispatchTimeMarchesOn();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -235,6 +245,10 @@ TextTrackManager::UpdateCueDisplay()
|
||||
} else if (overlay->Length() > 0) {
|
||||
nsContentUtils::SetNodeTextContent(overlay, EmptyString(), true);
|
||||
}
|
||||
// Call TimeMarchesOn() directly instead DispatchTimeMarchesOn()
|
||||
// because we had render the new cue, so we must run
|
||||
// TimeMarchesOn immediately.
|
||||
TimeMarchesOn();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -243,6 +257,17 @@ TextTrackManager::AddCue(TextTrackCue& aCue)
|
||||
if (mNewCues) {
|
||||
mNewCues->AddCue(aCue);
|
||||
}
|
||||
DispatchTimeMarchesOn();
|
||||
}
|
||||
|
||||
void
|
||||
TextTrackManager::NotifyCueRemoved(TextTrackCue& aCue)
|
||||
{
|
||||
if (mNewCues) {
|
||||
ErrorResult dummyRv;
|
||||
mNewCues->RemoveCue(aCue, dummyRv);
|
||||
}
|
||||
DispatchTimeMarchesOn();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -507,6 +532,10 @@ TextTrackManager::TimeMarchesOn()
|
||||
}
|
||||
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(parentObject);
|
||||
|
||||
if (mMediaElement && !(mMediaElement->GetPlayedOrSeeked())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Step 3.
|
||||
double currentPlaybackTime = mMediaElement->CurrentTime();
|
||||
bool hasNormalPlayback = !mHasSeeked;
|
||||
@@ -521,6 +550,7 @@ TextTrackManager::TimeMarchesOn()
|
||||
for (uint32_t index = 0; index < mTextTracks->Length(); ++index) {
|
||||
TextTrack* ttrack = mTextTracks->IndexedGetter(index, dummy);
|
||||
if (ttrack && dummy) {
|
||||
// TODO: call GetCueListByTimeInterval on mNewCues?
|
||||
TextTrackCueList* activeCueList = ttrack->GetActiveCues();
|
||||
if (activeCueList) {
|
||||
for (uint32_t i = 0; i < activeCueList->Length(); ++i) {
|
||||
|
||||
Reference in New Issue
Block a user