From c060c98048154c7c662351497008a4c35b583b43 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 18 Sep 2009 14:00:23 -0400 Subject: [PATCH] Bug 501847 part 5. Get rid of the MoveFrames function now that there is only one caller. r=tn,roc --- layout/base/nsCSSFrameConstructor.cpp | 50 ++++++++------------------- layout/base/nsCSSFrameConstructor.h | 16 --------- 2 files changed, 15 insertions(+), 51 deletions(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 0c3a6bd08182..d6fd88c6612d 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -10899,7 +10899,21 @@ nsCSSFrameConstructor::CreateIBSiblings(nsFrameConstructorState& aState, nsFrameList::FrameLinkEnumerator firstBlock(aChildItems); FindFirstBlock(firstBlock); nsFrameList inlineKids = aChildItems.ExtractHead(firstBlock); - MoveFramesToEndOfIBSplit(aState, inlineFrame, inlineKids, nsnull); + + nsIFrame* newFirstChild = inlineKids.FirstChild(); + if (inlineFrame->HasView() || aInitialInline->HasView()) { + // Move the frames into the new view + nsHTMLContainerFrame::ReparentFrameViewList(aState.mPresContext, + inlineKids, aInitialInline, + inlineFrame); + } + + // Save the first frame in inlineKids for the MoveChildrenTo call, since + // SetInitialChildList will empty inlineKids. + inlineFrame->SetInitialChildList(nsnull, inlineKids); + + MoveChildrenTo(aState.mFrameManager, inlineFrame, newFirstChild, + nsnull, nsnull, nsnull); } SetFrameIsSpecial(blockFrame, inlineFrame); @@ -10910,40 +10924,6 @@ nsCSSFrameConstructor::CreateIBSiblings(nsFrameConstructorState& aState, SetFrameIsSpecial(lastNewInline, nsnull); } -void -nsCSSFrameConstructor::MoveFramesToEndOfIBSplit(nsFrameConstructorState& aState, - nsIFrame* aExistingEndFrame, - nsFrameList& aFramesToMove, - nsFrameConstructorState* aTargetState) -{ - NS_PRECONDITION(aExistingEndFrame, "Must have trailing inline"); - NS_PRECONDITION(aFramesToMove.NotEmpty(), "Must have frames to move"); - - nsIFrame* newFirstChild = aFramesToMove.FirstChild(); - if (aExistingEndFrame->HasView() || - newFirstChild->GetParent()->HasView()) { - // Move the frames into the new view - nsHTMLContainerFrame::ReparentFrameViewList(aState.mPresContext, - aFramesToMove, - newFirstChild->GetParent(), - aExistingEndFrame); - } - - // Reparent (cheaply) the child frames. Have to grab the frame pointers - // for MoveChildrenTo now, since aFramesToMove will get cleared when we add - // the frames to aExistingEndFrame. We already have newFirstChild. - nsIFrame* existingFirstChild = aExistingEndFrame->GetFirstChild(nsnull); - if (!existingFirstChild && - (aExistingEndFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) { - aExistingEndFrame->SetInitialChildList(nsnull, aFramesToMove); - } else { - aExistingEndFrame->InsertFrames(nsnull, nsnull, aFramesToMove); - } - nsFrameConstructorState* startState = aTargetState ? &aState : nsnull; - MoveChildrenTo(aState.mFrameManager, aExistingEndFrame, newFirstChild, - existingFirstChild, aTargetState, startState); -} - void nsCSSFrameConstructor::BuildInlineChildItems(nsFrameConstructorState& aState, FrameConstructionItem& aParentItem) diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index b90ca44d848b..92895f92a828 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -1476,22 +1476,6 @@ private: nsFrameItems& aChildItems, nsFrameItems& aSiblings); - /** - * Move an already-constructed framelist into the inline frame at - * the tail end of an {ib} split. - * - * @param aState the frame construction state we're using right now. - * @param aExistingEndFrame the already-existing end frame. - * @param aFramesToMove The frame list to move over. Must be nonempty. - * @param aTargetState if non-null, the target state to pass to - * MoveChildrenTo for float reparenting. - * XXXbz test float reparenting? - */ - void MoveFramesToEndOfIBSplit(nsFrameConstructorState& aState, - nsIFrame* aExistingEndFrame, - nsFrameList& aFramesToMove, - nsFrameConstructorState* aTargetState); - /** * For an inline aParentItem, construct its list of child * FrameConstructionItems and set its mIsAllInline flag appropriately.