From badf0ce469077bc7771e5d306f921cd084fcf9b9 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Thu, 26 Aug 1999 10:23:49 +0000 Subject: [PATCH] Fix for bug 12887. git-svn-id: svn://10.0.0.236/trunk@44664 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/html/table/src/nsTableFrame.cpp | 17 +++++++++++++---- .../layout/html/table/src/nsTableOuterFrame.cpp | 3 +++ mozilla/layout/tables/nsTableFrame.cpp | 17 +++++++++++++---- mozilla/layout/tables/nsTableOuterFrame.cpp | 3 +++ 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index bebe80dd74f..12419e671ec 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -3894,11 +3894,14 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext& aPresContext NS_ASSERTION(mCellMap, "never ever call me until the cell map is built!"); nscoord result = aDefaultHeight; - nscoord tableSpecifiedHeight; + const nsStyleTable* tableStyle; + GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle); + nscoord tableSpecifiedHeight=-1; GetTableSpecifiedHeight(tableSpecifiedHeight, aReflowState); - if (-1 != tableSpecifiedHeight) { - if (tableSpecifiedHeight > aDefaultHeight) { - // proportionately distribute the excess height to each row + if (-1!=tableSpecifiedHeight) + { + if (tableSpecifiedHeight>aDefaultHeight) + { // proportionately distribute the excess height to each row result = tableSpecifiedHeight; nscoord excess = tableSpecifiedHeight - aDefaultHeight; nscoord sumOfRowHeights = 0; @@ -4940,6 +4943,12 @@ PRBool nsTableFrame::TableIsAutoWidth(nsTableFrame *aTableFrame, const nsHTMLReflowState& aReflowState, nscoord& aSpecifiedTableWidth) { + if (aReflowState.mComputedWidth > 0 && + aReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE) { + aSpecifiedTableWidth = aReflowState.mComputedWidth; + return PR_FALSE; + } + NS_ASSERTION(nsnull != aTableStyle, "bad arg - aTableStyle"); PRBool result = PR_TRUE; // the default if (aTableStyle) { diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp index ce87c805bd9..040401fa1df 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp @@ -915,6 +915,9 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext, // First reflow the inner table nsHTMLReflowState innerReflowState(aPresContext, aReflowState, mInnerTableFrame, nsSize(tableWidth, aReflowState.availableHeight)); + innerReflowState.mComputedWidth = aReflowState.mComputedWidth; + innerReflowState.mComputedHeight = aReflowState.mComputedHeight; + nsHTMLReflowMetrics innerSize(aDesiredSize.maxElementSize); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus); diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index bebe80dd74f..12419e671ec 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -3894,11 +3894,14 @@ nscoord nsTableFrame::ComputeDesiredHeight(nsIPresContext& aPresContext NS_ASSERTION(mCellMap, "never ever call me until the cell map is built!"); nscoord result = aDefaultHeight; - nscoord tableSpecifiedHeight; + const nsStyleTable* tableStyle; + GetStyleData(eStyleStruct_Table, (const nsStyleStruct *&)tableStyle); + nscoord tableSpecifiedHeight=-1; GetTableSpecifiedHeight(tableSpecifiedHeight, aReflowState); - if (-1 != tableSpecifiedHeight) { - if (tableSpecifiedHeight > aDefaultHeight) { - // proportionately distribute the excess height to each row + if (-1!=tableSpecifiedHeight) + { + if (tableSpecifiedHeight>aDefaultHeight) + { // proportionately distribute the excess height to each row result = tableSpecifiedHeight; nscoord excess = tableSpecifiedHeight - aDefaultHeight; nscoord sumOfRowHeights = 0; @@ -4940,6 +4943,12 @@ PRBool nsTableFrame::TableIsAutoWidth(nsTableFrame *aTableFrame, const nsHTMLReflowState& aReflowState, nscoord& aSpecifiedTableWidth) { + if (aReflowState.mComputedWidth > 0 && + aReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE) { + aSpecifiedTableWidth = aReflowState.mComputedWidth; + return PR_FALSE; + } + NS_ASSERTION(nsnull != aTableStyle, "bad arg - aTableStyle"); PRBool result = PR_TRUE; // the default if (aTableStyle) { diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index ce87c805bd9..040401fa1df 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/layout/tables/nsTableOuterFrame.cpp @@ -915,6 +915,9 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext& aPresContext, // First reflow the inner table nsHTMLReflowState innerReflowState(aPresContext, aReflowState, mInnerTableFrame, nsSize(tableWidth, aReflowState.availableHeight)); + innerReflowState.mComputedWidth = aReflowState.mComputedWidth; + innerReflowState.mComputedHeight = aReflowState.mComputedHeight; + nsHTMLReflowMetrics innerSize(aDesiredSize.maxElementSize); rv = ReflowChild(mInnerTableFrame, aPresContext, innerSize, innerReflowState, aStatus);