Bug 798607. Ensure GetContentsScaleFactor is 1.0 on all non-Mac platforms. r=smichaud
authorRobert O'Callahan <robert@ocallahan.org>
Mon, 08 Oct 2012 23:36:06 +1300
changeset 109742 afc8967a5cea136df44b739077e564c66d9aef10
parent 109741 550038369ab1731d567f7a9f8e78cb036fe8a95f
child 109743 21b01c22ac9e86f3b31f6d0b8b4d6405e042c320
push id23652
push userryanvm@gmail.com
push dateWed, 10 Oct 2012 01:10:20 +0000
treeherdermozilla-central@5cca0408a73f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmichaud
bugs798607
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 798607. Ensure GetContentsScaleFactor is 1.0 on all non-Mac platforms. r=smichaud
dom/plugins/base/nsPluginInstanceOwner.cpp
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -3722,16 +3722,20 @@ void nsPluginInstanceOwner::RemoveScroll
 }
 #endif
 
 NS_IMETHODIMP
 nsPluginInstanceOwner::GetContentsScaleFactor(double *result)
 {
   NS_ENSURE_ARG_POINTER(result);
   double scaleFactor = 1.0;
+  // On Mac, device pixels need to be translated to (and from) "display pixels"
+  // 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();
@@ -3741,16 +3745,17 @@ nsPluginInstanceOwner::GetContentsScaleF
       if (screen) {
         nsresult rv = screen->GetContentsScaleFactor(&scaleFactor);
         if (NS_FAILED(rv)) {
           scaleFactor = 1.0;
         }
       }
     }
   }
+#endif
   *result = scaleFactor;
   return NS_OK;
 }
 
 void nsPluginInstanceOwner::SetFrame(nsObjectFrame *aFrame)
 {
   // Don't do anything if the frame situation hasn't changed.
   if (mObjectFrame == aFrame) {