From a7b3246a3385cb6beecfc32558808844fcf85365 Mon Sep 17 00:00:00 2001 From: "karnaze%netscape.com" Date: Mon, 25 Oct 1999 22:49:51 +0000 Subject: [PATCH] bug 16284, 14159 nested auto table with percent cells was not growing auto table. nested coord or percent table was only getting min size. --- layout/html/table/src/BasicTableLayoutStrategy.cpp | 14 +++++++++----- layout/tables/BasicTableLayoutStrategy.cpp | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/layout/html/table/src/BasicTableLayoutStrategy.cpp b/layout/html/table/src/BasicTableLayoutStrategy.cpp index 9a3febe37779..9319005ebcfa 100644 --- a/layout/html/table/src/BasicTableLayoutStrategy.cpp +++ b/layout/html/table/src/BasicTableLayoutStrategy.cpp @@ -202,10 +202,14 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty colFrame->SetWidth(PCT, WIDTH_NOT_SET); colFrame->SetWidth(PCT_ADJ, WIDTH_NOT_SET); } - // set PCT and PCT_ADJ widths on col frames and for an auto table return + // set PCT and PCT_ADJ widths on col frames. An auto table returns // a new table width based on percent cells/cols if they exist - nscoord perAdjTableWidth = (maxWidth != NS_UNCONSTRAINEDSIZE) - ? AssignPercentageColumnWidths(maxWidth - mCellSpacingTotal, tableIsAutoWidth) : 0; + nscoord perAdjTableWidth = 0; + if ((NS_UNCONSTRAINEDSIZE != maxWidth) || (tableIsAutoWidth)) { + // for an auto width table, use a large basis just so that the quirky + // auto table sizing will get as big as it should + perAdjTableWidth = AssignPercentageColumnWidths(maxWidth - mCellSpacingTotal, tableIsAutoWidth); + } PRBool recomputedAdjMin = RecomputeAdjMinIfNecessary(); // set the table's columns to the min width @@ -310,8 +314,8 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty } } - // if this is a nested table and pass1 reflow, we are done - if (maxWidth == NS_UNCONSTRAINEDSIZE) { + // if this is a nested non auto table and pass1 reflow, we are done + if ((maxWidth == NS_UNCONSTRAINEDSIZE) && (!tableIsAutoWidth)) { return BCW_Wrapup(this, mTableFrame, allocTypes); } diff --git a/layout/tables/BasicTableLayoutStrategy.cpp b/layout/tables/BasicTableLayoutStrategy.cpp index 9a3febe37779..9319005ebcfa 100644 --- a/layout/tables/BasicTableLayoutStrategy.cpp +++ b/layout/tables/BasicTableLayoutStrategy.cpp @@ -202,10 +202,14 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty colFrame->SetWidth(PCT, WIDTH_NOT_SET); colFrame->SetWidth(PCT_ADJ, WIDTH_NOT_SET); } - // set PCT and PCT_ADJ widths on col frames and for an auto table return + // set PCT and PCT_ADJ widths on col frames. An auto table returns // a new table width based on percent cells/cols if they exist - nscoord perAdjTableWidth = (maxWidth != NS_UNCONSTRAINEDSIZE) - ? AssignPercentageColumnWidths(maxWidth - mCellSpacingTotal, tableIsAutoWidth) : 0; + nscoord perAdjTableWidth = 0; + if ((NS_UNCONSTRAINEDSIZE != maxWidth) || (tableIsAutoWidth)) { + // for an auto width table, use a large basis just so that the quirky + // auto table sizing will get as big as it should + perAdjTableWidth = AssignPercentageColumnWidths(maxWidth - mCellSpacingTotal, tableIsAutoWidth); + } PRBool recomputedAdjMin = RecomputeAdjMinIfNecessary(); // set the table's columns to the min width @@ -310,8 +314,8 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIStyleContext* aTableSty } } - // if this is a nested table and pass1 reflow, we are done - if (maxWidth == NS_UNCONSTRAINEDSIZE) { + // if this is a nested non auto table and pass1 reflow, we are done + if ((maxWidth == NS_UNCONSTRAINEDSIZE) && (!tableIsAutoWidth)) { return BCW_Wrapup(this, mTableFrame, allocTypes); }