From 2a4c3e66cc03f043ae1d57b85210fa9e6135785d Mon Sep 17 00:00:00 2001 From: "karnaze%netscape.com" Date: Thu, 4 May 2000 14:49:35 +0000 Subject: [PATCH] bug 37791 - calculate auto margins during an incremental reflow. git-svn-id: svn://10.0.0.236/trunk@68238 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/html/table/src/nsTableFrame.cpp | 3 +++ mozilla/layout/html/table/src/nsTableOuterFrame.cpp | 8 ++++++-- mozilla/layout/tables/nsTableFrame.cpp | 3 +++ mozilla/layout/tables/nsTableOuterFrame.cpp | 8 ++++++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index 96523b110dd..fc987a06449 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -2960,6 +2960,9 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext* aPresContext // Reflow the child into the available space nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, kidFrame, kidAvailSize, reason); + // XXX fix up bad mComputedWidth for scroll frame + kidReflowState.mComputedWidth = PR_MAX(kidReflowState.mComputedWidth, 0); + if (aReflowState.firstBodySection && (kidFrame != aReflowState.firstBodySection)) { // If this isn't the first row group frame or the header or footer, then // we can't be at the top of the page anymore... diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp index 6d943b95e04..502319a5782 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp @@ -1174,6 +1174,7 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, nsPoint innerOrigin(0,0); nsMargin captionMargin(0,0,0,0); + nsSize captionSize(0,0); nsSize containSize = GetContainingBlockSize(aOuterRS); PRBool reflowedCaption = PR_FALSE; // if there is a caption and the width or height of the inner table changed @@ -1183,7 +1184,6 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, nsMargin ignorePadding; // XXX only need to reflow if the caption is auto width nsHTMLReflowMetrics captionMet(nsnull); // don't ask for MES, it hasn't changed - nsSize captionSize; nscoord availWidth = GetCaptionAvailWidth(aPresContext, mCaptionFrame, aOuterRS, &innerSize.width, &innerMargin); rv = OuterReflowChild(aPresContext, mCaptionFrame, aOuterRS, captionMet, &availWidth, @@ -1202,7 +1202,7 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, } else { // reposition the caption frame if necessary and set the inner's origin - nsSize captionSize = GetFrameSize(*mCaptionFrame); + captionSize = GetFrameSize(*mCaptionFrame); nsPoint captionOrigin; nsMargin captionPadding; GetMarginPadding(aPresContext, aOuterRS, mCaptionFrame, captionMargin, @@ -1214,6 +1214,10 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, MoveFrameTo(aPresContext, mCaptionFrame, captionOrigin.x, captionOrigin.y); } } + else { + GetInnerOrigin(aPresContext, captionSide, containSize, captionSize, + captionMargin, innerSize, innerMargin, innerOrigin); + } FinishReflowChild(mInnerTableFrame, aPresContext, innerMet, innerOrigin.x, innerOrigin.y, 0); diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index 96523b110dd..fc987a06449 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -2960,6 +2960,9 @@ NS_METHOD nsTableFrame::ReflowMappedChildren(nsIPresContext* aPresContext // Reflow the child into the available space nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState, kidFrame, kidAvailSize, reason); + // XXX fix up bad mComputedWidth for scroll frame + kidReflowState.mComputedWidth = PR_MAX(kidReflowState.mComputedWidth, 0); + if (aReflowState.firstBodySection && (kidFrame != aReflowState.firstBodySection)) { // If this isn't the first row group frame or the header or footer, then // we can't be at the top of the page anymore... diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index 6d943b95e04..502319a5782 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/layout/tables/nsTableOuterFrame.cpp @@ -1174,6 +1174,7 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, nsPoint innerOrigin(0,0); nsMargin captionMargin(0,0,0,0); + nsSize captionSize(0,0); nsSize containSize = GetContainingBlockSize(aOuterRS); PRBool reflowedCaption = PR_FALSE; // if there is a caption and the width or height of the inner table changed @@ -1183,7 +1184,6 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, nsMargin ignorePadding; // XXX only need to reflow if the caption is auto width nsHTMLReflowMetrics captionMet(nsnull); // don't ask for MES, it hasn't changed - nsSize captionSize; nscoord availWidth = GetCaptionAvailWidth(aPresContext, mCaptionFrame, aOuterRS, &innerSize.width, &innerMargin); rv = OuterReflowChild(aPresContext, mCaptionFrame, aOuterRS, captionMet, &availWidth, @@ -1202,7 +1202,7 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, } else { // reposition the caption frame if necessary and set the inner's origin - nsSize captionSize = GetFrameSize(*mCaptionFrame); + captionSize = GetFrameSize(*mCaptionFrame); nsPoint captionOrigin; nsMargin captionPadding; GetMarginPadding(aPresContext, aOuterRS, mCaptionFrame, captionMargin, @@ -1214,6 +1214,10 @@ nsTableOuterFrame::IR_InnerTableReflow(nsIPresContext* aPresContext, MoveFrameTo(aPresContext, mCaptionFrame, captionOrigin.x, captionOrigin.y); } } + else { + GetInnerOrigin(aPresContext, captionSide, containSize, captionSize, + captionMargin, innerSize, innerMargin, innerOrigin); + } FinishReflowChild(mInnerTableFrame, aPresContext, innerMet, innerOrigin.x, innerOrigin.y, 0);