tables were not properly respecting maxElementSize in cells with colspan. now they do.

This commit is contained in:
buster@netscape.com
1998-11-02 22:19:17 +00:00
parent 0e7ad8a35f
commit 9ceb22dd6b
2 changed files with 18 additions and 10 deletions
@@ -415,7 +415,8 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
if (PR_TRUE==okToAdd)
{
ColSpanStruct *colSpanInfo = new ColSpanStruct(colSpan, colIndex, width);
nscoord colwidth=PR_MAX(width, cellMinWidth);
ColSpanStruct *colSpanInfo = new ColSpanStruct(colSpan, colIndex, colwidth);
if (nsnull==colSpanList)
colSpanList = new nsVoidArray();
colSpanList->AppendElement(colSpanInfo);
@@ -791,17 +792,19 @@ void BasicTableLayoutStrategy::DistributeFixedSpace(nsVoidArray *aColSpanList)
mTableFrame->GetColumnFrame(colIndex+i, colFrame);
float percent;
percent = ((float)(colFrame->GetEffectiveMaxColWidth()))/((float)totalEffectiveWidth);
nscoord newColWidth = (nscoord)(totalColWidth*percent);
nscoord newColWidth = NSToCoordRound(((float)totalColWidth)*percent);
nscoord minColWidth = colFrame->GetEffectiveMinColWidth();
nscoord oldColWidth = mTableFrame->GetColumnWidth(colIndex+i);
if (newColWidth>minColWidth)
{
if (gsDebug==PR_TRUE)
{
printf(" assigning fixed col width for spanning cells: column %d set to %d\n",
colIndex+i, newColWidth);
printf(" minCW = %d oldCW = %d\n", minColWidth, oldColWidth);
}
mTableFrame->SetColumnWidth(colIndex+i, newColWidth);
colFrame->SetEffectiveMaxColWidth(newColWidth);
mMaxTableWidth += (newColWidth-oldColWidth);
}
}
}
@@ -1278,8 +1281,9 @@ PRBool BasicTableLayoutStrategy::BalanceColumnsTableFits(const nsHTMLReflowState
}
else
{ // need to maintain this so we know how much we have left over at the end
mTableFrame->SetColumnWidth(colIndex, colFrame->GetMaxColWidth());
widthOfFixedTableColumns += colFrame->GetMaxColWidth() + colInset;
nscoord maxEffectiveColWidth = colFrame->GetEffectiveMaxColWidth();
mTableFrame->SetColumnWidth(colIndex, maxEffectiveColWidth);
widthOfFixedTableColumns += maxEffectiveColWidth + colInset;
}
tableWidth += mTableFrame->GetColumnWidth(colIndex) + colInset;
}