From dd1669990b6f6b74a718b0e2688a67c12ebd2cda Mon Sep 17 00:00:00 2001 From: trav90 Date: Thu, 4 May 2017 02:19:45 -0500 Subject: [PATCH] Add -=, - and * (with integer) operators to TimeUnit --- dom/media/TimeUnits.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dom/media/TimeUnits.h b/dom/media/TimeUnits.h index 45c4787b85..483527698c 100644 --- a/dom/media/TimeUnits.h +++ b/dom/media/TimeUnits.h @@ -173,6 +173,21 @@ public: MOZ_ASSERT(!IsInfinite() && !aOther.IsInfinite()); return TimeUnit(mValue - aOther.mValue); } + TimeUnit& operator += (const TimeUnit& aOther) { + *this = *this + aOther; + return *this; + } + TimeUnit& operator -= (const TimeUnit& aOther) { + *this = *this - aOther; + return *this; + } + + friend TimeUnit operator* (int aVal, const TimeUnit& aUnit) { + return TimeUnit(aUnit.mValue * aVal); + } + friend TimeUnit operator* (const TimeUnit& aUnit, int aVal) { + return TimeUnit(aUnit.mValue * aVal); + } bool IsValid() const {