Bug 1600353 - Make TextTrackSource and TextTrackReadyState enum classes. r=bzbarsky

To avoid defining `Loading`, `Loaded`, etc. in the mozilla::dom namespace. Also
it is a bit cleaner and saves some memory in the TextTrack objects by specifying
the size to be smaller.

Differential Revision: https://phabricator.services.mozilla.com/D55312
This commit is contained in:
Emilio Cobos Álvarez
2019-12-02 19:13:11 +00:00
parent 8c05a8210f
commit 0f0c42a05d
6 changed files with 24 additions and 18 deletions

View File

@@ -74,10 +74,11 @@ bool CompareTextTracks::LessThan(TextTrack* aOne, TextTrack* aTwo) const {
TextTrackSource sourceTwo = aTwo->GetTextTrackSource();
if (sourceOne != sourceTwo) {
return sourceOne == TextTrackSource::Track ||
(sourceOne == AddTextTrack && sourceTwo == MediaResourceSpecific);
(sourceOne == TextTrackSource::AddTextTrack &&
sourceTwo == TextTrackSource::MediaResourceSpecific);
}
switch (sourceOne) {
case Track: {
case TextTrackSource::Track: {
int32_t positionOne = TrackChildPosition(aOne);
int32_t positionTwo = TrackChildPosition(aTwo);
// If either position one or positiontwo are -1 then something has gone
@@ -85,13 +86,13 @@ bool CompareTextTracks::LessThan(TextTrack* aOne, TextTrack* aTwo) const {
return positionOne != -1 && positionTwo != -1 &&
positionOne < positionTwo;
}
case AddTextTrack:
case TextTrackSource::AddTextTrack:
// For AddTextTrack sources the tracks will already be in the correct
// relative order in the source array. Assume we're called in iteration
// order and can therefore always report aOne < aTwo to maintain the
// original temporal ordering.
return true;
case MediaResourceSpecific:
case TextTrackSource::MediaResourceSpecific:
// No rules for Media Resource Specific tracks yet.
break;
}