fix for distributing spanned width that is less than the column minimums it spans.

This commit is contained in:
buster%netscape.com 1998-07-28 00:23:01 +00:00
Родитель 331200110b
Коммит 5cb940407a
2 изменённых файлов: 28 добавлений и 18 удалений

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

@ -687,12 +687,18 @@ void BasicTableLayoutStrategy::DistributeFixedSpace(nsVoidArray *aColSpanList)
mTableFrame->GetColumnFrame(colIndex+i, colFrame); mTableFrame->GetColumnFrame(colIndex+i, colFrame);
float percent; float percent;
percent = ((float)(colFrame->GetEffectiveMaxColWidth()))/((float)totalEffectiveWidth); percent = ((float)(colFrame->GetEffectiveMaxColWidth()))/((float)totalEffectiveWidth);
nscoord colWidth = (nscoord)(totalColWidth*percent); nscoord newColWidth = (nscoord)(totalColWidth*percent);
if (gsDebug==PR_TRUE) nscoord minColWidth = colFrame->GetEffectiveMinColWidth();
printf(" assigning fixed col width for spanning cells: column %d set to %d\n", nscoord oldColWidth = mTableFrame->GetColumnWidth(colIndex+i);
colIndex+i, colWidth); if (newColWidth>minColWidth)
mTableFrame->SetColumnWidth(colIndex+i, colWidth); {
colFrame->SetMaxColWidth(colWidth); if (gsDebug==PR_TRUE)
printf(" assigning fixed col width for spanning cells: column %d set to %d\n",
colIndex+i, newColWidth);
mTableFrame->SetColumnWidth(colIndex+i, newColWidth);
colFrame->SetEffectiveMaxColWidth(newColWidth);
mMaxTableWidth += (newColWidth-oldColWidth);
}
} }
} }
} }
@ -1176,7 +1182,6 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(const nsReflowState& aR
printf (" 3 proportional step 2: col %d given %d proportion of remaining space %d, set to width = %d\n", printf (" 3 proportional step 2: col %d given %d proportion of remaining space %d, set to width = %d\n",
info->mColIndex, info->mProportion, widthRemaining, computedColWidth); info->mColIndex, info->mProportion, widthRemaining, computedColWidth);
tableWidth += computedColWidth; tableWidth += computedColWidth;
// effectiveColumnWidth = computedColWidth;
delete info; delete info;
} }
} }
@ -1551,8 +1556,8 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsReflowState&
if (maxColWidth < cellDesiredWidth) if (maxColWidth < cellDesiredWidth)
maxColWidth = cellDesiredWidth; maxColWidth = cellDesiredWidth;
// effectiveMaxColumnWidth is the width as if no cells with colspans existed // effectiveMaxColumnWidth is the width as if no cells with colspans existed
if ((1==colSpan) && (colFrame->GetEffectiveMaxColWidth() < maxColWidth)) // if ((1==colSpan) && (colFrame->GetEffectiveMaxColWidth() < maxColWidth))
colFrame->SetEffectiveMaxColWidth(cellDesiredWidth); // colFrame->SetEffectiveMaxColWidth(cellDesiredWidth);
if (gsDebug==PR_TRUE) if (gsDebug==PR_TRUE)
printf (" after cell %d, minColWidth=%d maxColWidth=%d effColWidth[%d]=%d,%d\n", printf (" after cell %d, minColWidth=%d maxColWidth=%d effColWidth[%d]=%d,%d\n",
rowIndex, minColWidth, maxColWidth, rowIndex, minColWidth, maxColWidth,

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

@ -687,12 +687,18 @@ void BasicTableLayoutStrategy::DistributeFixedSpace(nsVoidArray *aColSpanList)
mTableFrame->GetColumnFrame(colIndex+i, colFrame); mTableFrame->GetColumnFrame(colIndex+i, colFrame);
float percent; float percent;
percent = ((float)(colFrame->GetEffectiveMaxColWidth()))/((float)totalEffectiveWidth); percent = ((float)(colFrame->GetEffectiveMaxColWidth()))/((float)totalEffectiveWidth);
nscoord colWidth = (nscoord)(totalColWidth*percent); nscoord newColWidth = (nscoord)(totalColWidth*percent);
if (gsDebug==PR_TRUE) nscoord minColWidth = colFrame->GetEffectiveMinColWidth();
printf(" assigning fixed col width for spanning cells: column %d set to %d\n", nscoord oldColWidth = mTableFrame->GetColumnWidth(colIndex+i);
colIndex+i, colWidth); if (newColWidth>minColWidth)
mTableFrame->SetColumnWidth(colIndex+i, colWidth); {
colFrame->SetMaxColWidth(colWidth); if (gsDebug==PR_TRUE)
printf(" assigning fixed col width for spanning cells: column %d set to %d\n",
colIndex+i, newColWidth);
mTableFrame->SetColumnWidth(colIndex+i, newColWidth);
colFrame->SetEffectiveMaxColWidth(newColWidth);
mMaxTableWidth += (newColWidth-oldColWidth);
}
} }
} }
} }
@ -1176,7 +1182,6 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(const nsReflowState& aR
printf (" 3 proportional step 2: col %d given %d proportion of remaining space %d, set to width = %d\n", printf (" 3 proportional step 2: col %d given %d proportion of remaining space %d, set to width = %d\n",
info->mColIndex, info->mProportion, widthRemaining, computedColWidth); info->mColIndex, info->mProportion, widthRemaining, computedColWidth);
tableWidth += computedColWidth; tableWidth += computedColWidth;
// effectiveColumnWidth = computedColWidth;
delete info; delete info;
} }
} }
@ -1551,8 +1556,8 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsConstrained( const nsReflowState&
if (maxColWidth < cellDesiredWidth) if (maxColWidth < cellDesiredWidth)
maxColWidth = cellDesiredWidth; maxColWidth = cellDesiredWidth;
// effectiveMaxColumnWidth is the width as if no cells with colspans existed // effectiveMaxColumnWidth is the width as if no cells with colspans existed
if ((1==colSpan) && (colFrame->GetEffectiveMaxColWidth() < maxColWidth)) // if ((1==colSpan) && (colFrame->GetEffectiveMaxColWidth() < maxColWidth))
colFrame->SetEffectiveMaxColWidth(cellDesiredWidth); // colFrame->SetEffectiveMaxColWidth(cellDesiredWidth);
if (gsDebug==PR_TRUE) if (gsDebug==PR_TRUE)
printf (" after cell %d, minColWidth=%d maxColWidth=%d effColWidth[%d]=%d,%d\n", printf (" after cell %d, minColWidth=%d maxColWidth=%d effColWidth[%d]=%d,%d\n",
rowIndex, minColWidth, maxColWidth, rowIndex, minColWidth, maxColWidth,