From 50553919ea45560bb76b00fb514e150a4a3e47e1 Mon Sep 17 00:00:00 2001 From: "karnaze%netscape.com" Date: Sun, 15 Sep 2002 01:59:21 +0000 Subject: [PATCH] bug 160014 - recalc cellspacing total when balancing. sr=kin, r=kmcclusk git-svn-id: svn://10.0.0.236/trunk@129631 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/html/table/src/BasicTableLayoutStrategy.cpp | 10 ++++++++++ mozilla/layout/tables/BasicTableLayoutStrategy.cpp | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp index 631403b298e..9e65945f869 100644 --- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp @@ -258,6 +258,10 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresCont maxWidth -= horOffset; maxWidth = PR_MAX(0, maxWidth); + // we will re-calc mCellSpacingTotal in case longer rows were added after Initialize was called + mCellSpacingTotal = 0; + nscoord spacingX = mTableFrame->GetCellSpacingX(); + PRInt32 numNonZeroWidthCols = 0; // set the table's columns to the min width nscoord minTableWidth = 0; @@ -272,6 +276,12 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresCont (colFrame->GetPctWidth() > 0) || (colFrame->GetWidth(MIN_PRO) > 0)) { numNonZeroWidthCols++; } + if (mTableFrame->GetNumCellsOriginatingInCol(colX) > 0) { + mCellSpacingTotal += spacingX; + } + } + if (mCellSpacingTotal > 0) { + mCellSpacingTotal += spacingX; // add last cell spacing on right } minTableWidth += mCellSpacingTotal; diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp index 631403b298e..9e65945f869 100644 --- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp @@ -258,6 +258,10 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresCont maxWidth -= horOffset; maxWidth = PR_MAX(0, maxWidth); + // we will re-calc mCellSpacingTotal in case longer rows were added after Initialize was called + mCellSpacingTotal = 0; + nscoord spacingX = mTableFrame->GetCellSpacingX(); + PRInt32 numNonZeroWidthCols = 0; // set the table's columns to the min width nscoord minTableWidth = 0; @@ -272,6 +276,12 @@ BasicTableLayoutStrategy::BalanceColumnWidths(nsIPresContext* aPresCont (colFrame->GetPctWidth() > 0) || (colFrame->GetWidth(MIN_PRO) > 0)) { numNonZeroWidthCols++; } + if (mTableFrame->GetNumCellsOriginatingInCol(colX) > 0) { + mCellSpacingTotal += spacingX; + } + } + if (mCellSpacingTotal > 0) { + mCellSpacingTotal += spacingX; // add last cell spacing on right } minTableWidth += mCellSpacingTotal;