diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 5b8987ef2235..2071602ad832 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -2495,8 +2495,7 @@ PaintBackgroundLayer(nsPresContext* aPresContext, } } - if (aRenderingContext.ThebesContext()->GetFlags() & - gfxContext::FLAG_DESTINED_FOR_SCREEN) { + if (aFlags & nsCSSRendering::PAINTBG_TO_WINDOW) { // Clip background-attachment:fixed backgrounds to the viewport, if we're // painting to the screen. This avoids triggering tiling in common cases, // without affecting output since drawing is always clipped to the viewport diff --git a/layout/base/nsCSSRendering.h b/layout/base/nsCSSRendering.h index 3c9ccc8ee3c0..fdcc20615226 100644 --- a/layout/base/nsCSSRendering.h +++ b/layout/base/nsCSSRendering.h @@ -224,8 +224,14 @@ struct nsCSSRendering { */ PAINTBG_WILL_PAINT_BORDER = 0x01, /** - * When this flag is passed, images are synchronously decoded. */ - PAINTBG_SYNC_DECODE_IMAGES = 0x02 + * When this flag is passed, images are synchronously decoded. + */ + PAINTBG_SYNC_DECODE_IMAGES = 0x02, + /** + * When this flag is passed, painting will go to the screen so we can + * take advantage of the fact that it will be clipped to the viewport. + */ + PAINTBG_TO_WINDOW = 0x04 }; static void PaintBackground(nsPresContext* aPresContext, nsIRenderingContext& aRenderingContext, diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 9e4e23b47e55..003acafe9987 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -161,6 +161,9 @@ nsDisplayListBuilder::GetBackgroundPaintFlags() { if (mSyncDecodeImages) { flags |= nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES; } + if (mIsPaintingToWindow) { + flags |= nsCSSRendering::PAINTBG_TO_WINDOW; + } return flags; } diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index c0b469a58c75..4a6aaed95e4d 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -1255,7 +1255,7 @@ nsDisplayPlugin::Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx) { nsObjectFrame* f = static_cast(mFrame); - f->PaintPlugin(*aCtx, mVisibleRect, GetBounds(aBuilder)); + f->PaintPlugin(aBuilder, *aCtx, mVisibleRect, GetBounds(aBuilder)); } PRBool @@ -1779,7 +1779,8 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder, } void -nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext, +nsObjectFrame::PaintPlugin(nsDisplayListBuilder* aBuilder, + nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, const nsRect& aPluginRect) { // Screen painting code @@ -2014,7 +2015,7 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext, nativeDraw.EndNativeDrawing(); } while (nativeDraw.ShouldRenderAgain()); nativeDraw.PaintToContext(); - } else if (!(ctx->GetFlags() & gfxContext::FLAG_DESTINED_FOR_SCREEN)) { + } else if (!aBuilder->IsPaintingToWindow()) { // Get PrintWindow dynamically since it's not present on Win2K, // which we still support typedef BOOL (WINAPI * PrintWindowPtr) diff --git a/layout/generic/nsObjectFrame.h b/layout/generic/nsObjectFrame.h index ef13dca85d5e..f5c015204712 100644 --- a/layout/generic/nsObjectFrame.h +++ b/layout/generic/nsObjectFrame.h @@ -239,7 +239,8 @@ protected: const nsRect& aDirtyRect, nsPoint aPt); void PrintPlugin(nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect); - void PaintPlugin(nsIRenderingContext& aRenderingContext, + void PaintPlugin(nsDisplayListBuilder* aBuilder, + nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, const nsRect& aPluginRect); /**