mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
Bug 977299 - Don't display subtitles if their mode is 'hidden'. r=rillian
I've renamed TextTrackList::GetAllActiveCues to UpdateAndGetShowingCues to make it a bit more clear what this function is doing.
This commit is contained in:
parent
8178319bae
commit
e528d12f52
@ -193,7 +193,7 @@ TextTrackManager::UpdateCueDisplay()
|
||||
}
|
||||
|
||||
nsTArray<nsRefPtr<TextTrackCue> > activeCues;
|
||||
mTextTracks->GetAllActiveCues(activeCues);
|
||||
mTextTracks->UpdateAndGetShowingCues(activeCues);
|
||||
|
||||
if (activeCues.Length() > 0) {
|
||||
nsCOMPtr<nsIWritableVariant> jsCues =
|
||||
|
@ -104,6 +104,7 @@ public:
|
||||
}
|
||||
|
||||
TextTrackCueList* GetActiveCues();
|
||||
void UpdateActiveCueList();
|
||||
void GetActiveCueArray(nsTArray<nsRefPtr<TextTrackCue> >& aCues);
|
||||
|
||||
TextTrackReadyState ReadyState() const;
|
||||
@ -126,8 +127,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void UpdateActiveCueList();
|
||||
|
||||
nsCOMPtr<nsISupports> mParent;
|
||||
nsRefPtr<TextTrackList> mTextTrackList;
|
||||
|
||||
|
@ -37,11 +37,19 @@ TextTrackList::TextTrackList(nsISupports* aGlobal, TextTrackManager* aTextTrackM
|
||||
}
|
||||
|
||||
void
|
||||
TextTrackList::GetAllActiveCues(nsTArray<nsRefPtr<TextTrackCue> >& aCues)
|
||||
TextTrackList::UpdateAndGetShowingCues(nsTArray<nsRefPtr<TextTrackCue> >& aCues)
|
||||
{
|
||||
nsTArray< nsRefPtr<TextTrackCue> > cues;
|
||||
for (uint32_t i = 0; i < Length(); i++) {
|
||||
if (mTextTracks[i]->Mode() != TextTrackMode::Disabled) {
|
||||
TextTrackMode mode = mTextTracks[i]->Mode();
|
||||
// If the mode is hidden then we just need to update the active cue list,
|
||||
// we don't need to show it on the video.
|
||||
if (mode == TextTrackMode::Hidden) {
|
||||
mTextTracks[i]->UpdateActiveCueList();
|
||||
} else if (mode == TextTrackMode::Showing) {
|
||||
// If the mode is showing then we need to update the cue list and show it
|
||||
// on the video. GetActiveCueArray() calls UpdateActiveCueList() so we
|
||||
// don't need to call it explicitly.
|
||||
mTextTracks[i]->GetActiveCueArray(cues);
|
||||
aCues.AppendElements(cues);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
}
|
||||
|
||||
// Get all the current active cues.
|
||||
void GetAllActiveCues(nsTArray<nsRefPtr<TextTrackCue> >& aCues);
|
||||
void UpdateAndGetShowingCues(nsTArray<nsRefPtr<TextTrackCue> >& aCues);
|
||||
|
||||
TextTrack* IndexedGetter(uint32_t aIndex, bool& aFound);
|
||||
TextTrack* operator[](uint32_t aIndex);
|
||||
|
Loading…
Reference in New Issue
Block a user