From ba0c33ffae318683ebc8d102f6ac66589dd58dd8 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Tue, 9 Oct 2012 00:24:18 +1300 Subject: [PATCH] Bug 799078. Part 2: Get Mac plugin content scale factor from the device context instead of guessing. r=smichaud --HG-- extra : rebase_source : e6157857bb6a3b698fc1d22383cdb05d259a0d1b --- dom/plugins/base/nsPluginInstanceOwner.cpp | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index 42b18edaa86..b1e03514daf 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -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 screenMgr = - do_GetService("@mozilla.org/gfx/screenmanager;1"); - if (screenMgr) { - nsCOMPtr 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;