Fix regression causing scrollbars not to be extended by absolutely positioned elements in some cases. Also removed unused |FixParentAndView|. b=154230 r=bzbarsky sr=jst

This commit is contained in:
dbaron%fas.harvard.edu 2002-08-06 12:54:52 +00:00
parent f1bf4f4474
commit e2d870b917
6 changed files with 36 additions and 74 deletions

View File

@ -117,6 +117,8 @@ public:
PRBool HasAbsoluteFrames() {return mAbsoluteFrames.NotEmpty();}
void CalculateChildBounds(nsIPresContext* aPresContext, nsRect& aChildBounds);
protected:
nsresult ReflowAbsoluteFrame(nsIFrame* aDelegatingFrame,
nsIPresContext* aPresContext,
@ -127,8 +129,6 @@ protected:
nsReflowReason aReason,
nsReflowStatus& aStatus);
void CalculateChildBounds(nsIPresContext* aPresContext, nsRect& aChildBounds);
protected:
nsFrameList mAbsoluteFrames; // additional named child list
};

View File

@ -1046,21 +1046,24 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
// 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;
if (NS_SUCCEEDED(rv) && mAbsoluteContainer.HasAbsoluteFrames()) {
nsRect childBounds;
if (eReflowReason_Incremental != aReflowState.reason ||
aReflowState.path->mReflowCommand ||
mRect != oldRect) {
nscoord containingBlockWidth;
nscoord containingBlockHeight;
CalculateContainingBlock(aReflowState, aMetrics.width, aMetrics.height,
containingBlockWidth, containingBlockHeight);
CalculateContainingBlock(aReflowState, aMetrics.width, aMetrics.height,
containingBlockWidth, containingBlockHeight);
rv = mAbsoluteContainer.Reflow(this, aPresContext, aReflowState,
containingBlockWidth, containingBlockHeight,
childBounds);
rv = mAbsoluteContainer.Reflow(this, aPresContext, aReflowState,
containingBlockWidth,
containingBlockHeight,
childBounds);
} else {
mAbsoluteContainer.CalculateChildBounds(aPresContext, childBounds);
}
// Factor the absolutely positioned child bounds into the overflow area
aMetrics.mOverflowArea.UnionRect(aMetrics.mOverflowArea, childBounds);
@ -4975,22 +4978,6 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
return NS_OK;
}
void
nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame)
{
while (aFrame) {
nsIFrame* oldParent;
aFrame->GetParent(&oldParent);
aFrame->SetParent(this);
if (this != oldParent) {
nsHTMLContainerFrame::ReparentFrameView(aPresContext, aFrame, oldParent, this);
aPresContext->ReParentStyleContext(aFrame, mStyleContext);
}
aFrame->GetNextSibling(&aFrame);
}
}
NS_IMETHODIMP
nsBlockFrame::RemoveFrame(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,

View File

@ -258,12 +258,6 @@ protected:
nsIFrame* aFrameList,
nsIFrame* aPrevSibling);
/** move the frame list rooted at aFrame into this as a child
* assumes prev/next sibling pointers will be or have been set elsewhere
* changes aFrame's parent to be this, and reparents aFrame's view and stylecontext.
*/
void FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame);
/** does all the real work for removing aDeletedFrame from this
* finds the line containing aFrame.
* handled continued frames

View File

@ -117,6 +117,8 @@ public:
PRBool HasAbsoluteFrames() {return mAbsoluteFrames.NotEmpty();}
void CalculateChildBounds(nsIPresContext* aPresContext, nsRect& aChildBounds);
protected:
nsresult ReflowAbsoluteFrame(nsIFrame* aDelegatingFrame,
nsIPresContext* aPresContext,
@ -127,8 +129,6 @@ protected:
nsReflowReason aReason,
nsReflowStatus& aStatus);
void CalculateChildBounds(nsIPresContext* aPresContext, nsRect& aChildBounds);
protected:
nsFrameList mAbsoluteFrames; // additional named child list
};

View File

@ -1046,21 +1046,24 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
// 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;
if (NS_SUCCEEDED(rv) && mAbsoluteContainer.HasAbsoluteFrames()) {
nsRect childBounds;
if (eReflowReason_Incremental != aReflowState.reason ||
aReflowState.path->mReflowCommand ||
mRect != oldRect) {
nscoord containingBlockWidth;
nscoord containingBlockHeight;
CalculateContainingBlock(aReflowState, aMetrics.width, aMetrics.height,
containingBlockWidth, containingBlockHeight);
CalculateContainingBlock(aReflowState, aMetrics.width, aMetrics.height,
containingBlockWidth, containingBlockHeight);
rv = mAbsoluteContainer.Reflow(this, aPresContext, aReflowState,
containingBlockWidth, containingBlockHeight,
childBounds);
rv = mAbsoluteContainer.Reflow(this, aPresContext, aReflowState,
containingBlockWidth,
containingBlockHeight,
childBounds);
} else {
mAbsoluteContainer.CalculateChildBounds(aPresContext, childBounds);
}
// Factor the absolutely positioned child bounds into the overflow area
aMetrics.mOverflowArea.UnionRect(aMetrics.mOverflowArea, childBounds);
@ -4975,22 +4978,6 @@ nsBlockFrame::AddFrames(nsIPresContext* aPresContext,
return NS_OK;
}
void
nsBlockFrame::FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame)
{
while (aFrame) {
nsIFrame* oldParent;
aFrame->GetParent(&oldParent);
aFrame->SetParent(this);
if (this != oldParent) {
nsHTMLContainerFrame::ReparentFrameView(aPresContext, aFrame, oldParent, this);
aPresContext->ReParentStyleContext(aFrame, mStyleContext);
}
aFrame->GetNextSibling(&aFrame);
}
}
NS_IMETHODIMP
nsBlockFrame::RemoveFrame(nsIPresContext* aPresContext,
nsIPresShell& aPresShell,

View File

@ -258,12 +258,6 @@ protected:
nsIFrame* aFrameList,
nsIFrame* aPrevSibling);
/** move the frame list rooted at aFrame into this as a child
* assumes prev/next sibling pointers will be or have been set elsewhere
* changes aFrame's parent to be this, and reparents aFrame's view and stylecontext.
*/
void FixParentAndView(nsIPresContext* aPresContext, nsIFrame* aFrame);
/** does all the real work for removing aDeletedFrame from this
* finds the line containing aFrame.
* handled continued frames