Bug 1428348: Allow Set{Left,Right,Top,Bottom}Edge methods to compute negative width/height without asserting. r=bas.schouten draft
authorMilan Sreckovic <milan@mozilla.com>
Tue, 09 Jan 2018 11:24:37 -0500
changeset 717798 359dc88940a6f9d353b33d6b5a264dc88955157d
parent 717738 6f5fac320fcb6625603fa8a744ffa8523f8b3d71
child 745347 d7da96053d07c9db1fa9902c6cf14e15fce8e9b1
push id94780
push userbmo:milan@mozilla.com
push dateTue, 09 Jan 2018 16:25:31 +0000
reviewersbas.schouten
bugs1428348
milestone59.0a1
Bug 1428348: Allow Set{Left,Right,Top,Bottom}Edge methods to compute negative width/height without asserting. r=bas.schouten MozReview-Commit-ID: EOGgAvq4lPW
gfx/2d/BaseRect.h
--- a/gfx/2d/BaseRect.h
+++ b/gfx/2d/BaseRect.h
@@ -437,32 +437,28 @@ struct BaseRect {
       case eSideBottom: return YMost();
       case eSideLeft: return X();
     }
     MOZ_CRASH("GFX: Incomplete switch");
   }
 
   // Moves one edge of the rect without moving the opposite edge.
   void SetLeftEdge(T aX) {
-    MOZ_ASSERT(aX <= XMost());
     width = XMost() - aX;
     x = aX;
   }
-  void SetRightEdge(T aXMost) { 
-    MOZ_ASSERT(aXMost >= x);
-    width = aXMost - x; 
+  void SetRightEdge(T aXMost) {
+    width = aXMost - x;
   }
   void SetTopEdge(T aY) {
-    MOZ_ASSERT(aY <= YMost());
     height = YMost() - aY;
     y = aY;
   }
-  void SetBottomEdge(T aYMost) { 
-    MOZ_ASSERT(aYMost >= y);
-    height = aYMost - y; 
+  void SetBottomEdge(T aYMost) {
+    height = aYMost - y;
   }
   void Swap() {
     std::swap(x, y);
     std::swap(width, height);
   }
 
   // Round the rectangle edges to integer coordinates, such that the rounded
   // rectangle has the same set of pixel centers as the original rectangle.