Bug 851849 - Make nsBlockFrame::AddFrames() return void since it can't fail, and non-virtual since it's not meant to be overridden. Add a post-condition that the given

aFrameList is empty.  r=bzbarsky
This commit is contained in:
Mats Palmgren 2013-03-23 21:10:34 +01:00
parent 0e54488c73
commit 10dc9659ed
2 changed files with 17 additions and 26 deletions

View File

@ -4750,12 +4750,8 @@ nsBlockFrame::AppendFrames(ChildListID aListID,
}
printf("\n");
#endif
nsresult rv = AddFrames(aFrameList, lastKid);
if (NS_FAILED(rv)) {
return rv;
}
aFrameList.Clear();
AddFrames(aFrameList, lastKid);
PresContext()->PresShell()->
FrameNeedsReflow(this, nsIPresShell::eTreeChange,
NS_FRAME_HAS_DIRTY_CHILDREN); // XXX sufficient?
@ -4797,10 +4793,9 @@ nsBlockFrame::InsertFrames(ChildListID aListID,
}
printf("\n");
#endif
nsresult rv = AddFrames(aFrameList, aPrevFrame);
if (NS_FAILED(rv)) {
return rv;
}
AddFrames(aFrameList, aPrevFrame);
#ifdef IBMBIDI
if (aListID != kNoReflowPrincipalList)
#endif // IBMBIDI
@ -4826,14 +4821,14 @@ ShouldPutNextSiblingOnNewLine(nsIFrame* aLastFrame)
return false;
}
nsresult
void
nsBlockFrame::AddFrames(nsFrameList& aFrameList, nsIFrame* aPrevSibling)
{
// Clear our line cursor, since our lines may change.
ClearLineCursor();
if (aFrameList.IsEmpty()) {
return NS_OK;
return;
}
// If we're inserting at the beginning of our list and we have an
@ -4954,9 +4949,9 @@ nsBlockFrame::AddFrames(nsFrameList& aFrameList, nsIFrame* aPrevSibling)
}
#ifdef DEBUG
MOZ_ASSERT(aFrameList.IsEmpty());
VerifyLines(true);
#endif
return NS_OK;
}
void
@ -6473,8 +6468,6 @@ nsBlockFrame::SetInitialChildList(ChildListID aListID,
NS_BLOCK_FRAME_HAS_OUTSIDE_BULLET)) == 0,
"how can we have a bullet already?");
nsresult rv = NS_OK;
if (kAbsoluteList == aListID) {
nsContainerFrame::SetInitialChildList(aListID, aChildList);
}
@ -6508,10 +6501,7 @@ nsBlockFrame::SetInitialChildList(ChildListID aListID,
"NS_BLOCK_HAS_FIRST_LETTER_STYLE state out of sync");
#endif
rv = AddFrames(aChildList, nullptr);
if (NS_FAILED(rv)) {
return rv;
}
AddFrames(aChildList, nullptr);
// Create a list bullet if this is a list-item. Note that this is
// done here so that RenumberLists will work (it needs the bullets

View File

@ -414,14 +414,15 @@ protected:
nscoord aBottomEdgeOfChildren,
nsOverflowAreas& aOverflowAreas);
/** add the frames in aFrameList to this block after aPrevSibling
* this block thinks in terms of lines, but the frame construction code
* knows nothing about lines at all. So we need to find the line that
* contains aPrevSibling and add aFrameList after aPrevSibling on that line.
* new lines are created as necessary to handle block data in aFrameList.
* This function will clear aFrameList.
*/
virtual nsresult AddFrames(nsFrameList& aFrameList, nsIFrame* aPrevSibling);
/**
* Add the frames in aFrameList to this block after aPrevSibling.
* This block thinks in terms of lines, but the frame construction code
* knows nothing about lines at all so we need to find the line that
* contains aPrevSibling and add aFrameList after aPrevSibling on that line.
* New lines are created as necessary to handle block data in aFrameList.
* This function will clear aFrameList.
*/
void AddFrames(nsFrameList& aFrameList, nsIFrame* aPrevSibling);
#ifdef IBMBIDI
/**