Bug 1298206 - Make IntersectMaybeRects usable for Maybe<nsRect>. r?botond
MozReview-Commit-ID: 4OJQj206gI2
--- 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));
}