Bug 1383492: stylo: Change nscoord_MAX to 1<<30 - 1 ; r=emilio,dbaron
authorManish Goregaokar <manishearth@gmail.com>
Tue, 25 Jul 2017 14:36:33 -0700
changeset 420244 7fbc3c5786d1836f628b637515a718909cd34969
parent 420243 f89500a307f605bf1bd2e05e913324d793f43d3b
child 420245 c7f314bfb6f12775e54b75e0915a56bb8e77825e
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio, dbaron
bugs1383492
milestone56.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 1383492: stylo: Change nscoord_MAX to 1<<30 - 1 ; r=emilio,dbaron nscoord_MAX is (1<<30) so that we can check for overflow *after* adding two nscoords. However, (nscoord_MAX + nscoord_MAX) will still overflow. Subtracting one makes this no longer possible. MozReview-Commit-ID: BtbQRMp5kWm
gfx/src/nsCoord.h
layout/base/crashtests/crashtests.list
layout/base/nsLayoutUtils.cpp
layout/generic/crashtests/crashtests.list
layout/svg/crashtests/crashtests.list
layout/xul/crashtests/crashtests.list
--- a/gfx/src/nsCoord.h
+++ b/gfx/src/nsCoord.h
@@ -41,17 +41,17 @@ inline bool NS_IEEEIsNan(float aF) {
     (pun.mBits & 0x007FFFFF) != 0;
 }
 
 #ifdef NS_COORD_IS_FLOAT
 typedef float nscoord;
 #define nscoord_MAX NS_IEEEPositiveInfinity()
 #else
 typedef int32_t nscoord;
-#define nscoord_MAX nscoord(1 << 30)
+#define nscoord_MAX nscoord((1 << 30) - 1)
 #endif
 
 #define nscoord_MIN (-nscoord_MAX)
 
 inline void VERIFY_COORD(nscoord aCoord) {
 #ifdef NS_COORD_IS_FLOAT
   NS_ASSERTION(floorf(aCoord) == aCoord,
                "Coords cannot have fractions");
@@ -127,18 +127,18 @@ inline nscoord _nscoordSaturatingMultipl
     MOZ_ASSERT(aScale >= 0.0f,
                "negative scaling factors must be handled manually");
   }
 #ifdef NS_COORD_IS_FLOAT
   return floorf(aCoord * aScale);
 #else
   float product = aCoord * aScale;
   if (requireNotNegative ? aCoord > 0 : (aCoord > 0) == (aScale > 0))
-    return NSToCoordRoundWithClamp(std::min<float>(nscoord_MAX, product));
-  return NSToCoordRoundWithClamp(std::max<float>(nscoord_MIN, product));
+    return NSToCoordRoundWithClamp(std::min<float>((float)nscoord_MAX, product));
+  return NSToCoordRoundWithClamp(std::max<float>((float)nscoord_MIN, product));
 #endif
 }
 
 /**
  * Returns aCoord * aScale, capping the product to nscoord_MAX or nscoord_MIN as
  * appropriate for the sign of aCoord.  This method requires aScale to not be
  * negative; use this method when you know that aScale should never be
  * negative to get a sanity check of that invariant in debug builds.
--- a/layout/base/crashtests/crashtests.list
+++ b/layout/base/crashtests/crashtests.list
@@ -36,17 +36,17 @@ load 243519-1.html
 load 244490-1.html
 load 254367-1.html
 load 263359-1.html
 load 265027-1.html
 load 265736-1.html
 load 265736-2.html
 load 265899-1.html
 load 265973-1.html
-asserts(6-12) load 265986-1.html # Bug 512405
+asserts-if(!stylo,6-12) load 265986-1.html # Bug 512405 , bug 718883
 load 265999-1.html
 load 266222-1.html
 asserts(1-7) load 266360-1.html # bug 576358
 load 266445-1.html
 asserts(2) load 266445-2.html
 load 268157-1.html
 load 269566-1.html
 load 272647-1.html
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -2439,17 +2439,17 @@ static void ConstrainToCoordValues(float
   // We must also clamp aSize to {0,nscoord_MAX} since nsRect::Width/Height()
   // can't return a value greater than nscoord_MAX. If aSize is greater than
   // nscoord_MAX then we reduce it to nscoord_MAX while keeping the rect
   // centered:
   if (aSize > nscoord_MAX) {
     float excess = aSize - nscoord_MAX;
     excess /= 2;
     aStart += excess;
-    aSize = nscoord_MAX;
+    aSize = (float)nscoord_MAX;
   }
 }
 
 /**
  * Given a gfxFloat, constrains its value to be between nscoord_MIN and nscoord_MAX.
  *
  * @param aVal The value to constrain (in/out)
  */
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -136,17 +136,17 @@ load 387058-1.html
 load 387058-2.html
 load 387088-1.html
 load 387209-1.html
 load 387213-1.html
 load 387215-1.xhtml
 load 387219-1.xhtml
 load 387233-1.html
 load 387233-2.html
-load 387282-1.html
+asserts-if(stylo,2) load 387282-1.html
 load 388175-1.html
 load 388367-1.html
 load 388709-1.html
 load 389635-1.html
 load 390050-1.html
 load 390050-2.html
 load 390050-3.html
 load 390762-1.html
@@ -394,18 +394,18 @@ load 533379-1.html
 load 533379-2.html
 load 534082-1.html
 load 534366-1.html
 load 534366-2.html
 load 536692-1.xhtml
 load 537645.xhtml
 load 541277-1.html
 load 541277-2.html
-load 541714-1.html
-load 541714-2.html
+asserts-if(stylo,2) load 541714-1.html # bug 634161
+asserts-if(stylo,3) load 541714-2.html # bug 634161
 load 542136-1.html
 load 545571-1.html
 load 547338.xul
 load 547843-1.xhtml
 load 551635-1.html
 load 553504-1.xhtml
 load 564368-1.xhtml
 load 564968.xhtml
@@ -553,17 +553,17 @@ load 885009-1.html
 load 893496-1.html
 load 893523.html
 asserts(0-3) load 898871.html # bug 479160 - mostly OSX, sometimes Windows
 asserts(0-3) load 914501.html # bug 1144852 - all platforms
 load 914891.html
 load 915475.xhtml
 load 927558.html
 load 943509-1.html
-asserts(2-8) load 944909-1.html
+asserts-if(stylo,2-8) load 944909-1.html
 load 946167-1.html
 load 947158.html
 load 949932.html
 asserts-if(Android,0-1) load 964078.html # bug 989718
 load 970710.html
 load 973701-1.xhtml
 load 973701-2.xhtml
 load 986899.html
@@ -626,17 +626,17 @@ load outline-on-frameset.xhtml
 load summary-position-out-of-flow.html
 load text-overflow-bug666751-1.html
 load text-overflow-bug666751-2.html
 load text-overflow-bug670564.xhtml
 load text-overflow-bug671796.xhtml
 load text-overflow-bug713610.html
 load text-overflow-form-elements.html
 load text-overflow-iframe.html
-asserts-if(Android,2-4) asserts-if(!Android,4) load 1225005.html # bug 682647 and bug 448083
+asserts(1-4) load 1225005.html # bug 682647 and bug 448083
 load 1233191.html
 asserts-if(stylo,0-15) load 1271765.html # bug 1324684
 asserts(2) load 1272983-1.html # bug 586628
 asserts(2) load 1272983-2.html # bug 586628
 load 1275059.html
 load 1278007.html
 load 1278080.html
 load 1279814.html
--- a/layout/svg/crashtests/crashtests.list
+++ b/layout/svg/crashtests/crashtests.list
@@ -100,17 +100,17 @@ load 515288-1.html
 load 522394-1.svg
 load 522394-2.svg
 load 522394-3.svg
 load 566216-1.svg
 load 587336-1.html
 load 590291-1.svg
 load 601999-1.html
 load 605626-1.svg
-asserts(2) load 606914.xhtml # bug 606914
+asserts-if(!stylo,2) load 606914.xhtml # bug 606914, bug 718883
 load 610594-1.html
 load 610954-1.html
 load 612662-1.svg
 load 612662-2.svg
 load 612736-1.svg
 load 612736-2.svg
 load 614367-1.svg
 load 620034-1.html
--- a/layout/xul/crashtests/crashtests.list
+++ b/layout/xul/crashtests/crashtests.list
@@ -72,17 +72,17 @@ load 432058-1.xul
 load 432068-1.xul
 load 432068-2.xul
 load 433296-1.xul
 load 433429.xul
 load 434458-1.xul
 load 452185.html
 load 460900-1.xul
 load 464149-1.xul
-asserts-if(winWidget,1) asserts-if(Android,0-1) load 464407-1.xhtml # Bug 450974 on win, Bug 1267054 on Android
+asserts-if(winWidget,1) asserts-if(Android,0-1) asserts-if(stylo,0-1) load 464407-1.xhtml # Bug 450974 on win, Bug 1267054 on Android, bug 718883 for stylo
 load 467080.xul
 load 467481-1.xul
 load 470063-1.html
 load 470272.html
 load 472189.xul
 load 475133.html
 load 488210-1.xhtml
 load 495728-1.xul