From 75acd77984cbb8c5f3aa850638f41b2e87ed6708 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Thu, 11 Jun 2015 15:49:49 +1000 Subject: [PATCH] Bug 1171330: P3. Add -=, - and * (with integer) operators to TimeUnit. r=mattwoodrow --HG-- extra : rebase_source : 2e74a69d9ee15e55276ba9e65b3422f415b44efd --- dom/media/TimeUnits.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dom/media/TimeUnits.h b/dom/media/TimeUnits.h index 4aee59b88e9e..d3e5f3d7876d 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 {