зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1334112 - part1: Add IsLoaded functions for TextTrack, TextTrackList, TextTrackManager. r=rillian
MozReview-Commit-ID: GBEKZvLUiPn --HG-- extra : rebase_source : 9c3e5ba8a7ac6b9e3bb99fe9ae10e554422ff268
This commit is contained in:
Родитель
44da8e9d43
Коммит
5bd89ec1d3
|
@ -848,5 +848,12 @@ TextTrackManager::ReportTelemetryForCue()
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
TextTrackManager::IsLoaded()
|
||||
{
|
||||
return mTextTracks ? mTextTracks->AreTextTracksLoaded() : true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -103,6 +103,8 @@ public:
|
|||
|
||||
void NotifyReset();
|
||||
|
||||
bool IsLoaded();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Converts the TextTrackCue's cuetext into a tree of DOM objects
|
||||
|
|
|
@ -337,5 +337,22 @@ TextTrack::DispatchAsyncTrustedEvent(const nsString& aEventName)
|
|||
);
|
||||
}
|
||||
|
||||
bool
|
||||
TextTrack::IsLoaded()
|
||||
{
|
||||
if (mMode == TextTrackMode::Disabled) {
|
||||
return true;
|
||||
}
|
||||
// If the TrackElement's src is null, we can not block the
|
||||
// MediaElement.
|
||||
if (mTrackElement) {
|
||||
nsAutoString src;
|
||||
if (!(mTrackElement->GetAttr(kNameSpaceID_None, nsGkAtoms::src, src))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return (mReadyState >= Loaded);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -118,6 +118,8 @@ public:
|
|||
|
||||
void DispatchAsyncTrustedEvent(const nsString& aEventName);
|
||||
|
||||
bool IsLoaded();
|
||||
|
||||
private:
|
||||
~TextTrack();
|
||||
|
||||
|
|
|
@ -232,5 +232,17 @@ TextTrackList::SetCuesInactive()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool TextTrackList::AreTextTracksLoaded()
|
||||
{
|
||||
// Return false if any texttrack is not loaded.
|
||||
for (uint32_t i = 0; i < Length(); i++) {
|
||||
if (!mTextTracks[i]->IsLoaded()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -63,6 +63,8 @@ public:
|
|||
void CreateAndDispatchChangeEvent();
|
||||
void SetCuesInactive();
|
||||
|
||||
bool AreTextTracksLoaded();
|
||||
|
||||
IMPL_EVENT_HANDLER(change)
|
||||
IMPL_EVENT_HANDLER(addtrack)
|
||||
IMPL_EVENT_HANDLER(removetrack)
|
||||
|
|
Загрузка…
Ссылка в новой задаче