From 4e3da44c462967c1d80273490bae42939ba534c8 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Thu, 12 Apr 2012 00:34:23 +1200 Subject: [PATCH] Backing out changesets ef599d7f3f11, 70ef464f50e3 and 1a204c38918e (bug 735898) due to test failures. --- layout/base/nsDisplayList.cpp | 26 ++++++++++++-------------- layout/base/nsDisplayList.h | 20 +++++--------------- layout/generic/nsFrame.cpp | 30 ++++++------------------------ layout/generic/nsFrame.h | 6 +----- layout/tables/nsTableFrame.cpp | 3 +-- 5 files changed, 25 insertions(+), 60 deletions(-) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 0cd6b058a4b9..f3d918dfc83a 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -1569,14 +1569,12 @@ nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList) : nsDisplayItem(aBuilder, aFrame) { mList.AppendToTop(aList); - mBounds = mList.GetBounds(aBuilder); } nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayItem* aItem) : nsDisplayItem(aBuilder, aFrame) { mList.AppendToTop(aItem); - mBounds = mList.GetBounds(aBuilder); } nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder, @@ -1597,7 +1595,7 @@ nsDisplayWrapList::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect, nsRect nsDisplayWrapList::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) { *aSnap = false; - return mBounds; + return mList.GetBounds(aBuilder); } bool @@ -1617,7 +1615,6 @@ nsDisplayWrapList::GetOpaqueRegion(nsDisplayListBuilder* aBuilder, *aSnap = false; nsRegion result; if (mList.IsOpaque()) { - // Everything within GetBounds that's visible is opaque. result = GetBounds(aBuilder, aSnap); } return result; @@ -1837,7 +1834,7 @@ bool nsDisplayOpacity::TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* a // aItem->GetUnderlyingFrame() returns non-null because it's nsDisplayOpacity if (aItem->GetUnderlyingFrame()->GetContent() != mFrame->GetContent()) return false; - MergeFrom(static_cast(aItem)); + mList.AppendToBottom(&static_cast(aItem)->mList); return true; } @@ -2005,7 +2002,7 @@ nsDisplayScrollLayer::TryMerge(nsDisplayListBuilder* aBuilder, props.Set(nsIFrame::ScrollLayerCount(), reinterpret_cast(GetScrollLayerCount() - 1)); - MergeFrom(other); + mList.AppendToBottom(&other->mList); // XXX - This ensures that the frame associated with a scroll layer after // merging is the first, rather than the last. This tends to change less, // ensuring we're more likely to retain the associated gfx layer. @@ -2144,13 +2141,13 @@ bool nsDisplayClip::ComputeVisibility(nsDisplayListBuilder* aBuilder, } bool nsDisplayClip::TryMerge(nsDisplayListBuilder* aBuilder, - nsDisplayItem* aItem) { + nsDisplayItem* aItem) { if (aItem->GetType() != TYPE_CLIP) return false; nsDisplayClip* other = static_cast(aItem); if (!other->mClip.IsEqualInterior(mClip)) return false; - MergeFrom(other); + mList.AppendToBottom(&other->mList); return true; } @@ -2245,7 +2242,7 @@ bool nsDisplayClipRoundedRect::TryMerge(nsDisplayListBuilder* aBuilder, nsDispla if (!mClip.IsEqualInterior(other->mClip) || memcmp(mRadii, other->mRadii, sizeof(mRadii)) != 0) return false; - MergeFrom(other); + mList.AppendToBottom(&other->mList); return true; } @@ -2906,7 +2903,8 @@ nsDisplayTransform::TryMerge(nsDisplayListBuilder *aBuilder, /* Now, move everything over to this frame and signal that * we merged things! */ - mStoredList.MergeFrom(&static_cast(aItem)->mStoredList); + mStoredList.GetList()-> + AppendToBottom(&static_cast(aItem)->mStoredList); return true; } @@ -2994,7 +2992,7 @@ bool nsDisplayTransform::UntransformRect(const nsRect &aUntransformedBounds, nsDisplaySVGEffects::nsDisplaySVGEffects(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList) : nsDisplayWrapList(aBuilder, aFrame, aList), mEffectsFrame(aFrame), - mEffectsBounds(aFrame->GetVisualOverflowRectRelativeToSelf()) + mBounds(aFrame->GetVisualOverflowRectRelativeToSelf()) { MOZ_COUNT_CTOR(nsDisplaySVGEffects); } @@ -3061,9 +3059,9 @@ bool nsDisplaySVGEffects::TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem if (aItem->GetUnderlyingFrame()->GetContent() != mFrame->GetContent()) return false; nsDisplaySVGEffects* other = static_cast(aItem); - MergeFrom(other); - mEffectsBounds.UnionRect(mEffectsBounds, - other->mEffectsBounds + other->mEffectsFrame->GetOffsetTo(mEffectsFrame)); + mList.AppendToBottom(&other->mList); + mBounds.UnionRect(mBounds, + other->mBounds + other->mEffectsFrame->GetOffsetTo(mEffectsFrame)); return true; } diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 433858a2f022..2e90cfaff36a 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -1559,9 +1559,6 @@ public: virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap); virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx); NS_DISPLAY_DECL_NAME("Background", TYPE_BACKGROUND) - // Returns the value of GetUnderlyingFrame()->IsThemed(), but cached - bool IsThemed() { return mIsThemed; } - protected: nsRegion GetInsideClipRegion(nsPresContext* aPresContext, PRUint8 aClip, const nsRect& aRect, bool* aSnap); @@ -1704,8 +1701,8 @@ public: nsIFrame* aFrame); virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx); virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder, - nsRegion* aVisibleRegion, - const nsRect& aAllowVisibleRegionExpansion); + nsRegion* aVisibleRegion, + const nsRect& aAllowVisibleRegionExpansion); virtual bool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) { NS_WARNING("This list should already have been flattened!!!"); return false; @@ -1740,15 +1737,8 @@ public: protected: nsDisplayWrapList() {} - - void MergeFrom(nsDisplayWrapList* aOther) - { - mList.AppendToBottom(&aOther->mList); - mBounds.UnionRect(mBounds, aOther->mBounds); - } - + nsDisplayList mList; - nsRect mBounds; }; /** @@ -2075,7 +2065,7 @@ public: HitTestState* aState, nsTArray *aOutFrames); virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) { *aSnap = false; - return mEffectsBounds + aBuilder->ToReferenceFrame(mEffectsFrame); + return mBounds + aBuilder->ToReferenceFrame(mEffectsFrame); } virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx); virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder, @@ -2093,7 +2083,7 @@ public: private: nsIFrame* mEffectsFrame; // relative to mEffectsFrame - nsRect mEffectsBounds; + nsRect mBounds; }; /* A display item that applies a transformation to all of its descendant diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 9325c067652d..9db8aea268fd 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1409,19 +1409,16 @@ nsIFrame::HasBorder() const nsresult nsFrame::DisplayBackgroundUnconditional(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists, - bool aForceBackground, - nsDisplayBackground** aBackground) + bool aForceBackground) { // Here we don't try to detect background propagation. Frames that might // receive a propagated background should just set aForceBackground to // true. if (aBuilder->IsForEventDelivery() || aForceBackground || !GetStyleBackground()->IsTransparent() || GetStyleDisplay()->mAppearance) { - nsDisplayBackground* bg = new (aBuilder) nsDisplayBackground(aBuilder, this); - *aBackground = bg; - return aLists.BorderBackground()->AppendNewToTop(bg); + return aLists.BorderBackground()->AppendNewToTop(new (aBuilder) + nsDisplayBackground(aBuilder, this)); } - *aBackground = nsnull; return NS_OK; } @@ -1443,9 +1440,8 @@ nsFrame::DisplayBorderBackgroundOutline(nsDisplayListBuilder* aBuilder, NS_ENSURE_SUCCESS(rv, rv); } - nsDisplayBackground* bg; nsresult rv = - DisplayBackgroundUnconditional(aBuilder, aLists, aForceBackground, &bg); + DisplayBackgroundUnconditional(aBuilder, aLists, aForceBackground); NS_ENSURE_SUCCESS(rv, rv); if (hasBoxShadow) { @@ -1453,11 +1449,8 @@ nsFrame::DisplayBorderBackgroundOutline(nsDisplayListBuilder* aBuilder, nsDisplayBoxShadowInner(aBuilder, this)); NS_ENSURE_SUCCESS(rv, rv); } - - // If there's a themed background, we should not create a border item. - // It won't be rendered. Calling HasBorder() for themed frames is expensive - // too (calls into native theme code), so avoiding it is valuable. - if ((!bg || !bg->IsThemed()) && HasBorder()) { + + if (HasBorder()) { rv = aLists.BorderBackground()->AppendNewToTop(new (aBuilder) nsDisplayBorder(aBuilder, this)); NS_ENSURE_SUCCESS(rv, rv); @@ -1557,12 +1550,6 @@ public: return new (aBuilder) nsDisplayClipRoundedRect(aBuilder, nsnull, aList, mRect, mRadii); } - bool snap; - if (!aList->IsEmpty() && !aList->GetBottom()->GetAbove() && - mRect.Contains(aList->GetBottom()->GetBounds(aBuilder, &snap))) { - // Single list element which fits in the clip rect. No need to wrap it. - return aList->RemoveBottom(); - } return new (aBuilder) nsDisplayClip(aBuilder, nsnull, aList, mRect); } virtual nsDisplayItem* WrapItem(nsDisplayListBuilder* aBuilder, @@ -1574,11 +1561,6 @@ public: return new (aBuilder) nsDisplayClipRoundedRect(aBuilder, f, aItem, mRect, mRadii); } - bool snap; - if (mRect.Contains(aItem->GetBounds(aBuilder, &snap))) { - // Item fits in the clip rect. No need to wrap it. - return aItem; - } return new (aBuilder) nsDisplayClip(aBuilder, f, aItem, mRect); } return aItem; diff --git a/layout/generic/nsFrame.h b/layout/generic/nsFrame.h index 510f676bf3fc..922cc91eca87 100644 --- a/layout/generic/nsFrame.h +++ b/layout/generic/nsFrame.h @@ -130,7 +130,6 @@ //---------------------------------------------------------------------- struct nsBoxLayoutMetrics; -class nsDisplayBackground; /** * Implementation of a simple frame that's not splittable and has no @@ -510,13 +509,10 @@ public: * background style appears to have no background --- this is useful * for frames that might receive a propagated background via * nsCSSRendering::FindBackground - * @param aBackground *aBackground is set to the new nsDisplayBackground item, - * if one is created, otherwise null. */ nsresult DisplayBackgroundUnconditional(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists, - bool aForceBackground, - nsDisplayBackground** aBackground); + bool aForceBackground = false); /** * Adds display items for standard CSS borders, background and outline for * for this frame, as necessary. Checks IsVisibleForPainting and won't diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index eb4d4e1e8f7f..a2e0cb5b3b4d 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -1281,8 +1281,7 @@ nsTableFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, // in its own display item, so do that to take advantage of // opacity and visibility optimizations if (deflate == nsMargin(0, 0, 0, 0)) { - nsDisplayBackground* bg; - nsresult rv = DisplayBackgroundUnconditional(aBuilder, aLists, false, &bg); + nsresult rv = DisplayBackgroundUnconditional(aBuilder, aLists, false); NS_ENSURE_SUCCESS(rv, rv); } }