Bug 398157: Fix nscoord_MAX arithmetic using NSCoordSaturatingSubtract. r=roc sr=roc a=roc
authordholbert@cs.stanford.edu
Mon, 01 Oct 2007 14:44:50 -0700
changeset 6495 6dbd65c480ec3ce4029b0ca82b5e9fab93209f0c
parent 6494 7fa0f43f3db5ab4c2beb7d05d18bfaec736c1677
child 6496 8d6e108f1046099b4693d755c617c2d1fb3a1c53
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersroc, roc, roc
bugs398157
milestone1.9a9pre
Bug 398157: Fix nscoord_MAX arithmetic using NSCoordSaturatingSubtract. r=roc sr=roc a=roc
layout/tables/BasicTableLayoutStrategy.cpp
--- a/layout/tables/BasicTableLayoutStrategy.cpp
+++ b/layout/tables/BasicTableLayoutStrategy.cpp
@@ -694,17 +694,17 @@ BasicTableLayoutStrategy::ComputeColumnW
 
     // border-spacing isn't part of the basis for percentages.
     nscoord subtract = spacing;
     for (PRInt32 col = 0; col < colCount; ++col) {
         if (mTableFrame->GetNumCellsOriginatingInCol(col)) {
             subtract += spacing;
         }
     }
-    width -= subtract;
+    width = NSCoordSaturatingSubtract(width, subtract, nscoord_MAX);
     min -= subtract;
 
     // XXX is |width| the right basis for percentage widths?
 
     /*
      * The goal of this function is to allocate |width| to the columns
      * by making an appropriate SetFinalWidth call to each column.
      *