From ba011ecd803d475bae0680ae3f0cd90506031c89 Mon Sep 17 00:00:00 2001 From: "dbaron%fas.harvard.edu" Date: Sun, 6 Jan 2002 18:17:41 +0000 Subject: [PATCH] Clean up nsBlockFrame::RemoveFrame and add assertion to nsFrameList. b=114222 r=waterson sr=kin git-svn-id: svn://10.0.0.236/trunk@111449 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/src/nsFrameList.cpp | 1 + mozilla/layout/generic/nsBlockFrame.cpp | 19 +++++++++---------- mozilla/layout/generic/nsFrameList.cpp | 1 + mozilla/layout/html/base/src/nsBlockFrame.cpp | 19 +++++++++---------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/mozilla/layout/base/src/nsFrameList.cpp b/mozilla/layout/base/src/nsFrameList.cpp index 3d223eb092f..7f02b207e7b 100644 --- a/mozilla/layout/base/src/nsFrameList.cpp +++ b/mozilla/layout/base/src/nsFrameList.cpp @@ -186,6 +186,7 @@ nsFrameList::RemoveFrame(nsIFrame* aFrame) } else { nsIFrame* prevSibling = GetPrevSiblingFor(aFrame); + NS_ASSERTION(prevSibling, "removing frame not in list"); if (nsnull != prevSibling) { prevSibling->SetNextSibling(nextFrame); return PR_TRUE; diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index b7a43813a58..df8adf99b92 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -4841,8 +4841,12 @@ nsBlockFrame::RemoveFrame(nsIPresContext* aPresContext, printf("\n"); #endif - if (nsLayoutAtoms::absoluteList == aListName) { - return mAbsoluteContainer.RemoveFrame(this, aPresContext, aPresShell, aListName, aOldFrame); + if (nsnull == aListName) { + rv = DoRemoveFrame(aPresContext, aOldFrame); + } + else if (nsLayoutAtoms::absoluteList == aListName) { + return mAbsoluteContainer.RemoveFrame(this, aPresContext, aPresShell, + aListName, aOldFrame); } else if (nsLayoutAtoms::floaterList == aListName) { // Find which line contains the floater @@ -4863,19 +4867,14 @@ nsBlockFrame::RemoveFrame(nsIPresContext* aPresContext, } #ifdef IBMBIDI else if (nsLayoutAtoms::nextBidi == aListName) { - rv = DoRemoveFrame(aPresContext, aOldFrame); + // Skip the call to |ReflowDirtyChild| below by returning now. + return DoRemoveFrame(aPresContext, aOldFrame); } #endif // IBMBIDI - else if (nsnull != aListName) { + else { rv = NS_ERROR_INVALID_ARG; } - else { - rv = DoRemoveFrame(aPresContext, aOldFrame); - } -#ifdef IBMBIDI - if (nsLayoutAtoms::nextBidi != aListName) -#endif // IBMBIDI if (NS_SUCCEEDED(rv)) { // Ask the parent frame to reflow me. ReflowDirtyChild(&aPresShell, nsnull); diff --git a/mozilla/layout/generic/nsFrameList.cpp b/mozilla/layout/generic/nsFrameList.cpp index 3d223eb092f..7f02b207e7b 100644 --- a/mozilla/layout/generic/nsFrameList.cpp +++ b/mozilla/layout/generic/nsFrameList.cpp @@ -186,6 +186,7 @@ nsFrameList::RemoveFrame(nsIFrame* aFrame) } else { nsIFrame* prevSibling = GetPrevSiblingFor(aFrame); + NS_ASSERTION(prevSibling, "removing frame not in list"); if (nsnull != prevSibling) { prevSibling->SetNextSibling(nextFrame); return PR_TRUE; diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index b7a43813a58..df8adf99b92 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -4841,8 +4841,12 @@ nsBlockFrame::RemoveFrame(nsIPresContext* aPresContext, printf("\n"); #endif - if (nsLayoutAtoms::absoluteList == aListName) { - return mAbsoluteContainer.RemoveFrame(this, aPresContext, aPresShell, aListName, aOldFrame); + if (nsnull == aListName) { + rv = DoRemoveFrame(aPresContext, aOldFrame); + } + else if (nsLayoutAtoms::absoluteList == aListName) { + return mAbsoluteContainer.RemoveFrame(this, aPresContext, aPresShell, + aListName, aOldFrame); } else if (nsLayoutAtoms::floaterList == aListName) { // Find which line contains the floater @@ -4863,19 +4867,14 @@ nsBlockFrame::RemoveFrame(nsIPresContext* aPresContext, } #ifdef IBMBIDI else if (nsLayoutAtoms::nextBidi == aListName) { - rv = DoRemoveFrame(aPresContext, aOldFrame); + // Skip the call to |ReflowDirtyChild| below by returning now. + return DoRemoveFrame(aPresContext, aOldFrame); } #endif // IBMBIDI - else if (nsnull != aListName) { + else { rv = NS_ERROR_INVALID_ARG; } - else { - rv = DoRemoveFrame(aPresContext, aOldFrame); - } -#ifdef IBMBIDI - if (nsLayoutAtoms::nextBidi != aListName) -#endif // IBMBIDI if (NS_SUCCEEDED(rv)) { // Ask the parent frame to reflow me. ReflowDirtyChild(&aPresShell, nsnull);