From 5d9d3616fd6663488a6eadbd04c08d84c37c09ea Mon Sep 17 00:00:00 2001 From: Oleg Romashin Date: Tue, 14 Sep 2010 12:01:21 -0700 Subject: [PATCH] Bug 556487 - ObjectFrame GetBounds. r=roc a=blocking2.0 --- layout/generic/nsObjectFrame.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index 6bb754732e7..41fa26d80fd 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -1235,8 +1235,16 @@ nsObjectFrame::PaintPrintPlugin(nsIFrame* aFrame, nsIRenderingContext* aCtx, nsRect nsDisplayPlugin::GetBounds(nsDisplayListBuilder* aBuilder) { - return mFrame->GetContentRect() - mFrame->GetPosition() + + nsRect r = mFrame->GetContentRect() - mFrame->GetPosition() + ToReferenceFrame(); + nsObjectFrame* f = static_cast(mFrame); + if (mozilla::LAYER_ACTIVE == f->GetLayerState(aBuilder, nsnull)) { + gfxIntSize size = f->GetImageContainer()->GetCurrentSize(); + PRInt32 appUnitsPerDevPixel = f->PresContext()->AppUnitsPerDevPixel(); + r -= nsPoint((r.width - size.width * appUnitsPerDevPixel) / 2, + (r.height - size.height * appUnitsPerDevPixel) / 2); + } + return r; } void