From 360ffeb90aad5aafa45379aaa00956bb1be7abdd Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Mon, 2 Jun 2003 04:03:07 +0000 Subject: [PATCH] Bug 193686. nsContainerFrame needs to report the overflowList as one of its child frame lists. Also, overflow frames should be destroyed when their parent is destroyed. r+sr=dbaron git-svn-id: svn://10.0.0.236/trunk@143163 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsBlockFrame.cpp | 6 ++++++ mozilla/layout/generic/nsContainerFrame.cpp | 21 +++++++++++++++++++ mozilla/layout/generic/nsContainerFrame.h | 2 ++ mozilla/layout/html/base/src/nsBlockFrame.cpp | 6 ++++++ .../layout/html/base/src/nsContainerFrame.cpp | 21 +++++++++++++++++++ .../layout/html/base/src/nsContainerFrame.h | 2 ++ 6 files changed, 58 insertions(+) diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 38416e1ca32..87251d248b7 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -328,6 +328,12 @@ nsBlockFrame::Destroy(nsIPresContext* aPresContext) nsLineBox::DeleteLineList(aPresContext, mLines); + // destroy overflow lines now + nsLineList* overflowLines = GetOverflowLines(aPresContext, PR_TRUE); + if (overflowLines) { + nsLineBox::DeleteLineList(aPresContext, *overflowLines); + } + return nsBlockFrameSuper::Destroy(aPresContext); } diff --git a/mozilla/layout/generic/nsContainerFrame.cpp b/mozilla/layout/generic/nsContainerFrame.cpp index d8faf96e735..6d9ca5e76f0 100644 --- a/mozilla/layout/generic/nsContainerFrame.cpp +++ b/mozilla/layout/generic/nsContainerFrame.cpp @@ -138,6 +138,10 @@ nsContainerFrame::Destroy(nsIPresContext* aPresContext) // Delete the primary child list mFrames.DestroyFrames(aPresContext); + + // Destroy overflow frames now + nsFrameList overflowFrames(GetOverflowFrames(aPresContext, PR_TRUE)); + overflowFrames.DestroyFrames(aPresContext); // Destroy the frame and remove the flow pointers return nsSplittableFrame::Destroy(aPresContext); @@ -166,6 +170,23 @@ nsContainerFrame::FirstChild(nsIPresContext* aPresContext, } } +NS_IMETHODIMP +nsContainerFrame::GetAdditionalChildListName(PRInt32 aIndex, + nsIAtom** aListName) const +{ + NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); + if (aIndex < 0) { + return NS_ERROR_INVALID_ARG; + } + if (aIndex == 0) { + *aListName = nsLayoutAtoms::overflowList; + NS_ADDREF(*aListName); + } else { + *aListName = nsnull; + } + return NS_OK; +} + ///////////////////////////////////////////////////////////////////////////// // Painting/Events diff --git a/mozilla/layout/generic/nsContainerFrame.h b/mozilla/layout/generic/nsContainerFrame.h index 87113733e88..3a7d09a6cba 100644 --- a/mozilla/layout/generic/nsContainerFrame.h +++ b/mozilla/layout/generic/nsContainerFrame.h @@ -65,6 +65,8 @@ public: NS_IMETHOD FirstChild(nsIPresContext* aPresContext, nsIAtom* aListName, nsIFrame** aFirstChild) const; + NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, + nsIAtom** aListName) const; NS_IMETHOD Destroy(nsIPresContext* aPresContext); NS_IMETHOD Paint(nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index 38416e1ca32..87251d248b7 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -328,6 +328,12 @@ nsBlockFrame::Destroy(nsIPresContext* aPresContext) nsLineBox::DeleteLineList(aPresContext, mLines); + // destroy overflow lines now + nsLineList* overflowLines = GetOverflowLines(aPresContext, PR_TRUE); + if (overflowLines) { + nsLineBox::DeleteLineList(aPresContext, *overflowLines); + } + return nsBlockFrameSuper::Destroy(aPresContext); } diff --git a/mozilla/layout/html/base/src/nsContainerFrame.cpp b/mozilla/layout/html/base/src/nsContainerFrame.cpp index d8faf96e735..6d9ca5e76f0 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsContainerFrame.cpp @@ -138,6 +138,10 @@ nsContainerFrame::Destroy(nsIPresContext* aPresContext) // Delete the primary child list mFrames.DestroyFrames(aPresContext); + + // Destroy overflow frames now + nsFrameList overflowFrames(GetOverflowFrames(aPresContext, PR_TRUE)); + overflowFrames.DestroyFrames(aPresContext); // Destroy the frame and remove the flow pointers return nsSplittableFrame::Destroy(aPresContext); @@ -166,6 +170,23 @@ nsContainerFrame::FirstChild(nsIPresContext* aPresContext, } } +NS_IMETHODIMP +nsContainerFrame::GetAdditionalChildListName(PRInt32 aIndex, + nsIAtom** aListName) const +{ + NS_PRECONDITION(nsnull != aListName, "null OUT parameter pointer"); + if (aIndex < 0) { + return NS_ERROR_INVALID_ARG; + } + if (aIndex == 0) { + *aListName = nsLayoutAtoms::overflowList; + NS_ADDREF(*aListName); + } else { + *aListName = nsnull; + } + return NS_OK; +} + ///////////////////////////////////////////////////////////////////////////// // Painting/Events diff --git a/mozilla/layout/html/base/src/nsContainerFrame.h b/mozilla/layout/html/base/src/nsContainerFrame.h index 87113733e88..3a7d09a6cba 100644 --- a/mozilla/layout/html/base/src/nsContainerFrame.h +++ b/mozilla/layout/html/base/src/nsContainerFrame.h @@ -65,6 +65,8 @@ public: NS_IMETHOD FirstChild(nsIPresContext* aPresContext, nsIAtom* aListName, nsIFrame** aFirstChild) const; + NS_IMETHOD GetAdditionalChildListName(PRInt32 aIndex, + nsIAtom** aListName) const; NS_IMETHOD Destroy(nsIPresContext* aPresContext); NS_IMETHOD Paint(nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext,