Bug 1298206 - Make IntersectMaybeRects usable for Maybe<nsRect>. r?botond draft
authorMarkus Stange <mstange@themasta.com>
Wed, 24 Aug 2016 17:40:58 -0400
changeset 405736 7b725f378de5f3e0b002462df8249d891e1a0093
parent 405735 0d9ed20b435e63b0ea1dd3109e75235e79acf0e9
child 405737 a0edab0d90b9d37306805f60f97a983dfaed2d97
push id27568
push usermstange@themasta.com
push dateThu, 25 Aug 2016 23:22:36 +0000
reviewersbotond
bugs1298206
milestone51.0a1
Bug 1298206 - Make IntersectMaybeRects usable for Maybe<nsRect>. r?botond MozReview-Commit-ID: 4OJQj206gI2
gfx/2d/Rect.h
--- a/gfx/2d/Rect.h
+++ b/gfx/2d/Rect.h
@@ -276,21 +276,20 @@ IntRectTyped<units> TruncatedToInt(const
 }
 
 template<class units>
 RectTyped<units> IntRectToRect(const IntRectTyped<units>& aRect)
 {
   return RectTyped<units>(aRect.x, aRect.y, aRect.width, aRect.height);
 }
 
-// Convenience function for intersecting two IntRects wrapped in Maybes.
-template <typename Units>
-Maybe<IntRectTyped<Units>>
-IntersectMaybeRects(const Maybe<IntRectTyped<Units>>& a,
-                    const Maybe<IntRectTyped<Units>>& b)
+// Convenience function for intersecting two rectangles wrapped in Maybes.
+template <typename T>
+Maybe<T>
+IntersectMaybeRects(const Maybe<T>& a, const Maybe<T>& b)
 {
   if (!a) {
     return b;
   } else if (!b) {
     return a;
   } else {
     return Some(a->Intersect(*b));
   }