diff --git a/layout/generic/nsFrameList.cpp b/layout/generic/nsFrameList.cpp index be479709749..b80ba0171e8 100644 --- a/layout/generic/nsFrameList.cpp +++ b/layout/generic/nsFrameList.cpp @@ -155,6 +155,12 @@ nsFrameList::RemoveFrameIfPresent(nsIFrame* aFrame) 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"); diff --git a/layout/generic/nsFrameList.h b/layout/generic/nsFrameList.h index e8288d2e8bb..7cb750dd97c 100644 --- a/layout/generic/nsFrameList.h +++ b/layout/generic/nsFrameList.h @@ -152,8 +152,9 @@ public: 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);