Bug 402893: don't scale up col prefWidth by % if it's nscoord_MAX. r+sr=roc, a=mtschrep
authordholbert@cs.stanford.edu
Thu, 15 Nov 2007 09:59:49 -0800
changeset 8041 de94472e93a93eac40b54fc1aecd50e158320e0c
parent 8040 30202aaba3a11b24464c2176b2d25b1e4f0789fe
child 8042 99b6c36ac21a904a315a85e5e99335feeb7bdec3
push idunknown
push userunknown
push dateunknown
reviewersmtschrep
bugs402893
milestone1.9b2pre
Bug 402893: don't scale up col prefWidth by % if it's nscoord_MAX. r+sr=roc, a=mtschrep
layout/tables/BasicTableLayoutStrategy.cpp
--- a/layout/tables/BasicTableLayoutStrategy.cpp
+++ b/layout/tables/BasicTableLayoutStrategy.cpp
@@ -606,18 +606,20 @@ BasicTableLayoutStrategy::ComputeIntrins
         }
         min += colFrame->GetMinCoord();
         pref = NSCoordSaturatingAdd(pref, colFrame->GetPrefCoord());
 
         // Percentages are of the table, so we have to reverse them for
         // intrinsic widths.
         float p = colFrame->GetPrefPercent();
         if (p > 0.0f) {
-            nscoord new_small_pct_expand =
-                nscoord(float(colFrame->GetPrefCoord()) / p);
+            nscoord colPref = colFrame->GetPrefCoord();
+            nscoord new_small_pct_expand = 
+                (colPref == nscoord_MAX ?
+                 nscoord_MAX : nscoord(float(colPref) / p));
             if (new_small_pct_expand > max_small_pct_pref) {
                 max_small_pct_pref = new_small_pct_expand;
             }
             pct_total += p;
         } else {
             nonpct_pref_total = NSCoordSaturatingAdd(nonpct_pref_total, 
                                                      colFrame->GetPrefCoord());
         }