From 3bb8ea5ca644890c55bff2d2d39cb8d651ca24eb Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Tue, 11 Oct 2022 21:01:28 +0000 Subject: [PATCH] Bug 1794456 Part 4 - Remove unused nsFrameList::Enumerator. r=emilio Differential Revision: https://phabricator.services.mozilla.com/D158987 --- layout/generic/nsFrameList.h | 53 ++---------------------------------- layout/generic/nsIFrame.h | 5 ---- 2 files changed, 2 insertions(+), 56 deletions(-) diff --git a/layout/generic/nsFrameList.h b/layout/generic/nsFrameList.h index 39cf4bdb0133..e82d01cbecca 100644 --- a/layout/generic/nsFrameList.h +++ b/layout/generic/nsFrameList.h @@ -362,17 +362,13 @@ class nsFrameList { static inline const nsFrameList& EmptyList(); - class Enumerator; - /** * A class representing a slice of a frame list. */ class Slice { - friend class Enumerator; - public: - // Implicit on purpose, so that we can easily create enumerators from - // nsFrameList via this impicit constructor. + // Implicit on purpose, so that we can easily create Slice from nsFrameList + // via this impicit constructor. MOZ_IMPLICIT Slice(const nsFrameList& aList) : mStart(aList.FirstChild()), mEnd(nullptr) {} Slice(nsIFrame* aStart, nsIFrame* aEnd) : mStart(aStart), mEnd(aEnd) {} @@ -390,51 +386,6 @@ class nsFrameList { nsIFrame* const mEnd; }; - class Enumerator { - public: - explicit Enumerator(const Slice& aSlice) - : mFrame(aSlice.mStart), mEnd(aSlice.mEnd) {} - - Enumerator(const Enumerator& aOther) = default; - - bool AtEnd() const { - // Can't just check mEnd, because some table code goes and destroys the - // tail of the frame list (including mEnd!) while iterating over the - // frame list. - return !mFrame || mFrame == mEnd; - } - - /* Next() needs to know about nsIFrame, and nsIFrame will need to - know about nsFrameList methods, so in order to inline this put - the implementation in nsIFrame.h */ - inline void Next(); - - /** - * Get the current frame we're pointing to. Do not call this on an - * iterator that is at end! - */ - nsIFrame* get() const { - MOZ_ASSERT(!AtEnd(), "Enumerator is at end"); - return mFrame; - } - - /** - * Get an enumerator that is just like this one, but not limited in terms of - * the part of the list it will traverse. - */ - Enumerator GetUnlimitedEnumerator() const { - return Enumerator(*this, nullptr); - } - - protected: - Enumerator(const Enumerator& aOther, const nsIFrame* const aNewEnd) - : mFrame(aOther.mFrame), mEnd(aNewEnd) {} - - nsIFrame* mFrame; // our current frame. - const nsIFrame* const mEnd; // The first frame we should NOT enumerate. - // May be null. - }; - template class Iterator final { public: diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 794ca2d51585..d617e1af215d 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -5725,11 +5725,6 @@ inline bool nsFrameList::StartRemoveFrame(nsIFrame* aFrame) { return ContinueRemoveFrame(aFrame); } -inline void nsFrameList::Enumerator::Next() { - NS_ASSERTION(!AtEnd(), "Should have checked AtEnd()!"); - mFrame = mFrame->GetNextSibling(); -} - // Operators of nsFrameList::Iterator // ---------------------------------------------------