Fix performance problem on home.netscape.com: Don't do full reflow of all absolutely positioned elements whose containing block is on the path to the target of an incremental reflow. b=146831 sr=waterson r=kin

This commit is contained in:
dbaron@fas.harvard.edu
2002-06-12 03:21:00 +00:00
parent 61a2eed3cd
commit f87e9ee15f
6 changed files with 88 additions and 18 deletions

View File

@@ -729,6 +729,8 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
}
#endif
nsRect oldRect(mRect);
// Should we create a space manager?
nsAutoSpaceManager autoSpaceManager(NS_CONST_CAST(nsHTMLReflowState &, aReflowState));
@@ -739,8 +741,10 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
if (NS_BLOCK_SPACE_MGR & mState)
autoSpaceManager.CreateSpaceManagerFor(aPresContext, this);
// See if it's an incremental reflow command
if (eReflowReason_Incremental == aReflowState.reason) {
// See if it's an incremental reflow command and we're not the target
if (mAbsoluteContainer.HasAbsoluteFrames() &&
eReflowReason_Incremental == aReflowState.reason &&
!aReflowState.path->mReflowCommand) {
// Give the absolute positioning code a chance to handle it
nscoord containingBlockWidth;
nscoord containingBlockHeight;
@@ -1021,7 +1025,18 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
// Let the absolutely positioned container reflow any absolutely positioned
// child frames that need to be reflowed, e.g., elements with a percentage
// based width/height
if (NS_SUCCEEDED(rv) && mAbsoluteContainer.HasAbsoluteFrames()) {
// We want to do this under either of two conditions:
// 1. If we didn't do the incremental reflow above.
// 2. If our size changed.
// Even though it's the padding edge that's the containing block, we
// can use our rect (the border edge) since if the border style
// changed, the reflow would have been targeted at us so we'd satisfy
// condition 1.
if (NS_SUCCEEDED(rv) &&
mAbsoluteContainer.HasAbsoluteFrames() &&
(eReflowReason_Incremental != aReflowState.reason ||
aReflowState.path->mReflowCommand ||
mRect != oldRect)) {
nscoord containingBlockWidth;
nscoord containingBlockHeight;
nsRect childBounds;
@@ -2168,7 +2183,8 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
// If we're supposed to update our maximum width, then we'll also need to
// reflow this line if it's line wrapped and any of the continuing lines
// are dirty. If we are printing (constrained height), always reflow the line
// are dirty. If we are printing (constrained height), always reflow
// the line.
if ((NS_UNCONSTRAINEDSIZE != aState.mReflowState.availableHeight) ||
(!line->IsDirty() &&
aState.GetFlag(BRS_COMPUTEMAXWIDTH) &&