Bug 1227396: P5. Make Interval::Span ignore empty interval. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 25 Nov 2015 16:37:34 +1100
changeset 274535 b0df12f3df0d8e37e1f3ee996bbbc0f752e83d43
parent 274534 5ececa0775416a4a9f891567210df03ce7667a5f
child 274536 fbe31e1d14f98f0f898248b74a3d7a00bde8b825
push id68621
push userjyavenard@mozilla.com
push dateMon, 30 Nov 2015 00:49:17 +0000
treeherdermozilla-inbound@fd4d78b89cc0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1227396
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1227396: P5. Make Interval::Span ignore empty interval. r=gerald An interval with a length of 0 doesn't really exist and will be removed when used in an IntervalSet. As such, calculating a Span with an empty intervals didn't really make sense
dom/media/Intervals.h
--- a/dom/media/Intervals.h
+++ b/dom/media/Intervals.h
@@ -183,16 +183,19 @@ public:
 
   bool LeftOf(const SelfType& aOther) const
   {
     return mEnd - mFuzz <= aOther.mStart + aOther.mFuzz;
   }
 
   SelfType Span(const SelfType& aOther) const
   {
+    if (IsEmpty()) {
+      return aOther;
+    }
     SelfType result(*this);
     if (aOther.mStart < mStart) {
       result.mStart = aOther.mStart;
     }
     if (mEnd < aOther.mEnd) {
       result.mEnd = aOther.mEnd;
     }
     if (mFuzz < aOther.mFuzz) {