From 476ac2cf3432272f24faac654b183c8d08b7e10a Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 9 Sep 2010 08:21:46 -0700 Subject: [PATCH] Remove unneeded nsDisplayClip::mClippingFrame. (Bug 459144, patch 11) r=roc a2.0=blocking2.0:beta6 --- layout/base/nsDisplayList.cpp | 16 ++++++++-------- layout/base/nsDisplayList.h | 12 ++---------- layout/base/nsPresShell.cpp | 2 +- layout/generic/nsFrame.cpp | 8 ++++---- layout/generic/nsSubDocumentFrame.cpp | 2 +- 5 files changed, 16 insertions(+), 24 deletions(-) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 6000d8e6d4c2..856fee09f20b 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -1287,18 +1287,18 @@ nsDisplayOwnLayer::BuildLayer(nsDisplayListBuilder* aBuilder, } nsDisplayClip::nsDisplayClip(nsDisplayListBuilder* aBuilder, - nsIFrame* aFrame, nsIFrame* aClippingFrame, - nsDisplayItem* aItem, const nsRect& aRect) + nsIFrame* aFrame, nsDisplayItem* aItem, + const nsRect& aRect) : nsDisplayWrapList(aBuilder, aFrame, aItem), - mClippingFrame(aClippingFrame), mClip(aRect) { + mClip(aRect) { MOZ_COUNT_CTOR(nsDisplayClip); } nsDisplayClip::nsDisplayClip(nsDisplayListBuilder* aBuilder, - nsIFrame* aFrame, nsIFrame* aClippingFrame, - nsDisplayList* aList, const nsRect& aRect) + nsIFrame* aFrame, nsDisplayList* aList, + const nsRect& aRect) : nsDisplayWrapList(aBuilder, aFrame, aList), - mClippingFrame(aClippingFrame), mClip(aRect) { + mClip(aRect) { MOZ_COUNT_CTOR(nsDisplayClip); } @@ -1340,7 +1340,7 @@ PRBool nsDisplayClip::TryMerge(nsDisplayListBuilder* aBuilder, if (aItem->GetType() != TYPE_CLIP) return PR_FALSE; nsDisplayClip* other = static_cast(aItem); - if (other->mClip != mClip || other->mClippingFrame != mClippingFrame) + if (other->mClip != mClip) return PR_FALSE; mList.AppendToBottom(&other->mList); return PR_TRUE; @@ -1349,7 +1349,7 @@ PRBool nsDisplayClip::TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayWrapList* nsDisplayClip::WrapWithClone(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) { return new (aBuilder) - nsDisplayClip(aBuilder, aItem->GetUnderlyingFrame(), mClippingFrame, aItem, mClip); + nsDisplayClip(aBuilder, aItem->GetUnderlyingFrame(), aItem, mClip); } nsDisplayZoom::nsDisplayZoom(nsDisplayListBuilder* aBuilder, diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index ecd39c851291..978c70eac173 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -1577,14 +1577,12 @@ class nsDisplayClip : public nsDisplayWrapList { public: /** * @param aFrame the frame that should be considered the underlying - * frame for this content, e.g. the frame whose z-index we have. - * @param aClippingFrame the frame that is inducing the clipping. + * frame for this content, e.g. the frame whose z-index we have. This + * is *not* the frame that is inducing the clipping. */ nsDisplayClip(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, - nsIFrame* aClippingFrame, nsDisplayItem* aItem, const nsRect& aRect); nsDisplayClip(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, - nsIFrame* aClippingFrame, nsDisplayList* aList, const nsRect& aRect); #ifdef NS_BUILD_REFCNT_LOGGING virtual ~nsDisplayClip(); @@ -1600,17 +1598,11 @@ public: const nsRect& GetClipRect() { return mClip; } void SetClipRect(const nsRect& aRect) { mClip = aRect; } - nsIFrame* GetClippingFrame() { return mClippingFrame; } virtual nsDisplayWrapList* WrapWithClone(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem); private: - // The frame that is responsible for the clipping. This may be different - // from mFrame because mFrame represents the content that is being - // clipped, and for example may be used to obtain the z-index of the - // content. - nsIFrame* mClippingFrame; nsRect mClip; }; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 86f6bbd6a545..a6ac3a1f14af 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -5377,7 +5377,7 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder, // the selection. If the allocation fails, fall through and delete // the item below. itemToInsert = new (aBuilder) - nsDisplayClip(aBuilder, frame, frame, i, textRect); + nsDisplayClip(aBuilder, frame, i, textRect); } } // Don't try to descend into subdocuments. diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 22fe1a7d6a6b..f06e289b7407 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1259,13 +1259,13 @@ public: // We are not a stacking context root. There is no valid underlying // frame for the whole list. These items are all in-flow descendants so // we can safely just clip them. - return new (aBuilder) nsDisplayClip(aBuilder, nsnull, mContainer, aList, mRect); + return new (aBuilder) nsDisplayClip(aBuilder, nsnull, aList, mRect); } virtual nsDisplayItem* WrapItem(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) { nsIFrame* f = aItem->GetUnderlyingFrame(); if (mClipAll || nsLayoutUtils::IsProperAncestorFrame(mContainer, f, nsnull)) - return new (aBuilder) nsDisplayClip(aBuilder, f, mContainer, aItem, mRect); + return new (aBuilder) nsDisplayClip(aBuilder, f, aItem, mRect); return aItem; } protected: @@ -1284,12 +1284,12 @@ public: nsIFrame* aFrame, nsDisplayList* aList) { // We are not a stacking context root. There is no valid underlying // frame for the whole list. - return new (aBuilder) nsDisplayClip(aBuilder, nsnull, mContainer, aList, mRect); + return new (aBuilder) nsDisplayClip(aBuilder, nsnull, aList, mRect); } virtual nsDisplayItem* WrapItem(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) { return new (aBuilder) nsDisplayClip(aBuilder, aItem->GetUnderlyingFrame(), - mContainer, aItem, mRect); + aItem, mRect); } protected: nsIFrame* mContainer; diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index 657307c779aa..a0701f1a78b0 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -376,7 +376,7 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, // Clip children to the child root frame's rectangle rv = aLists.Content()->AppendNewToTop( - new (aBuilder) nsDisplayClip(aBuilder, this, this, &childItems, + new (aBuilder) nsDisplayClip(aBuilder, this, &childItems, subdocBoundsInParentUnits)); } // delete childItems in case of OOM