Bug 881512 - Add start (and rename end) time helper to TimeRanges. r=cajbir

This commit is contained in:
Matthew Gregan 2014-04-14 23:23:00 +12:00
parent 065c46bd6f
commit d5e8d28fdf
2 changed files with 16 additions and 5 deletions

View File

@ -80,13 +80,21 @@ TimeRanges::Add(double aStart, double aEnd)
}
double
TimeRanges::GetFinalEndTime()
TimeRanges::GetStartTime()
{
if (mRanges.IsEmpty()) {
return -1.0;
}
uint32_t finalIndex = mRanges.Length() - 1;
return mRanges[finalIndex].mEnd;
return mRanges[0].mStart;
}
double
TimeRanges::GetEndTime()
{
if (mRanges.IsEmpty()) {
return -1.0;
}
return mRanges[mRanges.Length() - 1].mEnd;
}
void

View File

@ -30,8 +30,11 @@ public:
void Add(double aStart, double aEnd);
// Returns the end time of the last range, or -1 if no ranges added.
double GetFinalEndTime();
// Returns the start time of the first range, or -1 if no ranges exist.
double GetStartTime();
// Returns the end time of the last range, or -1 if no ranges exist.
double GetEndTime();
// See http://www.whatwg.org/html/#normalized-timeranges-object
void Normalize();