Bug 501847 part 5. Get rid of the MoveFrames function now that there is only one caller. r=tn,roc
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 18 Sep 2009 14:00:23 -0400
changeset 34463 5bc1c85439bf3f4119de5cef6709376c73a7bf14
parent 34462 822ba7ef29bb7dbec1f4a7f2056721d8c5424034
child 34464 0f12f3edad42d3620c7d2eaa784bc8c2df622e82
push id10058
push userbzbarsky@mozilla.com
push dateMon, 02 Nov 2009 03:43:27 +0000
treeherdermozilla-central@0f12f3edad42 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn, roc
bugs501847
milestone1.9.3a1pre
Bug 501847 part 5. Get rid of the MoveFrames function now that there is only one caller. r=tn,roc
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSFrameConstructor.h
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -10894,62 +10894,42 @@ nsCSSFrameConstructor::CreateIBSiblings(
 
     // Any frame might need a view
     nsHTMLContainerFrame::CreateViewForFrame(inlineFrame, PR_FALSE);
 
     if (aChildItems.NotEmpty()) {
       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);
     aSiblings.AddChild(inlineFrame);
     lastNewInline = inlineFrame;
   } while (aChildItems.NotEmpty());
 
   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)
 {
   // XXXbz should we preallocate aParentItem.mChildItems to some sane
   // length?  Maybe even to parentContent->GetChildCount()?
 
   // Probe for generated content before
   nsStyleContext* const parentStyleContext = aParentItem.mStyleContext;
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -1472,32 +1472,16 @@ private:
    */
   void CreateIBSiblings(nsFrameConstructorState& aState,
                         nsIFrame* aInitialInline,
                         PRBool aIsPositioned,
                         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.
    */
   void BuildInlineChildItems(nsFrameConstructorState& aState,
                              FrameConstructionItem& aParentItem);
 
   // Determine whether we need to wipe out what we just did and start over
   // because we're doing something like adding block kids to an inline frame