ables were not correctly applying the min width of the content of cells
that had col spans in some cases.  In this case, the nested table was specified
as being too narrow for the content.  There were 4 columns each with width=25%
in the first row, and in the next row a single cell with colspan=4 and whose
content min size was wider than the specified table width.
This commit is contained in:
buster%netscape.com 1998-10-23 19:56:11 +00:00
Родитель fe75b83cbd
Коммит c4b345b782
4 изменённых файлов: 64 добавлений и 60 удалений

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

@ -30,7 +30,7 @@ NS_DEF_PTR(nsIStyleContext);
#ifdef NS_DEBUG
static PRBool gsDebug = PR_FALSE;
static PRBool gsDebug = PR_TRUE;
#else
static const PRBool gsDebug = PR_FALSE;
#endif
@ -498,7 +498,7 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
PRInt32 numAutoColumns=0;
PRInt32 *autoColumns=nsnull;
mTableFrame->GetColumnsByType(eStyleUnit_Auto, numAutoColumns, autoColumns);
if (0==numAutoColumns && 0==numProvisionalFixedColumns)
if (0&&(0==numAutoColumns && 0==numProvisionalFixedColumns))
{ //table fully specified, so no need to do any extra work here
PRInt32 spanCount = spanList->Count();
// go through the list backwards so we can delete easily
@ -543,8 +543,6 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
nsTableColFrame *colFrame = mTableFrame->GetColFrame(colIndex);
nscoord colMinWidth = colFrame->GetMinColWidth();
if (nsTableColFrame::eWIDTH_SOURCE_CELL!=colFrame->GetWidthSource())
{
// compute the spanning cell's contribution to the column min width
// this is the "adjusted" column width, used in SetTableToMinWidth
nscoord spanCellMinWidth;
@ -569,6 +567,10 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
}
}
// only compute the col spanner's contribution to the desired cell width
// if the width is from a col spanning cell
if (nsTableColFrame::eWIDTH_SOURCE_CELL!=colFrame->GetWidthSource())
{
// compute the spanning cell's contribution to the column max width
nscoord colMaxWidth = colFrame->GetMaxColWidth();
nscoord spanCellMaxWidth;
@ -833,8 +835,8 @@ PRBool BasicTableLayoutStrategy::BalanceProportionalColumns(const nsHTMLReflowSt
}
else if (mMinTableWidth >= actualMaxWidth)
{ // the table doesn't fit in the available space
if (gsDebug) printf (" * auto table minTW does not fit, calling SetColumnsToMinWidth\n");
result = SetColumnsToMinWidth();
if (gsDebug) printf (" * auto table minTW does not fit, calling BalanceColumnsTableDoesNotFit\n");
result = BalanceColumnsTableDoesNotFit();
}
else if (mMaxTableWidth <= actualMaxWidth)
{ // the max width of the table fits comfortably in the available space
@ -853,7 +855,7 @@ PRBool BasicTableLayoutStrategy::BalanceProportionalColumns(const nsHTMLReflowSt
}
// the table doesn't fit, so squeeze every column down to its minimum
PRBool BasicTableLayoutStrategy::SetColumnsToMinWidth()
PRBool BasicTableLayoutStrategy::BalanceColumnsTableDoesNotFit()
{
PRBool result = PR_TRUE;

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

@ -148,7 +148,7 @@ protected:
*
* @return PR_TRUE if all is well, PR_FALSE if there was an unrecoverable error
*/
virtual PRBool SetColumnsToMinWidth();
virtual PRBool BalanceColumnsTableDoesNotFit();
/** assign the maximum allowed width for each column that has proportional width.
* Typically called when the desired max table width fits in the available space.

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

@ -30,7 +30,7 @@ NS_DEF_PTR(nsIStyleContext);
#ifdef NS_DEBUG
static PRBool gsDebug = PR_FALSE;
static PRBool gsDebug = PR_TRUE;
#else
static const PRBool gsDebug = PR_FALSE;
#endif
@ -498,7 +498,7 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
PRInt32 numAutoColumns=0;
PRInt32 *autoColumns=nsnull;
mTableFrame->GetColumnsByType(eStyleUnit_Auto, numAutoColumns, autoColumns);
if (0==numAutoColumns && 0==numProvisionalFixedColumns)
if (0&&(0==numAutoColumns && 0==numProvisionalFixedColumns))
{ //table fully specified, so no need to do any extra work here
PRInt32 spanCount = spanList->Count();
// go through the list backwards so we can delete easily
@ -543,8 +543,6 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
nsTableColFrame *colFrame = mTableFrame->GetColFrame(colIndex);
nscoord colMinWidth = colFrame->GetMinColWidth();
if (nsTableColFrame::eWIDTH_SOURCE_CELL!=colFrame->GetWidthSource())
{
// compute the spanning cell's contribution to the column min width
// this is the "adjusted" column width, used in SetTableToMinWidth
nscoord spanCellMinWidth;
@ -569,6 +567,10 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths()
}
}
// only compute the col spanner's contribution to the desired cell width
// if the width is from a col spanning cell
if (nsTableColFrame::eWIDTH_SOURCE_CELL!=colFrame->GetWidthSource())
{
// compute the spanning cell's contribution to the column max width
nscoord colMaxWidth = colFrame->GetMaxColWidth();
nscoord spanCellMaxWidth;
@ -833,8 +835,8 @@ PRBool BasicTableLayoutStrategy::BalanceProportionalColumns(const nsHTMLReflowSt
}
else if (mMinTableWidth >= actualMaxWidth)
{ // the table doesn't fit in the available space
if (gsDebug) printf (" * auto table minTW does not fit, calling SetColumnsToMinWidth\n");
result = SetColumnsToMinWidth();
if (gsDebug) printf (" * auto table minTW does not fit, calling BalanceColumnsTableDoesNotFit\n");
result = BalanceColumnsTableDoesNotFit();
}
else if (mMaxTableWidth <= actualMaxWidth)
{ // the max width of the table fits comfortably in the available space
@ -853,7 +855,7 @@ PRBool BasicTableLayoutStrategy::BalanceProportionalColumns(const nsHTMLReflowSt
}
// the table doesn't fit, so squeeze every column down to its minimum
PRBool BasicTableLayoutStrategy::SetColumnsToMinWidth()
PRBool BasicTableLayoutStrategy::BalanceColumnsTableDoesNotFit()
{
PRBool result = PR_TRUE;

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

@ -148,7 +148,7 @@ protected:
*
* @return PR_TRUE if all is well, PR_FALSE if there was an unrecoverable error
*/
virtual PRBool SetColumnsToMinWidth();
virtual PRBool BalanceColumnsTableDoesNotFit();
/** assign the maximum allowed width for each column that has proportional width.
* Typically called when the desired max table width fits in the available space.