Bug 403579: Don't scale up width by a pct when it's nscoord_MAX. Also, use NSCoordSaturating function with guess_pref since it could be nscoord_MAX. r+sr=roc, a=mtschrep

This commit is contained in:
dholbert@cs.stanford.edu 2007-11-15 10:04:16 -08:00
Родитель 0d23f498fd
Коммит 9fa5945e40
1 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -646,8 +646,10 @@ BasicTableLayoutStrategy::ComputeIntrinsicWidths(nsIRenderingContext* aRendering
// nested tables!)
}
} else {
nscoord large_pct_pref = nscoord(float(nonpct_pref_total) /
(1.0f - pct_total));
nscoord large_pct_pref =
(nonpct_pref_total == nscoord_MAX ?
nscoord_MAX :
nscoord(float(nonpct_pref_total) / (1.0f - pct_total)));
if (large_pct_pref > pref_pct_expand)
pref_pct_expand = large_pct_pref;
}
@ -782,7 +784,7 @@ BasicTableLayoutStrategy::ComputeColumnWidths(const nsHTMLReflowState& aReflowSt
if (val < min_width)
val = min_width;
guess_min_pct += val;
guess_pref += val;
guess_pref = NSCoordSaturatingAdd(guess_pref, val);
} else {
nscoord pref_width = colFrame->GetPrefCoord();
if (pref_width == nscoord_MAX) {