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
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user