bug 65750 - fix error with negative numerator in colspan calculations. sr=none, r=bernd.mielke.snafu.de.

This commit is contained in:
karnaze%netscape.com 2001-01-30 05:00:44 +00:00
Родитель e95bc5292e
Коммит b6d42b35d2
2 изменённых файлов: 12 добавлений и 10 удалений

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

@ -711,6 +711,7 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(PRInt32 aWidthInd
nscoord usedWidth = 0; nscoord usedWidth = 0;
// get the correct numerator in a similar fashion to getting the divisor // get the correct numerator in a similar fashion to getting the divisor
for (spanX = 0; spanX < aColSpan; spanX++) { for (spanX = 0; spanX < aColSpan; spanX++) {
if (usedWidth >= availWidth) break;
nsTableColFrame* colFrame = mTableFrame->GetColFrame(aColIndex + spanX); nsTableColFrame* colFrame = mTableFrame->GetColFrame(aColIndex + spanX);
if (!colFrame) continue; if (!colFrame) continue;
nscoord minWidth = colFrame->GetMinWidth(); nscoord minWidth = colFrame->GetMinWidth();
@ -744,14 +745,14 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(PRInt32 aWidthInd
if (LIMIT_PCT == aLimitType) { if (LIMIT_PCT == aLimitType) {
if (pctLimitTotal > 0) { if (pctLimitTotal > 0) {
divisor = pctTotal - pctMinTotal; divisor = pctTotal - pctMinTotal;
numerator = numeratorPct - minWidth; numerator = PR_MAX(numeratorPct - minWidth, 0);
} }
} }
// let fix cols reach their target // let fix cols reach their target
else if (LIMIT_FIX == aLimitType) { else if (LIMIT_FIX == aLimitType) {
if (fixLimitTotal > 0) { if (fixLimitTotal > 0) {
divisor = fixTotal - fixMinTotal; divisor = fixTotal - fixMinTotal;
numerator = numeratorFix - minWidth; numerator = PR_MAX(numeratorFix - minWidth, 0);
} }
} }
// let auto cols reach their target // let auto cols reach their target
@ -759,15 +760,15 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(PRInt32 aWidthInd
if (desLimitTotal > 0) { if (desLimitTotal > 0) {
if (autoDesTotal > 0) { // there were auto cols if (autoDesTotal > 0) { // there were auto cols
divisor = autoDesTotal - autoMinTotal; divisor = autoDesTotal - autoMinTotal;
numerator = numeratorAutoDes - minWidth; numerator = PR_MAX(numeratorAutoDes - minWidth, 0);
} }
else if (fixTotal > 0) { // there were fix cols but no auto else if (fixTotal > 0) { // there were fix cols but no auto
divisor = fixTotal - fixMinTotal; divisor = fixTotal - fixMinTotal;
numerator = numeratorFix - minWidth; numerator = PR_MAX(numeratorFix - minWidth, 0);
} }
else if (pctTotal > 0) { // there were only pct cols else if (pctTotal > 0) { // there were only pct cols
divisor = pctTotal - pctMinTotal; divisor = pctTotal - pctMinTotal;
numerator = numeratorPct - minWidth; numerator = PR_MAX(numeratorPct - minWidth, 0);
} }
else continue; else continue;
} }

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

@ -711,6 +711,7 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(PRInt32 aWidthInd
nscoord usedWidth = 0; nscoord usedWidth = 0;
// get the correct numerator in a similar fashion to getting the divisor // get the correct numerator in a similar fashion to getting the divisor
for (spanX = 0; spanX < aColSpan; spanX++) { for (spanX = 0; spanX < aColSpan; spanX++) {
if (usedWidth >= availWidth) break;
nsTableColFrame* colFrame = mTableFrame->GetColFrame(aColIndex + spanX); nsTableColFrame* colFrame = mTableFrame->GetColFrame(aColIndex + spanX);
if (!colFrame) continue; if (!colFrame) continue;
nscoord minWidth = colFrame->GetMinWidth(); nscoord minWidth = colFrame->GetMinWidth();
@ -744,14 +745,14 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(PRInt32 aWidthInd
if (LIMIT_PCT == aLimitType) { if (LIMIT_PCT == aLimitType) {
if (pctLimitTotal > 0) { if (pctLimitTotal > 0) {
divisor = pctTotal - pctMinTotal; divisor = pctTotal - pctMinTotal;
numerator = numeratorPct - minWidth; numerator = PR_MAX(numeratorPct - minWidth, 0);
} }
} }
// let fix cols reach their target // let fix cols reach their target
else if (LIMIT_FIX == aLimitType) { else if (LIMIT_FIX == aLimitType) {
if (fixLimitTotal > 0) { if (fixLimitTotal > 0) {
divisor = fixTotal - fixMinTotal; divisor = fixTotal - fixMinTotal;
numerator = numeratorFix - minWidth; numerator = PR_MAX(numeratorFix - minWidth, 0);
} }
} }
// let auto cols reach their target // let auto cols reach their target
@ -759,15 +760,15 @@ BasicTableLayoutStrategy::ComputeNonPctColspanWidths(PRInt32 aWidthInd
if (desLimitTotal > 0) { if (desLimitTotal > 0) {
if (autoDesTotal > 0) { // there were auto cols if (autoDesTotal > 0) { // there were auto cols
divisor = autoDesTotal - autoMinTotal; divisor = autoDesTotal - autoMinTotal;
numerator = numeratorAutoDes - minWidth; numerator = PR_MAX(numeratorAutoDes - minWidth, 0);
} }
else if (fixTotal > 0) { // there were fix cols but no auto else if (fixTotal > 0) { // there were fix cols but no auto
divisor = fixTotal - fixMinTotal; divisor = fixTotal - fixMinTotal;
numerator = numeratorFix - minWidth; numerator = PR_MAX(numeratorFix - minWidth, 0);
} }
else if (pctTotal > 0) { // there were only pct cols else if (pctTotal > 0) { // there were only pct cols
divisor = pctTotal - pctMinTotal; divisor = pctTotal - pctMinTotal;
numerator = numeratorPct - minWidth; numerator = PR_MAX(numeratorPct - minWidth, 0);
} }
else continue; else continue;
} }