Bug 1524890 - P2. Add Intersects methods. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 22 Feb 2019 09:18:04 +0000
changeset 518672 2b3f87f5d02c4dad01254642e40e445cfa467740
parent 518671 a00f0fd94fbd070f1ecb5948aa9082526a1ecd68
child 518673 22d4f90342efbe0893e22f4f32b725b95fcd731a
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1524890
milestone67.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 1524890 - P2. Add Intersects methods. r=gerald Differential Revision: https://phabricator.services.mozilla.com/D20160
dom/media/Intervals.h
--- a/dom/media/Intervals.h
+++ b/dom/media/Intervals.h
@@ -535,16 +535,44 @@ class IntervalSet {
     for (const auto& interval : mIntervals) {
       if (interval.ContainsWithStrictEnd(aInterval)) {
         return true;
       }
     }
     return false;
   }
 
+
+  bool Intersects(const ElemType& aInterval) const {
+    for (const auto& interval : mIntervals) {
+      if (interval.Intersects(aInterval)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  bool IntersectsStrict(const ElemType& aInterval) const {
+    for (const auto& interval : mIntervals) {
+      if (interval.IntersectsStrict(aInterval)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  bool IntersectsWithStrictEnd(const ElemType& aInterval) const {
+    for (const auto& interval : mIntervals) {
+      if (interval.IntersectsWithStrictEnd(aInterval)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
   // Shift all values by aOffset.
   SelfType& Shift(const T& aOffset) {
     for (auto& interval : mIntervals) {
       interval.mStart = interval.mStart + aOffset;
       interval.mEnd = interval.mEnd + aOffset;
     }
     return *this;
   }