From 8b24a5ee5fb6c7e22314a228cb8a6ad5cf2e08c4 Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Thu, 28 Feb 2013 00:05:45 +0100 Subject: [PATCH] Bug 838706 - Remove Destroy/RemoveFrameIfPresent O(n) methods. All consumers are now using Start/ContinueRemoveFrame instead which are O(1). r=bzbarsky --- layout/generic/nsFrameList.cpp | 26 -------------------------- layout/generic/nsFrameList.h | 15 --------------- 2 files changed, 41 deletions(-) diff --git a/layout/generic/nsFrameList.cpp b/layout/generic/nsFrameList.cpp index da7d2a30db44..2d8bde5373ac 100644 --- a/layout/generic/nsFrameList.cpp +++ b/layout/generic/nsFrameList.cpp @@ -101,20 +101,6 @@ nsFrameList::RemoveFrame(nsIFrame* aFrame) } } -bool -nsFrameList::RemoveFrameIfPresent(nsIFrame* aFrame) -{ - NS_PRECONDITION(aFrame, "null ptr"); - - for (Enumerator e(*this); !e.AtEnd(); e.Next()) { - if (e.get() == aFrame) { - RemoveFrame(aFrame); - return true; - } - } - return false; -} - nsFrameList nsFrameList::RemoveFramesAfter(nsIFrame* aAfterFrame) { @@ -156,18 +142,6 @@ nsFrameList::DestroyFrame(nsIFrame* aFrame) aFrame->Destroy(); } -bool -nsFrameList::DestroyFrameIfPresent(nsIFrame* aFrame) -{ - NS_PRECONDITION(aFrame, "null ptr"); - - if (RemoveFrameIfPresent(aFrame)) { - aFrame->Destroy(); - return true; - } - return false; -} - nsFrameList::Slice nsFrameList::InsertFrames(nsIFrame* aParent, nsIFrame* aPrevSibling, nsFrameList& aFrameList) diff --git a/layout/generic/nsFrameList.h b/layout/generic/nsFrameList.h index 1464e8d5b5f5..d076717468ce 100644 --- a/layout/generic/nsFrameList.h +++ b/layout/generic/nsFrameList.h @@ -137,14 +137,6 @@ public: */ void RemoveFrame(nsIFrame* aFrame); - /** - * 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 true if aFrame was removed - */ - bool RemoveFrameIfPresent(nsIFrame* aFrame); - /** * Take the frames after aAfterFrame out of the frame list. If * aAfterFrame is null, removes the entire list. @@ -195,13 +187,6 @@ public: */ void DestroyFrame(nsIFrame* aFrame); - /** - * If aFrame is present on this list then take it out of the list and - * then destroy it. The frame must be non-null. - * @return true if the frame was found - */ - bool DestroyFrameIfPresent(nsIFrame* aFrame); - /** * Insert aFrame right after aPrevSibling, or prepend it to this * list if aPrevSibling is null. If aParent is not null, also