Bug 556487 - Snap plugin rect to integer pixels. r=roc a=blocking2.0

--HG--
extra : rebase_source : 6442890eb41dce7a134173b5d1e1c87c589cadd1
This commit is contained in:
Oleg Romashin 2010-09-07 19:51:50 -07:00
parent ff18db0258
commit b413ca6239

View File

@ -1071,14 +1071,24 @@ nsObjectFrame::CallSetWindow()
PRBool windowless = (window->type == NPWindowTypeDrawable);
nsIntPoint origin = GetWindowOriginInPixels(windowless);
window->x = origin.x;
window->y = origin.y;
// refresh the plugin port as well
window->window = mInstanceOwner->GetPluginPortFromWidget();
// Adjust plugin dimensions according to pixel snap results
// and reduce amount of SetWindow calls
nsPresContext* presContext = PresContext();
nsRootPresContext* rootPC = presContext->GetRootPresContext();
if (!rootPC)
return;
PRInt32 appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
nsIFrame* rootFrame = rootPC->PresShell()->FrameManager()->GetRootFrame();
nsRect bounds = GetContentRect() + GetParent()->GetOffsetToCrossDoc(rootFrame);
nsIntRect intBounds = bounds.ToNearestPixels(appUnitsPerDevPixel);
window->x = intBounds.x;
window->y = intBounds.y;
window->width = intBounds.width;
window->height = intBounds.height;
// this will call pi->SetWindow and take care of window subclassing
// if needed, see bug 132759.
window->CallSetWindow(pi);