From 9748b6eb2b5cef83ffbae0a3845c0771492eefdc Mon Sep 17 00:00:00 2001 From: kipp Date: Fri, 8 May 1998 17:23:06 +0000 Subject: [PATCH] Factored out sizing into ComputeDesiredSize and fixed the size to reflect the size of the content git-svn-id: svn://10.0.0.236/trunk@1310 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/html/base/src/nsBodyFrame.cpp | 51 ++++++++------------ mozilla/layout/html/base/src/nsBodyFrame.h | 6 +++ 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/mozilla/layout/html/base/src/nsBodyFrame.cpp b/mozilla/layout/html/base/src/nsBodyFrame.cpp index f10275c8fb9..9f8d7ecc349 100644 --- a/mozilla/layout/html/base/src/nsBodyFrame.cpp +++ b/mozilla/layout/html/base/src/nsBodyFrame.cpp @@ -197,26 +197,8 @@ NS_METHOD nsBodyFrame::ResizeReflow(nsIPresContext* aPresContext, SetLastContentOffset(mFirstChild); // Return our desired size. Take into account the y-most floater -#if 0 - aDesiredSize.width = desiredRect.XMost(); - aDesiredSize.height = PR_MAX(desiredRect.YMost(), mSpaceManager->YMost()); - - if (!isPseudoFrame) { - aDesiredSize.width += mySpacing->mBorderPadding.left + mySpacing->mBorderPadding.right; - aDesiredSize.height += mySpacing->mBorderPadding.top + mySpacing->mBorderPadding.bottom; - } -#else - aDesiredSize.height = PR_MAX(desiredRect.YMost(), mSpaceManager->YMost()); - if (isPseudoFrame) { - aDesiredSize.width = desiredRect.XMost(); - } else { - aDesiredSize.width = aMaxSize.width; - aDesiredSize.height += mySpacing->mBorderPadding.top + - mySpacing->mBorderPadding.bottom; - } -#endif - aDesiredSize.ascent = aDesiredSize.height; - aDesiredSize.descent = 0; + ComputeDesiredSize(desiredRect, aMaxSize, mySpacing, + isPseudoFrame, aDesiredSize); } return NS_OK; @@ -309,21 +291,30 @@ NS_METHOD nsBodyFrame::IncrementalReflow(nsIPresContext* aPresContext, SetLastContentOffset(mFirstChild); // Return our desired size - aDesiredSize.height = PR_MAX(aDesiredRect.YMost(), mSpaceManager->YMost()); - if (isPseudoFrame) { - aDesiredSize.width = aDesiredRect.XMost(); - } else { - aDesiredSize.width = aMaxSize.width; - aDesiredSize.height += mySpacing->mBorderPadding.top + - mySpacing->mBorderPadding.bottom; - } - aDesiredSize.ascent = aDesiredSize.height; - aDesiredSize.descent = 0; + ComputeDesiredSize(aDesiredRect, aMaxSize, mySpacing, + isPseudoFrame, aDesiredSize); mSpaceManager->Translate(-leftInset, -topInset); return NS_OK; } +void +nsBodyFrame::ComputeDesiredSize(const nsRect& aDesiredRect, + const nsSize& aMaxSize, + nsStyleSpacing* aSpacing, + PRBool aIsPseudoFrame, + nsReflowMetrics& aDesiredSize) +{ + aDesiredSize.height = PR_MAX(aDesiredRect.YMost(), mSpaceManager->YMost()); + aDesiredSize.width = PR_MAX(aDesiredRect.XMost(), aMaxSize.width); + if (!aIsPseudoFrame) { + aDesiredSize.height += aSpacing->mBorderPadding.top + + aSpacing->mBorderPadding.bottom; + } + aDesiredSize.ascent = aDesiredSize.height; + aDesiredSize.descent = 0; +} + NS_METHOD nsBodyFrame::ContentAppended(nsIPresShell* aShell, nsIPresContext* aPresContext, nsIContent* aContainer) diff --git a/mozilla/layout/html/base/src/nsBodyFrame.h b/mozilla/layout/html/base/src/nsBodyFrame.h index 1c5eee8c5f8..634a82fe7b0 100644 --- a/mozilla/layout/html/base/src/nsBodyFrame.h +++ b/mozilla/layout/html/base/src/nsBodyFrame.h @@ -73,6 +73,12 @@ protected: ~nsBodyFrame(); + void ComputeDesiredSize(const nsRect& aDesiredRect, + const nsSize& aMaxSize, + nsStyleSpacing* aSpacing, + PRBool aIsPseudoFrame, + nsReflowMetrics& aDesiredSize); + virtual PRIntn GetSkipSides() const; private: