From 54994fbcc66fd67d0d3a0258a02e2f97f49fcab4 Mon Sep 17 00:00:00 2001 From: troy Date: Thu, 28 May 1998 20:12:02 +0000 Subject: [PATCH] Added some more WillReflow() calls git-svn-id: svn://10.0.0.236/trunk@2558 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsLeafFrame.cpp | 2 ++ mozilla/layout/generic/nsPlaceholderFrame.cpp | 5 +++++ mozilla/layout/html/base/src/nsAbsoluteFrame.cpp | 2 ++ mozilla/layout/html/base/src/nsLeafFrame.cpp | 2 ++ mozilla/layout/html/base/src/nsPlaceholderFrame.cpp | 5 +++++ 5 files changed, 16 insertions(+) diff --git a/mozilla/layout/generic/nsLeafFrame.cpp b/mozilla/layout/generic/nsLeafFrame.cpp index 7099f582479..fc9ea42f00f 100644 --- a/mozilla/layout/generic/nsLeafFrame.cpp +++ b/mozilla/layout/generic/nsLeafFrame.cpp @@ -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. diff --git a/mozilla/layout/generic/nsPlaceholderFrame.cpp b/mozilla/layout/generic/nsPlaceholderFrame.cpp index bbd63e633e8..0b0bfeeb7b6 100644 --- a/mozilla/layout/generic/nsPlaceholderFrame.cpp +++ b/mozilla/layout/generic/nsPlaceholderFrame.cpp @@ -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); diff --git a/mozilla/layout/html/base/src/nsAbsoluteFrame.cpp b/mozilla/layout/html/base/src/nsAbsoluteFrame.cpp index c972eca631b..e7193e2c411 100644 --- a/mozilla/layout/html/base/src/nsAbsoluteFrame.cpp +++ b/mozilla/layout/html/base/src/nsAbsoluteFrame.cpp @@ -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) diff --git a/mozilla/layout/html/base/src/nsLeafFrame.cpp b/mozilla/layout/html/base/src/nsLeafFrame.cpp index 7099f582479..fc9ea42f00f 100644 --- a/mozilla/layout/html/base/src/nsLeafFrame.cpp +++ b/mozilla/layout/html/base/src/nsLeafFrame.cpp @@ -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. diff --git a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp index bbd63e633e8..0b0bfeeb7b6 100644 --- a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp +++ b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp @@ -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);