From 8589f840a187a52a74815b3b835378a2dfbda324 Mon Sep 17 00:00:00 2001 From: "karnaze%netscape.com" Date: Thu, 14 Oct 1999 04:03:20 +0000 Subject: [PATCH] bug 15247 - ComputeAvailableTableWidth accounts for margins --- layout/html/table/src/nsTableOuterFrame.cpp | 12 ++++++++++-- layout/tables/nsTableOuterFrame.cpp | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/layout/html/table/src/nsTableOuterFrame.cpp b/layout/html/table/src/nsTableOuterFrame.cpp index 7a169e385172..2af0623b811f 100644 --- a/layout/html/table/src/nsTableOuterFrame.cpp +++ b/layout/html/table/src/nsTableOuterFrame.cpp @@ -762,6 +762,7 @@ nsresult nsTableOuterFrame::SizeAndPlaceChildren(const nsSize& aInnerSi return rv; } + // computes the table width nscoord nsTableOuterFrame::ComputeAvailableTableWidth(const nsHTMLReflowState& aReflowState) { @@ -782,8 +783,15 @@ nscoord nsTableOuterFrame::ComputeAvailableTableWidth(const nsHTMLReflowState& a break; case eStyleUnit_Auto: - maxWidth = aReflowState.availableWidth; - break; + { + const nsStyleSpacing* spacing = + (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); + nsMargin margin(0,0,0,0); + // XXX handle percentages + spacing->GetMargin(margin); + maxWidth = aReflowState.availableWidth - margin.left - margin.right; + break; + } case eStyleUnit_Percent: maxWidth = (nscoord)((float)aReflowState.availableWidth * position->mWidth.GetPercentValue()); diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp index 7a169e385172..2af0623b811f 100644 --- a/layout/tables/nsTableOuterFrame.cpp +++ b/layout/tables/nsTableOuterFrame.cpp @@ -762,6 +762,7 @@ nsresult nsTableOuterFrame::SizeAndPlaceChildren(const nsSize& aInnerSi return rv; } + // computes the table width nscoord nsTableOuterFrame::ComputeAvailableTableWidth(const nsHTMLReflowState& aReflowState) { @@ -782,8 +783,15 @@ nscoord nsTableOuterFrame::ComputeAvailableTableWidth(const nsHTMLReflowState& a break; case eStyleUnit_Auto: - maxWidth = aReflowState.availableWidth; - break; + { + const nsStyleSpacing* spacing = + (const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); + nsMargin margin(0,0,0,0); + // XXX handle percentages + spacing->GetMargin(margin); + maxWidth = aReflowState.availableWidth - margin.left - margin.right; + break; + } case eStyleUnit_Percent: maxWidth = (nscoord)((float)aReflowState.availableWidth * position->mWidth.GetPercentValue());