Fix logic error handling column-spanning cells with specified widths. b=374819 r+sr=roc a=vlad

git-svn-id: svn://10.0.0.236/trunk@222165 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dbaron%dbaron.org
2007-03-21 23:31:38 +00:00
parent b01b750a7e
commit 411f643f12

View File

@@ -399,6 +399,14 @@ BasicTableLayoutStrategy::ComputeColumnIntrinsicWidths(nsIRenderingContext* aRen
continue;
}
nscoord curPref;
if (info.hasSpecifiedWidth &&
!scolFrame->GetHasSpecifiedCoord()) {
curPref = scolFrame->GetMinCoord();
} else {
curPref = scolFrame->GetPrefCoord();
}
// the percentage width (only to columns that don't
// already have percentage widths, in proportion to
// the existing pref widths)
@@ -414,7 +422,7 @@ BasicTableLayoutStrategy::ComputeColumnIntrinsicWidths(nsIRenderingContext* aRen
// Group so we're multiplying by 1.0f when we need
// to use up info.prefPercent.
allocatedPct = info.prefPercent *
(float(scolFrame->GetPrefCoord()) /
(float(curPref) /
float(totalSNonPctPref));
} else {
// distribute equally when all pref widths are 0
@@ -427,8 +435,7 @@ BasicTableLayoutStrategy::ComputeColumnIntrinsicWidths(nsIRenderingContext* aRen
// existing pref width
float minRatio = 0.0f;
if (minWithinPref > 0) {
minRatio = float(scolFrame->GetPrefCoord() -
scolFrame->GetMinCoord()) /
minRatio = float(curPref - scolFrame->GetMinCoord()) /
float(totalSPref - totalSMin);
}
@@ -436,27 +443,18 @@ BasicTableLayoutStrategy::ComputeColumnIntrinsicWidths(nsIRenderingContext* aRen
// proportion to the existing pref widths)
float coordRatio; // for both min and pref
if (spanHasPref) {
if (scolFrame->GetPrefCoord() == 0) {
if (curPref == 0) {
// We might have already subtracted all of
// totalSPref.
coordRatio = 0.0f;
} else {
coordRatio = float(scolFrame->GetPrefCoord()) /
float(totalSPref);
coordRatio = float(curPref) / float(totalSPref);
}
} else {
// distribute equally when all pref widths are 0
coordRatio = 1.0f / float(scol_end - scol);
}
nscoord curPref;
if (info.hasSpecifiedWidth &&
!scolFrame->GetHasSpecifiedCoord()) {
curPref = scolFrame->GetMinCoord();
} else {
curPref = scolFrame->GetPrefCoord();
}
// combine the two min-width distributions, and record
// min and pref
nscoord allocatedMinWithinPref =