From 87d38283cabfc7b0712cdf40d6cd9a2be3aab905 Mon Sep 17 00:00:00 2001 From: "buster%netscape.com" Date: Wed, 22 Jul 1998 20:06:31 +0000 Subject: [PATCH] fixed-width columns now respected when their content desired width exceeds the specified width. git-svn-id: svn://10.0.0.236/trunk@6179 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/html/table/src/BasicTableLayoutStrategy.cpp | 9 ++++++--- mozilla/layout/tables/BasicTableLayoutStrategy.cpp | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp index d876ffeafce..302fb896073 100644 --- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp @@ -232,6 +232,7 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths() nscoord maxColWidth = 0; nscoord effectiveMinColumnWidth = 0; // min col width ignoring cells with colspans nscoord effectiveMaxColumnWidth = 0; // max col width ignoring cells with colspans + nscoord specifiedFixedColWidth = 0; // the width of the column if given stylistically (or via cell Width attribute) // Get column information nsTableColFrame *colFrame = mTableFrame->GetColFrame(colIndex); @@ -243,7 +244,6 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths() // Get fixed column width if it has one PRBool haveColWidth = PR_FALSE; - nscoord specifiedFixedColWidth=0; if (eStyleUnit_Coord==colPosition->mWidth.GetUnit()) { haveColWidth = PR_TRUE; @@ -375,7 +375,7 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths() // keep a running total of the amount of space taken up by all fixed-width columns if (PR_TRUE==haveColWidth) { - mFixedTableWidth += maxColWidth + colInset; + mFixedTableWidth += specifiedFixedColWidth + colInset; if (0==colIndex) mFixedTableWidth += colInset; } @@ -388,7 +388,10 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths() colFrame->SetMaxColWidth(effectiveMaxColumnWidth); colFrame->SetEffectiveMinColWidth(effectiveMinColumnWidth); colFrame->SetEffectiveMaxColWidth(effectiveMaxColumnWidth); - mTableFrame->SetColumnWidth(colIndex, effectiveMaxColumnWidth); + if (PR_TRUE==haveColWidth) + mTableFrame->SetColumnWidth(colIndex, specifiedFixedColWidth); + else + mTableFrame->SetColumnWidth(colIndex, effectiveMaxColumnWidth); // add col[i] metrics to the running totals for the table min/max width if (NS_UNCONSTRAINEDSIZE!=mMinTableWidth) diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp index d876ffeafce..302fb896073 100644 --- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp @@ -232,6 +232,7 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths() nscoord maxColWidth = 0; nscoord effectiveMinColumnWidth = 0; // min col width ignoring cells with colspans nscoord effectiveMaxColumnWidth = 0; // max col width ignoring cells with colspans + nscoord specifiedFixedColWidth = 0; // the width of the column if given stylistically (or via cell Width attribute) // Get column information nsTableColFrame *colFrame = mTableFrame->GetColFrame(colIndex); @@ -243,7 +244,6 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths() // Get fixed column width if it has one PRBool haveColWidth = PR_FALSE; - nscoord specifiedFixedColWidth=0; if (eStyleUnit_Coord==colPosition->mWidth.GetUnit()) { haveColWidth = PR_TRUE; @@ -375,7 +375,7 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths() // keep a running total of the amount of space taken up by all fixed-width columns if (PR_TRUE==haveColWidth) { - mFixedTableWidth += maxColWidth + colInset; + mFixedTableWidth += specifiedFixedColWidth + colInset; if (0==colIndex) mFixedTableWidth += colInset; } @@ -388,7 +388,10 @@ PRBool BasicTableLayoutStrategy::AssignPreliminaryColumnWidths() colFrame->SetMaxColWidth(effectiveMaxColumnWidth); colFrame->SetEffectiveMinColWidth(effectiveMinColumnWidth); colFrame->SetEffectiveMaxColWidth(effectiveMaxColumnWidth); - mTableFrame->SetColumnWidth(colIndex, effectiveMaxColumnWidth); + if (PR_TRUE==haveColWidth) + mTableFrame->SetColumnWidth(colIndex, specifiedFixedColWidth); + else + mTableFrame->SetColumnWidth(colIndex, effectiveMaxColumnWidth); // add col[i] metrics to the running totals for the table min/max width if (NS_UNCONSTRAINEDSIZE!=mMinTableWidth)