Bug 799078. Part 2: Get Mac plugin content scale factor from the device context instead of guessing. r=smichaud

--HG--
extra : rebase_source : e6157857bb6a3b698fc1d22383cdb05d259a0d1b
This commit is contained in:
Robert O'Callahan 2012-10-09 00:24:18 +13:00
parent 12170091be
commit ba0c33ffae

View File

@ -3730,24 +3730,10 @@ nsPluginInstanceOwner::GetContentsScaleFactor(double *result)
// for plugins. On other platforms, plugin coordinates are always in device
// pixels.
#if defined(XP_MACOSX)
if (mWidget) {
scaleFactor = mWidget->GetDefaultScale();
} else {
nsCOMPtr<nsIScreenManager> screenMgr =
do_GetService("@mozilla.org/gfx/screenmanager;1");
if (screenMgr) {
nsCOMPtr<nsIScreen> screen;
nsIntRect screenRect = mObjectFrame->GetScreenRect();
screenMgr->ScreenForRect(screenRect.x, screenRect.y,
screenRect.width, screenRect.height,
getter_AddRefs(screen));
if (screen) {
nsresult rv = screen->GetContentsScaleFactor(&scaleFactor);
if (NS_FAILED(rv)) {
scaleFactor = 1.0;
}
}
}
nsIPresShell* presShell = nsContentUtils::FindPresShellForDocument(mContent->OwnerDoc());
if (presShell) {
scaleFactor = double(nsPresContext::AppUnitsPerCSSPixel())/
presShell->GetPresContext()->DeviceContext()->UnscaledAppUnitsPerDevPixel();
}
#endif
*result = scaleFactor;