From dd0024a1e81c59ffe9366d9a875785b58971f361 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Mon, 20 Mar 2000 23:11:39 +0000 Subject: [PATCH] b=32301 r=buster@netscape.com Changed DeleteChildsNextInFlow() to also check the frame's overflow list --- layout/generic/nsContainerFrame.cpp | 15 ++++++++++++++- layout/html/base/src/nsContainerFrame.cpp | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 73a7612f205..a74aedefe2e 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -807,7 +807,20 @@ nsContainerFrame::DeleteChildsNextInFlow(nsIPresContext* aPresContext, // Take the next-in-flow out of the parent's child list PRBool result = parent->mFrames.RemoveFrame(nextInFlow); - NS_ASSERTION(result, "failed to remove frame"); + if (!result) { + // We didn't find the child in the parent's principal child list. + // Maybe it's on the overflow list? + nsFrameList overflowFrames(parent->GetOverflowFrames(aPresContext, PR_TRUE)); + + if (overflowFrames.IsEmpty() || !overflowFrames.RemoveFrame(nextInFlow)) { + NS_ASSERTION(result, "failed to remove frame"); + } + + // Set the overflow property again + if (overflowFrames.NotEmpty()) { + parent->SetOverflowFrames(aPresContext, overflowFrames.FirstChild()); + } + } // Delete the next-in-flow frame nextInFlow->Destroy(aPresContext); diff --git a/layout/html/base/src/nsContainerFrame.cpp b/layout/html/base/src/nsContainerFrame.cpp index 73a7612f205..a74aedefe2e 100644 --- a/layout/html/base/src/nsContainerFrame.cpp +++ b/layout/html/base/src/nsContainerFrame.cpp @@ -807,7 +807,20 @@ nsContainerFrame::DeleteChildsNextInFlow(nsIPresContext* aPresContext, // Take the next-in-flow out of the parent's child list PRBool result = parent->mFrames.RemoveFrame(nextInFlow); - NS_ASSERTION(result, "failed to remove frame"); + if (!result) { + // We didn't find the child in the parent's principal child list. + // Maybe it's on the overflow list? + nsFrameList overflowFrames(parent->GetOverflowFrames(aPresContext, PR_TRUE)); + + if (overflowFrames.IsEmpty() || !overflowFrames.RemoveFrame(nextInFlow)) { + NS_ASSERTION(result, "failed to remove frame"); + } + + // Set the overflow property again + if (overflowFrames.NotEmpty()) { + parent->SetOverflowFrames(aPresContext, overflowFrames.FirstChild()); + } + } // Delete the next-in-flow frame nextInFlow->Destroy(aPresContext);