Added some more WillReflow() calls

This commit is contained in:
troy 1998-05-28 20:12:02 +00:00
parent 05319552bd
commit b8095d0814
5 changed files with 16 additions and 0 deletions

View File

@ -53,6 +53,8 @@ NS_METHOD nsLeafFrame::Reflow(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
// XXX add in code to check for width/height being set via css
// and if set use them instead of calling GetDesiredSize.

View File

@ -80,11 +80,14 @@ NS_METHOD nsPlaceholderFrame::Reflow(nsIPresContext* aPresContext,
// XXX Check for complete?
nsReflowMetrics desiredSize(nsnull);
nsReflowState reflowState(eReflowReason_Initial, aReflowState.maxSize);
mAnchoredItem->WillReflow(*aPresContext);
mAnchoredItem->Reflow(aPresContext, desiredSize, reflowState, aStatus);
mAnchoredItem->SizeTo(desiredSize.width, desiredSize.height);
// Now notify our containing block that there's a new floater
container->AddFloater(aPresContext, mAnchoredItem, this);
mAnchoredItem->DidReflow(*aPresContext, NS_FRAME_REFLOW_FINISHED);
} else {
// XXX This causes anchored-items sizes to get fixed up; this is
// not quite right because this class should be implementing one
@ -92,9 +95,11 @@ NS_METHOD nsPlaceholderFrame::Reflow(nsIPresContext* aPresContext,
// properly to the contained frame.
nsReflowMetrics desiredSize(nsnull);
nsReflowState reflowState(eReflowReason_Resize, aReflowState.maxSize);
mAnchoredItem->WillReflow(*aPresContext);
mAnchoredItem->Reflow(aPresContext, desiredSize, reflowState, aStatus);
mAnchoredItem->SizeTo(desiredSize.width, desiredSize.height);
container->PlaceFloater(aPresContext, mAnchoredItem, this);
mAnchoredItem->DidReflow(*aPresContext, NS_FRAME_REFLOW_FINISHED);
}
return nsFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);

View File

@ -326,6 +326,7 @@ NS_METHOD nsAbsoluteFrame::Reflow(nsIPresContext* aPresContext,
nsReflowMetrics desiredSize(nsnull);
nsReflowState reflowState(eReflowReason_Initial, availSize);
mFrame->WillReflow(*aPresContext);
mFrame->Reflow(aPresContext, desiredSize, reflowState, aStatus);
// Figure out what size to actually use. If the position style is 'auto' or
@ -340,6 +341,7 @@ NS_METHOD nsAbsoluteFrame::Reflow(nsIPresContext* aPresContext,
rect.height = desiredSize.height;
}
mFrame->SizeTo(rect.width, rect.height);
mFrame->DidReflow(*aPresContext, NS_FRAME_REFLOW_FINISHED);
}
// Return our desired size as (0, 0)

View File

@ -53,6 +53,8 @@ NS_METHOD nsLeafFrame::Reflow(nsIPresContext* aPresContext,
const nsReflowState& aReflowState,
nsReflowStatus& aStatus)
{
NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
// XXX add in code to check for width/height being set via css
// and if set use them instead of calling GetDesiredSize.

View File

@ -80,11 +80,14 @@ NS_METHOD nsPlaceholderFrame::Reflow(nsIPresContext* aPresContext,
// XXX Check for complete?
nsReflowMetrics desiredSize(nsnull);
nsReflowState reflowState(eReflowReason_Initial, aReflowState.maxSize);
mAnchoredItem->WillReflow(*aPresContext);
mAnchoredItem->Reflow(aPresContext, desiredSize, reflowState, aStatus);
mAnchoredItem->SizeTo(desiredSize.width, desiredSize.height);
// Now notify our containing block that there's a new floater
container->AddFloater(aPresContext, mAnchoredItem, this);
mAnchoredItem->DidReflow(*aPresContext, NS_FRAME_REFLOW_FINISHED);
} else {
// XXX This causes anchored-items sizes to get fixed up; this is
// not quite right because this class should be implementing one
@ -92,9 +95,11 @@ NS_METHOD nsPlaceholderFrame::Reflow(nsIPresContext* aPresContext,
// properly to the contained frame.
nsReflowMetrics desiredSize(nsnull);
nsReflowState reflowState(eReflowReason_Resize, aReflowState.maxSize);
mAnchoredItem->WillReflow(*aPresContext);
mAnchoredItem->Reflow(aPresContext, desiredSize, reflowState, aStatus);
mAnchoredItem->SizeTo(desiredSize.width, desiredSize.height);
container->PlaceFloater(aPresContext, mAnchoredItem, this);
mAnchoredItem->DidReflow(*aPresContext, NS_FRAME_REFLOW_FINISHED);
}
return nsFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);