Make nsFrameList::RemoveFramesAfter(nsnull) remove the whole list. (Bug 563584, patch 11.5) r=roc
authorL. David Baron <dbaron@dbaron.org>
Thu, 05 Aug 2010 21:59:19 -0700
changeset 48988 2abf47cd611e624da4685299fd76d47af0ba4655
parent 48987 29ee630d1cc84f29feeb15848f8bce561acb0304
child 48989 c3f25dd3c232f3aaa97b71d96f20e8493bfbec3e
push id14884
push userdbaron@mozilla.com
push dateFri, 06 Aug 2010 05:01:26 +0000
treeherderautoland@8ab7ef79b673 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs563584
milestone2.0b4pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Make nsFrameList::RemoveFramesAfter(nsnull) remove the whole list. (Bug 563584, patch 11.5) r=roc
layout/generic/nsFrameList.cpp
layout/generic/nsFrameList.h
--- a/layout/generic/nsFrameList.cpp
+++ b/layout/generic/nsFrameList.cpp
@@ -150,16 +150,22 @@ nsFrameList::RemoveFrameIfPresent(nsIFra
     }
   }
   return PR_FALSE;
 }
 
 nsFrameList
 nsFrameList::RemoveFramesAfter(nsIFrame* aAfterFrame)
 {
+  if (!aAfterFrame) {
+    nsFrameList result;
+    result.InsertFrames(nsnull, nsnull, *this);
+    return result;
+  }
+
   NS_PRECONDITION(NotEmpty(), "illegal operation on empty list");
 #ifdef DEBUG_FRAME_LIST
   NS_PRECONDITION(ContainsFrame(aAfterFrame), "wrong list");
 #endif
 
   nsIFrame* tail = aAfterFrame->GetNextSibling();
   // if (!tail) return EmptyList();  -- worth optimizing this case?
   nsIFrame* oldLastChild = mLastChild;
--- a/layout/generic/nsFrameList.h
+++ b/layout/generic/nsFrameList.h
@@ -147,18 +147,19 @@ public:
    * Take aFrame out of the frame list, if present. This also disconnects
    * aFrame from the sibling list. aFrame must be non-null but is not
    * required to be on the list.
    * @return PR_TRUE if aFrame was removed
    */
   PRBool RemoveFrameIfPresent(nsIFrame* aFrame);
 
   /**
-   * Take the frames after aAfterFrame out of the frame list.
-   * @param aAfterFrame a frame in this list
+   * Take the frames after aAfterFrame out of the frame list.  If
+   * aAfterFrame is null, removes the entire list.
+   * @param aAfterFrame a frame in this list, or null
    * @return the removed frames, if any
    */
   nsFrameList RemoveFramesAfter(nsIFrame* aAfterFrame);
 
   /**
    * Take the first frame (if any) out of the frame list.
    * @return the first child, or nsnull if the list is empty
    */