diff --git a/mozilla/layout/base/src/nsContainerFrame.h b/mozilla/layout/base/src/nsContainerFrame.h index 701f7e6187d..1e5794297cc 100644 --- a/mozilla/layout/base/src/nsContainerFrame.h +++ b/mozilla/layout/base/src/nsContainerFrame.h @@ -107,6 +107,7 @@ class nsContainerFrame : public nsSplittableFrame public: NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const; + NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); /** * Default implementation is to use the content delegate to create a new * frame. After the frame is created it uses PrepareContinuingFrame() to @@ -245,7 +246,7 @@ protected: * * @param aChild child this child's next-in-flow */ - PRBool DeleteChildsNextInFlow(nsIFrame* aChild); + PRBool DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame* aChild); /** * Push aFromChild and its next siblings to the next-in-flow. Change the diff --git a/mozilla/layout/base/src/nsFrame.h b/mozilla/layout/base/src/nsFrame.h index 928d54cee4e..0f7950e1e94 100644 --- a/mozilla/layout/base/src/nsFrame.h +++ b/mozilla/layout/base/src/nsFrame.h @@ -105,7 +105,7 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIFrame - NS_IMETHOD DeleteFrame(); + NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const; NS_IMETHOD GetContent(nsIContent*& aContent) const; NS_IMETHOD GetContentIndex(PRInt32& aIndexInParent) const; diff --git a/mozilla/layout/base/tests/TestContainerFrame.cpp b/mozilla/layout/base/tests/TestContainerFrame.cpp index b071e77cbd0..9b03dfa1e32 100644 --- a/mozilla/layout/base/tests/TestContainerFrame.cpp +++ b/mozilla/layout/base/tests/TestContainerFrame.cpp @@ -21,6 +21,7 @@ #include "nscoord.h" #include "nsContainerFrame.h" #include "nsIContent.h" +#include "nsIPresContext.h" static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID); @@ -128,7 +129,7 @@ public: // Allow public access to protected member functions void PushChildren(nsIFrame* aFromChild, nsIFrame* aPrevSibling, PRBool aLastIsComplete); - PRBool DeleteChildsNextInFlow(nsIFrame* aChild); + PRBool DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame* aChild); }; SimpleContainer::SimpleContainer(nsIContent* aContent) @@ -150,9 +151,9 @@ void SimpleContainer::PushChildren(nsIFrame* aFromChild, nsIFrame* aPrevSibling, nsContainerFrame::PushChildren(aFromChild, aPrevSibling, aLastIsComplete); } -PRBool SimpleContainer::DeleteChildsNextInFlow(nsIFrame* aChild) +PRBool SimpleContainer::DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame* aChild) { - return nsContainerFrame::DeleteChildsNextInFlow(aChild); + return nsContainerFrame::DeleteChildsNextInFlow(aPresContext, aChild); } /////////////////////////////////////////////////////////////////////////////// @@ -470,6 +471,9 @@ TestDeleteChildsNext() SimpleContent* childContent = new SimpleContent; nsFrame* c1 = new SimpleSplittableFrame(childContent, f); nsFrame* c11 = new SimpleSplittableFrame(childContent, f); + nsIPresContext *context; + + NS_NewGalleyContext(&context); /////////////////////////////////////////////////////////////////////////// // #1a @@ -480,7 +484,7 @@ TestDeleteChildsNext() f->SetFirstChild(c1, 2); // Delete the next-in-flow - f->DeleteChildsNextInFlow(c1); + f->DeleteChildsNextInFlow(*context, c1); // Verify the child count PRInt32 childCount; @@ -532,7 +536,7 @@ TestDeleteChildsNext() f1->AppendToFlow(f); // Delete the next-in-flow - f->DeleteChildsNextInFlow(c1); + f->DeleteChildsNextInFlow(*context, c1); // Verify that the second container frame is empty nsIFrame* firstChild; @@ -567,7 +571,7 @@ TestDeleteChildsNext() f->SetLastContentOffset(1); // Delete the next-in-flow - f->DeleteChildsNextInFlow(c1); + f->DeleteChildsNextInFlow(*context, c1); // Verify the child count f->ChildCount(childCount); @@ -619,7 +623,7 @@ TestDeleteChildsNext() f1->AppendToFlow(f); // Delete the next-in-flow - f->DeleteChildsNextInFlow(c1); + f->DeleteChildsNextInFlow(*context, c1); // Verify the next-in-flow pointer is null c1->GetNextInFlow(nextInFlow); @@ -669,7 +673,7 @@ TestDeleteChildsNext() f->SetLastContentOffset(1); // Delete the next-in-flow - f->DeleteChildsNextInFlow(c1); + f->DeleteChildsNextInFlow(*context, c1); // Verify the next-in-flow pointer is null c1->GetNextInFlow(nextInFlow); @@ -710,6 +714,8 @@ TestDeleteChildsNext() return PR_FALSE; } + NS_IF_RELEASE(context); + return PR_TRUE; } diff --git a/mozilla/layout/css/layout/src/nsCSSBlockFrame.cpp b/mozilla/layout/css/layout/src/nsCSSBlockFrame.cpp index c9895c4b8f3..d803bd656eb 100644 --- a/mozilla/layout/css/layout/src/nsCSSBlockFrame.cpp +++ b/mozilla/layout/css/layout/src/nsCSSBlockFrame.cpp @@ -107,6 +107,7 @@ public: NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); // nsIFrame + NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); NS_IMETHOD ChildCount(PRInt32& aChildCount) const; NS_IMETHOD ChildAt(PRInt32 aIndex, nsIFrame*& aFrame) const; NS_IMETHOD IndexOf(const nsIFrame* aChild, PRInt32& aIndex) const; @@ -168,7 +169,7 @@ protected: PRBool GetLastContentIsComplete() const; #endif - virtual PRBool DeleteNextInFlowsFor(nsIFrame* aNextInFlow); + virtual PRBool DeleteNextInFlowsFor(nsIPresContext& aPresContext, nsIFrame* aNextInFlow); PRBool DrainOverflowLines(); @@ -550,7 +551,7 @@ VerifyChildCount(LineData* aLines, PRBool aEmptyOK = PR_FALSE) #endif static void -DeleteLineList(LineData* aLine) +DeleteLineList(nsIPresContext& aPresContext, LineData* aLine) { if (nsnull != aLine) { // Delete our child frames before doing anything else. In particular @@ -559,7 +560,7 @@ DeleteLineList(LineData* aLine) for (nsIFrame* child = aLine->mFirstChild; child; ) { nsIFrame* nextChild; child->GetNextSibling(nextChild); - child->DeleteFrame(); + child->DeleteFrame(aPresContext); child = nextChild; } @@ -927,8 +928,6 @@ nsCSSBlockFrame::nsCSSBlockFrame(nsIContent* aContent, nsIFrame* aParent) nsCSSBlockFrame::~nsCSSBlockFrame() { - DeleteLineList(mLines); - DeleteLineList(mOverflowLines); // if (nsnull != mRunInFloaters) { // delete mRunInFloaters; // } @@ -958,6 +957,17 @@ nsCSSBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) return nsCSSBlockFrameSuper::QueryInterface(aIID, aInstancePtr); } +NS_IMETHODIMP +nsCSSBlockFrame::DeleteFrame(nsIPresContext& aPresContext) +{ + DeleteLineList(aPresContext, mLines); + DeleteLineList(aPresContext, mOverflowLines); + + nsCSSBlockFrameSuper::DeleteFrame(aPresContext); + + return NS_OK; +} + PRBool nsCSSBlockFrame::IsPseudoFrame() const { @@ -2347,7 +2357,7 @@ nsCSSBlockFrame::ReflowBlockFrame(nsCSSBlockReflowState& aState, // parent is not this because we are executing pullup code) nsIFrame* parent; aFrame->GetGeometricParent(parent); - ((nsCSSBlockFrame*)parent)->DeleteNextInFlowsFor(aFrame); + ((nsCSSBlockFrame*)parent)->DeleteNextInFlowsFor(*aState.mPresContext, aFrame); } aLine->SetLastContentIsComplete(); aReflowResult = NS_FRAME_COMPLETE; @@ -3327,7 +3337,7 @@ nsCSSBlockFrame::ContentDeleted(nsIPresShell* aShell, if (nsnull != nextInFlow) { deadFrame->BreakFromNextFlow(); } - deadFrame->DeleteFrame(); + deadFrame->DeleteFrame(*aPresContext); deadFrame = nextInFlow; // If line is empty, remove it now @@ -3409,7 +3419,7 @@ nsCSSBlockFrame::ContentDeleted(nsIPresShell* aShell, } PRBool -nsCSSBlockFrame::DeleteNextInFlowsFor(nsIFrame* aChild) +nsCSSBlockFrame::DeleteNextInFlowsFor(nsIPresContext& aPresContext, nsIFrame* aChild) { NS_PRECONDITION(IsChild(aChild), "bad geometric parent"); @@ -3425,7 +3435,7 @@ nsCSSBlockFrame::DeleteNextInFlowsFor(nsIFrame* aChild) nsIFrame* nextNextInFlow; nextInFlow->GetNextInFlow(nextNextInFlow); if (nsnull != nextNextInFlow) { - parent->DeleteNextInFlowsFor(nextInFlow); + parent->DeleteNextInFlowsFor(aPresContext, nextInFlow); } #ifdef NS_DEBUG @@ -3473,7 +3483,7 @@ nsCSSBlockFrame::DeleteNextInFlowsFor(nsIFrame* aChild) #endif // Delete the next-in-flow frame and adjust its parents child count - nextInFlow->DeleteFrame(); + nextInFlow->DeleteFrame(aPresContext); #ifdef NS_DEBUG aChild->GetNextInFlow(nextInFlow); diff --git a/mozilla/layout/css/layout/src/nsCSSContainerFrame.h b/mozilla/layout/css/layout/src/nsCSSContainerFrame.h index d578c4733d4..e0071169400 100644 --- a/mozilla/layout/css/layout/src/nsCSSContainerFrame.h +++ b/mozilla/layout/css/layout/src/nsCSSContainerFrame.h @@ -24,7 +24,7 @@ class nsCSSContainerFrame : public nsHTMLContainerFrame { public: - virtual PRBool DeleteNextInFlowsFor(nsIFrame* aChild) = 0; + virtual PRBool DeleteNextInFlowsFor(nsIPresContext& aPresContext, nsIFrame* aChild) = 0; protected: nsCSSContainerFrame(nsIContent* aContent, nsIFrame* aParent); diff --git a/mozilla/layout/css/layout/src/nsCSSInlineFrame.cpp b/mozilla/layout/css/layout/src/nsCSSInlineFrame.cpp index 520aa77d1df..e621210ff86 100644 --- a/mozilla/layout/css/layout/src/nsCSSInlineFrame.cpp +++ b/mozilla/layout/css/layout/src/nsCSSInlineFrame.cpp @@ -160,9 +160,9 @@ nsCSSInlineFrame::CreateContinuingFrame(nsIPresContext& aCX, } PRBool -nsCSSInlineFrame::DeleteNextInFlowsFor(nsIFrame* aChild) +nsCSSInlineFrame::DeleteNextInFlowsFor(nsIPresContext& aPresContext, nsIFrame* aChild) { - return DeleteChildsNextInFlow(aChild); + return DeleteChildsNextInFlow(aPresContext, aChild); } NS_IMETHODIMP diff --git a/mozilla/layout/css/layout/src/nsCSSInlineFrame.h b/mozilla/layout/css/layout/src/nsCSSInlineFrame.h index e95c0f2b084..35835544bcf 100644 --- a/mozilla/layout/css/layout/src/nsCSSInlineFrame.h +++ b/mozilla/layout/css/layout/src/nsCSSInlineFrame.h @@ -81,7 +81,7 @@ public: const nsReflowState& aReflowState); // nsCSSContainerFrame - virtual PRBool DeleteNextInFlowsFor(nsIFrame* aChild); + virtual PRBool DeleteNextInFlowsFor(nsIPresContext& aPresContext, nsIFrame* aChild); protected: nsCSSInlineFrame(nsIContent* aContent, nsIFrame* aParent); diff --git a/mozilla/layout/css/layout/src/nsCSSInlineLayout.cpp b/mozilla/layout/css/layout/src/nsCSSInlineLayout.cpp index 0094d66e72c..5a82b7a0a68 100644 --- a/mozilla/layout/css/layout/src/nsCSSInlineLayout.cpp +++ b/mozilla/layout/css/layout/src/nsCSSInlineLayout.cpp @@ -316,7 +316,8 @@ nsCSSInlineLayout::ReflowFrame(nsIFrame* aKidFrame, // parent is not this because we are executing pullup code) nsIFrame* parent; aKidFrame->GetGeometricParent(parent); - ((nsCSSContainerFrame*)parent)->DeleteNextInFlowsFor(aKidFrame); + ((nsCSSContainerFrame*)parent)->DeleteNextInFlowsFor(*mLineLayout.mPresContext, + aKidFrame); } } diff --git a/mozilla/layout/generic/nsHTMLContainerFrame.cpp b/mozilla/layout/generic/nsHTMLContainerFrame.cpp index 6dec65699f1..504841ec65b 100644 --- a/mozilla/layout/generic/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/generic/nsHTMLContainerFrame.cpp @@ -332,7 +332,7 @@ nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell, nsIFrame* nextInFlow; deadFrame->GetNextInFlow(nextInFlow); deadFrame->BreakFromNextFlow(); - deadFrame->DeleteFrame(); + deadFrame->DeleteFrame(*aPresContext); deadFrame = nextInFlow; if (nsnull != deadFrame) { diff --git a/mozilla/layout/html/base/src/nsBodyFrame.cpp b/mozilla/layout/html/base/src/nsBodyFrame.cpp index 3840639f0ad..6b284d8cd91 100644 --- a/mozilla/layout/html/base/src/nsBodyFrame.cpp +++ b/mozilla/layout/html/base/src/nsBodyFrame.cpp @@ -225,7 +225,7 @@ NS_METHOD nsBodyFrame::Reflow(nsIPresContext& aPresContext, mFirstChild->GetNextInFlow(kidNextInFlow); if (nsnull != kidNextInFlow) { // Remove all of the childs next-in-flows - DeleteChildsNextInFlow(mFirstChild); + DeleteChildsNextInFlow(aPresContext, mFirstChild); } } else { diff --git a/mozilla/layout/html/base/src/nsHTMLBullet.cpp b/mozilla/layout/html/base/src/nsHTMLBullet.cpp index 1253dcf1551..83f13a5aeb1 100644 --- a/mozilla/layout/html/base/src/nsHTMLBullet.cpp +++ b/mozilla/layout/html/base/src/nsHTMLBullet.cpp @@ -75,7 +75,7 @@ public: NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); // nsIFrame - NS_IMETHOD DeleteFrame(); + NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); NS_IMETHOD Paint(nsIPresContext &aCX, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect); @@ -194,11 +194,11 @@ BulletFrame::QueryInterface(REFNSIID aIID, void** aInstancePtrResult) } NS_METHOD -BulletFrame::DeleteFrame() +BulletFrame::DeleteFrame(nsIPresContext& aPresContext) { // Release image loader first so that it's refcnt can go to zero mImageLoader.DestroyLoader(); - return nsFrame::DeleteFrame(); + return nsFrame::DeleteFrame(aPresContext); } NS_METHOD diff --git a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp index 6dec65699f1..504841ec65b 100644 --- a/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp +++ b/mozilla/layout/html/base/src/nsHTMLContainerFrame.cpp @@ -332,7 +332,7 @@ nsHTMLContainerFrame::ContentDeleted(nsIPresShell* aShell, nsIFrame* nextInFlow; deadFrame->GetNextInFlow(nextInFlow); deadFrame->BreakFromNextFlow(); - deadFrame->DeleteFrame(); + deadFrame->DeleteFrame(*aPresContext); deadFrame = nextInFlow; if (nsnull != deadFrame) { diff --git a/mozilla/layout/html/base/src/nsHTMLImage.cpp b/mozilla/layout/html/base/src/nsHTMLImage.cpp index 3e1b8680699..fc9f7abaceb 100644 --- a/mozilla/layout/html/base/src/nsHTMLImage.cpp +++ b/mozilla/layout/html/base/src/nsHTMLImage.cpp @@ -96,7 +96,7 @@ class ImageFrame : public ImageFrameSuper { public: ImageFrame(nsIContent* aContent, nsIFrame* aParentFrame); - NS_IMETHOD DeleteFrame(); + NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); NS_IMETHOD SizeOf(nsISizeOfHandler* aHandler) const; NS_IMETHOD Paint(nsIPresContext& aPresContext, nsIRenderingContext& aRenderingContext, @@ -377,14 +377,14 @@ ImageFrame::~ImageFrame() } NS_METHOD -ImageFrame::DeleteFrame() +ImageFrame::DeleteFrame(nsIPresContext& aPresContext) { NS_IF_RELEASE(mImageMap); // Release image loader first so that it's refcnt can go to zero mImageLoader.DestroyLoader(); - return nsLeafFrame::DeleteFrame(); + return nsLeafFrame::DeleteFrame(aPresContext); } NS_IMETHODIMP diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp index fa0edf00952..bea7e691974 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp @@ -722,7 +722,7 @@ NS_METHOD nsTableOuterFrame::VerifyTree() const * @param aChild child this child's next-in-flow * @return PR_TRUE if successful and PR_FALSE otherwise */ -PRBool nsTableOuterFrame::DeleteChildsNextInFlow(nsIFrame* aChild) +PRBool nsTableOuterFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame* aChild) { NS_PRECONDITION(IsChild(aChild), "bad geometric parent"); @@ -741,7 +741,7 @@ PRBool nsTableOuterFrame::DeleteChildsNextInFlow(nsIFrame* aChild) nextInFlow->GetNextInFlow(nextNextInFlow); if (nsnull != nextNextInFlow) { - parent->DeleteChildsNextInFlow(nextInFlow); + parent->DeleteChildsNextInFlow(aPresContext, nextInFlow); } #ifdef NS_DEBUG @@ -800,7 +800,7 @@ PRBool nsTableOuterFrame::DeleteChildsNextInFlow(nsIFrame* aChild) } // Delete the next-in-flow frame and adjust it's parent's child count - nextInFlow->DeleteFrame(); + nextInFlow->DeleteFrame(aPresContext); parent->mChildCount--; #ifdef NS_DEBUG diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.h b/mozilla/layout/html/table/src/nsTableOuterFrame.h index 8acdf821270..cc3b17ef123 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.h +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.h @@ -116,7 +116,7 @@ protected: * @param aChild child this child's next-in-flow * @return PR_TRUE if successful and PR_FALSE otherwise */ - PRBool DeleteChildsNextInFlow(nsIFrame* aChild); + PRBool DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame* aChild); /** * Create the inner table frame (nsTableFrame). Handles initial diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index fa0edf00952..bea7e691974 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/layout/tables/nsTableOuterFrame.cpp @@ -722,7 +722,7 @@ NS_METHOD nsTableOuterFrame::VerifyTree() const * @param aChild child this child's next-in-flow * @return PR_TRUE if successful and PR_FALSE otherwise */ -PRBool nsTableOuterFrame::DeleteChildsNextInFlow(nsIFrame* aChild) +PRBool nsTableOuterFrame::DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame* aChild) { NS_PRECONDITION(IsChild(aChild), "bad geometric parent"); @@ -741,7 +741,7 @@ PRBool nsTableOuterFrame::DeleteChildsNextInFlow(nsIFrame* aChild) nextInFlow->GetNextInFlow(nextNextInFlow); if (nsnull != nextNextInFlow) { - parent->DeleteChildsNextInFlow(nextInFlow); + parent->DeleteChildsNextInFlow(aPresContext, nextInFlow); } #ifdef NS_DEBUG @@ -800,7 +800,7 @@ PRBool nsTableOuterFrame::DeleteChildsNextInFlow(nsIFrame* aChild) } // Delete the next-in-flow frame and adjust it's parent's child count - nextInFlow->DeleteFrame(); + nextInFlow->DeleteFrame(aPresContext); parent->mChildCount--; #ifdef NS_DEBUG diff --git a/mozilla/layout/tables/nsTableOuterFrame.h b/mozilla/layout/tables/nsTableOuterFrame.h index 8acdf821270..cc3b17ef123 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.h +++ b/mozilla/layout/tables/nsTableOuterFrame.h @@ -116,7 +116,7 @@ protected: * @param aChild child this child's next-in-flow * @return PR_TRUE if successful and PR_FALSE otherwise */ - PRBool DeleteChildsNextInFlow(nsIFrame* aChild); + PRBool DeleteChildsNextInFlow(nsIPresContext& aPresContext, nsIFrame* aChild); /** * Create the inner table frame (nsTableFrame). Handles initial