From 160b0d5110681a2bd26d6da009c82ec1dea44af1 Mon Sep 17 00:00:00 2001 From: "karnaze%netscape.com" Date: Sat, 24 Mar 2001 23:15:49 +0000 Subject: [PATCH] bug 72396 - fix CalcBorderBoxWidth to not use unconstrained width. Fix column balancing to be skipped when there is an unconstrained width. sr=attinasi --- layout/html/table/src/BasicTableLayoutStrategy.cpp | 5 +++-- layout/html/table/src/nsTableFrame.cpp | 2 +- layout/tables/BasicTableLayoutStrategy.cpp | 5 +++-- layout/tables/nsTableFrame.cpp | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/layout/html/table/src/BasicTableLayoutStrategy.cpp b/layout/html/table/src/BasicTableLayoutStrategy.cpp index f19a4bb26518..a128f01495f2 100644 --- a/layout/html/table/src/BasicTableLayoutStrategy.cpp +++ b/layout/html/table/src/BasicTableLayoutStrategy.cpp @@ -212,8 +212,9 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresCont // determine if the table is auto/fixed and get the fixed width if available nscoord maxWidth = mTableFrame->CalcBorderBoxWidth(aReflowState); - if (NS_UNCONSTRAINEDSIZE == maxWidth) { - NS_ASSERTION(PR_FALSE, "cannot balance with an unconstrained width"); + if (NS_UNCONSTRAINEDSIZE == maxWidth) { + maxWidth = PR_MIN(maxWidth, aReflowState.availableWidth); + NS_ASSERTION(NS_UNCONSTRAINEDSIZE != maxWidth, "cannot balance with an unconstrained width"); return PR_FALSE; } // initialize the col percent and cell percent values to 0. diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index 2364ded98b80..43078fde255b 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -3935,7 +3935,7 @@ nsTableFrame::CalcBorderBoxWidth(const nsHTMLReflowState& aState) if (eStyleUnit_Auto == aState.mStylePosition->mWidth.GetUnit()) { if (0 == width) { - width = NS_UNCONSTRAINEDSIZE; + width = aState.availableWidth; } if (NS_UNCONSTRAINEDSIZE != aState.availableWidth) { nsMargin margin(0,0,0,0); diff --git a/layout/tables/BasicTableLayoutStrategy.cpp b/layout/tables/BasicTableLayoutStrategy.cpp index f19a4bb26518..a128f01495f2 100644 --- a/layout/tables/BasicTableLayoutStrategy.cpp +++ b/layout/tables/BasicTableLayoutStrategy.cpp @@ -212,8 +212,9 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresCont // determine if the table is auto/fixed and get the fixed width if available nscoord maxWidth = mTableFrame->CalcBorderBoxWidth(aReflowState); - if (NS_UNCONSTRAINEDSIZE == maxWidth) { - NS_ASSERTION(PR_FALSE, "cannot balance with an unconstrained width"); + if (NS_UNCONSTRAINEDSIZE == maxWidth) { + maxWidth = PR_MIN(maxWidth, aReflowState.availableWidth); + NS_ASSERTION(NS_UNCONSTRAINEDSIZE != maxWidth, "cannot balance with an unconstrained width"); return PR_FALSE; } // initialize the col percent and cell percent values to 0. diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 2364ded98b80..43078fde255b 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -3935,7 +3935,7 @@ nsTableFrame::CalcBorderBoxWidth(const nsHTMLReflowState& aState) if (eStyleUnit_Auto == aState.mStylePosition->mWidth.GetUnit()) { if (0 == width) { - width = NS_UNCONSTRAINEDSIZE; + width = aState.availableWidth; } if (NS_UNCONSTRAINEDSIZE != aState.availableWidth) { nsMargin margin(0,0,0,0);