Backout bug 1226627 part 2 (rev 673461c0b772) for Talos regressions on Android. r=me
authorMats Palmgren <mats@mozilla.com>
Mon, 30 Nov 2015 13:06:39 +0100
changeset 308869 53aa1492795419a9e18b9ba241bf45d0acca89b5
parent 308868 196f2f131c700004d900f0fc337516c507208fba
child 308870 6a8f7950ad63f19b5ad4c32dc101055b1d2da9a9
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1226627
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
Backout bug 1226627 part 2 (rev 673461c0b772) for Talos regressions on Android. r=me
gfx/src/nsCoord.h
--- a/gfx/src/nsCoord.h
+++ b/gfx/src/nsCoord.h
@@ -105,18 +105,16 @@ inline nscoord NSToCoordRoundWithClamp(f
 #ifndef NS_COORD_IS_FLOAT
   // Bounds-check before converting out of float, to avoid overflow
   if (aValue >= nscoord_MAX) {
     return nscoord_MAX;
   }
   if (aValue <= nscoord_MIN) {
     return nscoord_MIN;
   }
-  // NOTE: we can't replace the early returns above with fminf/fmaxf because
-  // NSToCoordRound(float(nscoord_MAX)) is negative on win32 (bug 1226627).
 #endif
   return NSToCoordRound(aValue);
 }
 
 /**
  * Returns aCoord * aScale, capping the product to nscoord_MAX or nscoord_MIN as
  * appropriate for the signs of aCoord and aScale.  If requireNotNegative is
  * true, this method will enforce that aScale is not negative; use that
@@ -256,18 +254,22 @@ inline nscoord NSToCoordFloor(double aVa
 {
   return nscoord(floor(aValue));
 }
 
 inline nscoord NSToCoordFloorClamped(float aValue)
 {
 #ifndef NS_COORD_IS_FLOAT
   // Bounds-check before converting out of float, to avoid overflow
-  aValue = fminf(aValue, nscoord_MAX);
-  aValue = fmaxf(aValue, nscoord_MIN);
+  if (aValue >= nscoord_MAX) {
+    return nscoord_MAX;
+  }
+  if (aValue <= nscoord_MIN) {
+    return nscoord_MIN;
+  }
 #endif
   return NSToCoordFloor(aValue);
 }
 
 inline nscoord NSToCoordCeil(float aValue)
 {
   return nscoord(ceilf(aValue));
 }
@@ -276,18 +278,22 @@ inline nscoord NSToCoordCeil(double aVal
 {
   return nscoord(ceil(aValue));
 }
 
 inline nscoord NSToCoordCeilClamped(double aValue)
 {
 #ifndef NS_COORD_IS_FLOAT
   // Bounds-check before converting out of double, to avoid overflow
-  aValue = fmin(aValue, nscoord_MAX);
-  aValue = fmax(aValue, nscoord_MIN);
+  if (aValue >= nscoord_MAX) {
+    return nscoord_MAX;
+  }
+  if (aValue <= nscoord_MIN) {
+    return nscoord_MIN;
+  }
 #endif
   return NSToCoordCeil(aValue);
 }
 
 // The NSToCoordTrunc* functions remove the fractional component of
 // aValue, and are thus equivalent to NSToCoordFloor* for positive
 // values and NSToCoordCeil* for negative values.
 
@@ -304,28 +310,36 @@ inline nscoord NSToCoordTrunc(double aVa
   // rules for float to integer conversion.
   return nscoord(aValue);
 }
 
 inline nscoord NSToCoordTruncClamped(float aValue)
 {
 #ifndef NS_COORD_IS_FLOAT
   // Bounds-check before converting out of float, to avoid overflow
-  aValue = fminf(aValue, nscoord_MAX);
-  aValue = fmaxf(aValue, nscoord_MIN);
+  if (aValue >= nscoord_MAX) {
+    return nscoord_MAX;
+  }
+  if (aValue <= nscoord_MIN) {
+    return nscoord_MIN;
+  }
 #endif
   return NSToCoordTrunc(aValue);
 }
 
 inline nscoord NSToCoordTruncClamped(double aValue)
 {
 #ifndef NS_COORD_IS_FLOAT
   // Bounds-check before converting out of double, to avoid overflow
-  aValue = fmin(aValue, nscoord_MAX);
-  aValue = fmax(aValue, nscoord_MIN);
+  if (aValue >= nscoord_MAX) {
+    return nscoord_MAX;
+  }
+  if (aValue <= nscoord_MIN) {
+    return nscoord_MIN;
+  }
 #endif
   return NSToCoordTrunc(aValue);
 }
 
 /*
  * Int Rounding Functions
  */
 inline int32_t NSToIntFloor(float aValue)