Bug 413180: Stop distributing span pct-width to cols when there are only 0-width cols left. r+sr=dbaron a=beltzner

This commit is contained in:
dholbert@cs.stanford.edu 2008-02-22 09:15:27 -08:00
parent 569b5e7d24
commit 356cf160e5
3 changed files with 30 additions and 4 deletions

View File

@ -573,16 +573,14 @@ BasicTableLayoutStrategy::DistributePctWidthToColumns(float aSpanPrefPct,
continue;
}
// the percentage width (only to columns that don't
// already have percentage widths, in proportion to
// the existing pref widths)
float allocatedPct = 0.0f;
if (scolFrame->GetPrefPercent() == 0.0f) {
NS_ASSERTION((!spanHasNonPctPref ||
nonPctTotalPrefWidth != 0) &&
nonPctColCount != 0,
"should not be zero if we haven't allocated "
"all pref percent");
float allocatedPct; // % width to be given to this column
if (spanHasNonPctPref) {
// Group so we're multiplying by 1.0f when we need
// to use up aSpanPrefPct.
@ -601,6 +599,16 @@ BasicTableLayoutStrategy::DistributePctWidthToColumns(float aSpanPrefPct,
aSpanPrefPct -= allocatedPct;
nonPctTotalPrefWidth -= scolFrame->GetPrefCoord();
--nonPctColCount;
if (!aSpanPrefPct) {
// No more span-percent-width to distribute --> we're done.
NS_ASSERTION(spanHasNonPctPref ?
nonPctTotalPrefWidth == 0 :
nonPctColCount == 0,
"No more pct width to distribute, but there are "
"still cols that need some.");
return;
}
}
}
}

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<table>
<tr>
<td style="width: 9%" colspan="2"></td>
</tr>
<tr>
<td></td>
</tr>
</table>
</body>
</html>

View File

@ -43,3 +43,4 @@ load 403249-1.html
load 403579-1.html
load 404301-1.xhtml
load 411582.xhtml
load 413180-1.html