diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index c188a2d564b..11793c98534 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -461,7 +461,7 @@ void nsDisplayList::Sort(nsDisplayListBuilder* aBuilder, PRBool nsDisplayBackground::IsOpaque(nsDisplayListBuilder* aBuilder) { // theme background overrides any other background - if (mFrame->IsThemed()) + if (mIsThemed) return PR_FALSE; PRBool isCanvas; @@ -479,7 +479,7 @@ nsDisplayBackground::IsOpaque(nsDisplayListBuilder* aBuilder) { PRBool nsDisplayBackground::IsUniform(nsDisplayListBuilder* aBuilder) { // theme background overrides any other background - if (mFrame->IsThemed()) + if (mIsThemed) return PR_FALSE; PRBool isCanvas; @@ -532,6 +532,14 @@ nsDisplayBackground::Paint(nsDisplayListBuilder* aBuilder, mFrame->HonorPrintBackgroundSettings()); } +nsRect +nsDisplayBackground::GetBounds(nsDisplayListBuilder* aBuilder) { + if (mIsThemed) + return mFrame->GetOverflowRect() + aBuilder->ToReferenceFrame(mFrame); + + return nsRect(aBuilder->ToReferenceFrame(mFrame), mFrame->GetSize()); +} + nsRect nsDisplayOutline::GetBounds(nsDisplayListBuilder* aBuilder) { return mFrame->GetOverflowRect() + aBuilder->ToReferenceFrame(mFrame); diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 806c37a9075..b52688e26d7 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -958,6 +958,7 @@ public: class nsDisplayBackground : public nsDisplayItem { public: nsDisplayBackground(nsIFrame* aFrame) : nsDisplayItem(aFrame) { + mIsThemed = mFrame->IsThemed(); MOZ_COUNT_CTOR(nsDisplayBackground); } #ifdef NS_BUILD_REFCNT_LOGGING @@ -971,9 +972,13 @@ public: virtual PRBool IsVaryingRelativeToFrame(nsDisplayListBuilder* aBuilder, nsIFrame* aAncestorFrame); virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder); + virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder); virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx, const nsRect& aDirtyRect); NS_DISPLAY_DECL_NAME("Background") +private: + /* Used to cache mFrame->IsThemed() since it isn't a cheap call */ + PRPackedBool mIsThemed; }; /**