mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 882718 - Part a: Add list of newly introduced cues to TextTrackManager. r=rillian
This commit is contained in:
parent
33db6c5829
commit
985efe81df
@ -535,6 +535,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void AddCue(TextTrackCue& aCue) {
|
||||
if (mTextTrackManager) {
|
||||
mTextTrackManager->AddCue(aCue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A public wrapper for FinishDecoderSetup()
|
||||
*/
|
||||
|
@ -12,7 +12,8 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_2(TextTrackManager, mTextTracks, mPendingTextTracks)
|
||||
NS_IMPL_CYCLE_COLLECTION_3(TextTrackManager, mTextTracks,
|
||||
mPendingTextTracks, mNewCues)
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(TextTrackManager, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(TextTrackManager, Release)
|
||||
|
||||
@ -20,6 +21,7 @@ TextTrackManager::TextTrackManager(HTMLMediaElement *aMediaElement)
|
||||
: mMediaElement(aMediaElement)
|
||||
{
|
||||
MOZ_COUNT_CTOR(TextTrackManager);
|
||||
mNewCues = new TextTrackCueList(mMediaElement->OwnerDoc()->GetParentObject());
|
||||
mTextTracks = new TextTrackList(mMediaElement->OwnerDoc()->GetParentObject());
|
||||
mPendingTextTracks =
|
||||
new TextTrackList(mMediaElement->OwnerDoc()->GetParentObject());
|
||||
@ -43,6 +45,7 @@ TextTrackManager::AddTextTrack(TextTrackKind aKind, const nsAString& aLabel,
|
||||
nsRefPtr<TextTrack> ttrack =
|
||||
mTextTracks->AddTextTrack(mMediaElement, aKind, aLabel, aLanguage);
|
||||
ttrack->SetReadyState(HTMLTrackElement::LOADED);
|
||||
AddCues(ttrack);
|
||||
return ttrack.forget();
|
||||
}
|
||||
|
||||
@ -50,6 +53,19 @@ void
|
||||
TextTrackManager::AddTextTrack(TextTrack* aTextTrack)
|
||||
{
|
||||
mTextTracks->AddTextTrack(aTextTrack);
|
||||
AddCues(aTextTrack);
|
||||
}
|
||||
|
||||
void
|
||||
TextTrackManager::AddCues(TextTrack* aTextTrack)
|
||||
{
|
||||
TextTrackCueList* cueList = aTextTrack->GetCues();
|
||||
if (cueList) {
|
||||
bool dummy;
|
||||
for (uint32_t i = 0; i < cueList->Length(); ++i) {
|
||||
mNewCues->AddCue(*cueList->IndexedGetter(i, dummy));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -75,6 +91,12 @@ TextTrackManager::Update(double aTime)
|
||||
mTextTracks->Update(aTime);
|
||||
}
|
||||
|
||||
void
|
||||
TextTrackManager::AddCue(TextTrackCue& aCue)
|
||||
{
|
||||
mNewCues->AddCue(aCue);
|
||||
}
|
||||
|
||||
void
|
||||
TextTrackManager::PopulatePendingList()
|
||||
{
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "mozilla/dom/TextTrack.h"
|
||||
#include "mozilla/dom/TextTrackList.h"
|
||||
#include "mozilla/dom/TextTrackCueList.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -33,6 +34,9 @@ public:
|
||||
void RemoveTextTrack(TextTrack* aTextTrack, bool aPendingListOnly);
|
||||
void DidSeek();
|
||||
|
||||
void AddCue(TextTrackCue& aCue);
|
||||
void AddCues(TextTrack* aTextTrack);
|
||||
|
||||
// Update the display of cues on the video as per the current play back time
|
||||
// of aTime.
|
||||
void Update(double aTime);
|
||||
@ -49,6 +53,8 @@ private:
|
||||
nsRefPtr<TextTrackList> mTextTracks;
|
||||
// List of text track objects awaiting loading.
|
||||
nsRefPtr<TextTrackList> mPendingTextTracks;
|
||||
// List of newly introduced Text Track cues.
|
||||
nsRefPtr<TextTrackCueList> mNewCues;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -101,6 +101,7 @@ void
|
||||
TextTrack::AddCue(TextTrackCue& aCue)
|
||||
{
|
||||
mCueList->AddCue(aCue);
|
||||
mMediaElement->AddCue(aCue);
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user