Bug 398157: Fix nscoord_MAX arithmetic using NSCoordSaturatingSubtract. r=roc sr=roc a=roc
--- 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.
*