зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1274884 - Add/Remove cue into MediaElement when TextTrack::mMode changed. r=rillian
MozReview-Commit-ID: 9PGEV5g8iv3 --HG-- extra : transplant_source : b%06Jsa%B8%08%A3%A2aS%0F%5C%C5T%9B%C9y%B5%C8
This commit is contained in:
Родитель
a4c22dfaca
Коммит
6193b9598d
|
@ -695,9 +695,9 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void AddCue(TextTrackCue& aCue) {
|
||||
void NotifyCueAdded(TextTrackCue& aCue) {
|
||||
if (mTextTrackManager) {
|
||||
mTextTrackManager->AddCue(aCue);
|
||||
mTextTrackManager->NotifyCueAdded(aCue);
|
||||
}
|
||||
}
|
||||
void NotifyCueRemoved(TextTrackCue& aCue) {
|
||||
|
|
|
@ -255,7 +255,7 @@ TextTrackManager::UpdateCueDisplay()
|
|||
}
|
||||
|
||||
void
|
||||
TextTrackManager::AddCue(TextTrackCue& aCue)
|
||||
TextTrackManager::NotifyCueAdded(TextTrackCue& aCue)
|
||||
{
|
||||
if (mNewCues) {
|
||||
mNewCues->AddCue(aCue);
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
void RemoveTextTrack(TextTrack* aTextTrack, bool aPendingListOnly);
|
||||
void DidSeek();
|
||||
|
||||
void AddCue(TextTrackCue& aCue);
|
||||
void NotifyCueAdded(TextTrackCue& aCue);
|
||||
void AddCues(TextTrack* aTextTrack);
|
||||
void NotifyCueRemoved(TextTrackCue& aCue);
|
||||
/**
|
||||
|
|
|
@ -94,7 +94,25 @@ TextTrack::SetMode(TextTrackMode aValue)
|
|||
mMode = aValue;
|
||||
if (aValue == TextTrackMode::Disabled) {
|
||||
SetCuesInactive();
|
||||
//TODO: Apply the rules for text track cue rendering Bug 865407
|
||||
// Remove all the cues in MediaElement.
|
||||
if (mTextTrackList) {
|
||||
HTMLMediaElement* mediaElement = mTextTrackList->GetMediaElement();
|
||||
if (mediaElement) {
|
||||
for (size_t i = 0; i < mCueList->Length(); ++i) {
|
||||
mediaElement->NotifyCueRemoved(*(*mCueList)[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Add all the cues into MediaElement.
|
||||
if (mTextTrackList) {
|
||||
HTMLMediaElement* mediaElement = mTextTrackList->GetMediaElement();
|
||||
if (mediaElement) {
|
||||
for (size_t i = 0; i < mCueList->Length(); ++i) {
|
||||
mediaElement->NotifyCueAdded(*(*mCueList)[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mTextTrackList) {
|
||||
mTextTrackList->CreateAndDispatchChangeEvent();
|
||||
|
@ -119,8 +137,8 @@ TextTrack::AddCue(TextTrackCue& aCue)
|
|||
aCue.SetTrack(this);
|
||||
if (mTextTrackList) {
|
||||
HTMLMediaElement* mediaElement = mTextTrackList->GetMediaElement();
|
||||
if (mediaElement) {
|
||||
mediaElement->AddCue(aCue);
|
||||
if (mediaElement && (mMode != TextTrackMode::Disabled)) {
|
||||
mediaElement->NotifyCueAdded(aCue);
|
||||
}
|
||||
}
|
||||
SetDirty();
|
||||
|
|
Загрузка…
Ссылка в новой задаче