diff --git a/dom/media/Intervals.h b/dom/media/Intervals.h index 8da5c8517705..9835eab0ab45 100644 --- a/dom/media/Intervals.h +++ b/dom/media/Intervals.h @@ -88,7 +88,6 @@ class Interval { return SelfType(mStart + aVal, mEnd + aVal, mFuzz); } - // Basic interval arithmetic operator definition. SelfType operator-(const SelfType& aOther) const { return SelfType(mStart - aOther.mEnd, mEnd - aOther.mStart, mFuzz + aOther.mFuzz); @@ -98,6 +97,32 @@ class Interval { return SelfType(mStart - aVal, mEnd - aVal, mFuzz); } + SelfType& operator+=(const SelfType& aOther) { + mStart += aOther.mStart; + mEnd += aOther.mEnd; + mFuzz += aOther.mFuzz; + return *this; + } + + SelfType& operator+=(const T& aVal) { + mStart += aVal; + mEnd += aVal; + return *this; + } + + SelfType& operator-=(const SelfType& aOther) { + mStart -= aOther.mStart; + mEnd -= aOther.mEnd; + mFuzz += aOther.mFuzz; + return *this; + } + + SelfType& operator-=(const T& aVal) { + mStart -= aVal; + mEnd -= aVal; + return *this; + } + bool operator==(const SelfType& aOther) const { return mStart == aOther.mStart && mEnd == aOther.mEnd; } @@ -540,7 +565,6 @@ class IntervalSet { return false; } - bool Intersects(const ElemType& aInterval) const { for (const auto& interval : mIntervals) { if (interval.Intersects(aInterval)) {