Backed out changeset bc33885d2034 (bug 1240749) for bustage
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 29 Feb 2016 08:37:55 +0100
changeset 322400 41a76dfcce45e8216516b390752dfe3365b0c777
parent 322399 bc33885d20340641e06cc40031618dd30ccd6567
child 322401 cb28a396b8846c4f4d863974c3cacaac0a8cddbb
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1240749
milestone47.0a1
backs outbc33885d20340641e06cc40031618dd30ccd6567
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
Backed out changeset bc33885d2034 (bug 1240749) for bustage
widget/gtk/nsScreenGtk.cpp
widget/gtk/nsScreenGtk.h
widget/gtk/nsScreenManagerGtk.cpp
widget/gtk/nsScreenManagerGtk.h
--- a/widget/gtk/nsScreenGtk.cpp
+++ b/widget/gtk/nsScreenGtk.cpp
@@ -86,39 +86,66 @@ nsScreenGtk :: GetDPIScale()
 {
   double dpiScale = nsIWidget::DefaultScaleOverride();
   if (dpiScale <= 0.0) {
     dpiScale = GetGtkMonitorScaleFactor() * gfxPlatformGtk::GetDPIScale();
   }
   return dpiScale;
 }
 
+NS_IMETHODIMP
+nsScreenGtk :: GetRectDisplayPix(int32_t *outLeft,  int32_t *outTop, int32_t *outWidth, int32_t *outHeight)
+{
+  int32_t left, top, width, height;
+
+  GetRect(&left, &top, &width, &height);
+
+  double scaleFactor = 1.0 / GetDPIScale();
+  *outLeft = NSToIntRound(left * scaleFactor);
+  *outTop = NSToIntRound(top * scaleFactor);
+  *outWidth = NSToIntRound(width * scaleFactor);
+  *outHeight = NSToIntRound(height * scaleFactor);
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsScreenGtk :: GetAvailRectDisplayPix(int32_t *outLeft,  int32_t *outTop,  int32_t *outWidth, int32_t *outHeight)
+{
+  int32_t left, top, width, height;
+
+  GetAvailRect(&left, &top, &width, &height);
+
+  double scaleFactor = 1.0 / GetDPIScale();
+  *outLeft = NSToIntRound(left * scaleFactor);
+  *outTop = NSToIntRound(top * scaleFactor);
+  *outWidth = NSToIntRound(width * scaleFactor);
+  *outHeight = NSToIntRound(height * scaleFactor);
+
+  return NS_OK;
+}
+
 NS_IMETHODIMP 
 nsScreenGtk :: GetPixelDepth(int32_t *aPixelDepth)
 {
   GdkVisual * visual = gdk_screen_get_system_visual(gdk_screen_get_default());
   *aPixelDepth = gdk_visual_get_depth(visual);
 
   return NS_OK;
 
 } // GetPixelDepth
 
+
 NS_IMETHODIMP 
 nsScreenGtk :: GetColorDepth(int32_t *aColorDepth)
 {
   return GetPixelDepth ( aColorDepth );
 
 } // GetColorDepth
 
-NS_IMETHODIMP
-nsScreenGtk::GetDefaultCSSScaleFactor(double* aScaleFactor)
-{
-  *aScaleFactor = GetDPIScale();
-  return NS_OK;
-}
 
 void
 nsScreenGtk :: Init (GdkWindow *aRootWindow)
 {
   gint scale = nsScreenGtk::GetGtkMonitorScaleFactor();
   gint width = gdk_screen_width()*scale;
   gint height = gdk_screen_height()*scale;
 
--- a/widget/gtk/nsScreenGtk.h
+++ b/widget/gtk/nsScreenGtk.h
@@ -28,19 +28,20 @@ class nsScreenGtk : public nsBaseScreen
 {
 public:
   nsScreenGtk();
   ~nsScreenGtk();
 
   NS_IMETHOD GetId(uint32_t* aId);
   NS_IMETHOD GetRect(int32_t* aLeft, int32_t* aTop, int32_t* aWidth, int32_t* aHeight);
   NS_IMETHOD GetAvailRect(int32_t* aLeft, int32_t* aTop, int32_t* aWidth, int32_t* aHeight);
+  NS_IMETHOD GetRectDisplayPix(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int32_t *outHeight);
+  NS_IMETHOD GetAvailRectDisplayPix(int32_t *outLeft, int32_t *outTop, int32_t *outWidth, int32_t *outHeight);
   NS_IMETHOD GetPixelDepth(int32_t* aPixelDepth);
   NS_IMETHOD GetColorDepth(int32_t* aColorDepth);
-  NS_IMETHOD GetDefaultCSSScaleFactor(double* aScaleFactor) override;
 
   void Init(GdkWindow *aRootWindow);
 #ifdef MOZ_X11
   void Init(XineramaScreenInfo *aScreenInfo);
 #endif /* MOZ_X11 */
 
   static gint    GetGtkMonitorScaleFactor();
   static double  GetDPIScale();
--- a/widget/gtk/nsScreenManagerGtk.cpp
+++ b/widget/gtk/nsScreenManagerGtk.cpp
@@ -232,22 +232,40 @@ nsScreenManagerGtk :: ScreenForId ( uint
 
 
 //
 // ScreenForRect 
 //
 // Returns the screen that contains the rectangle. If the rect overlaps
 // multiple screens, it picks the screen with the greatest area of intersection.
 //
-// The coordinates are in desktop pixels.
+// The coordinates are in CSS pixels (not app units) and in screen coordinates.
 //
 NS_IMETHODIMP
-nsScreenManagerGtk::ScreenForRect(int32_t aX, int32_t aY,
-                                  int32_t aWidth, int32_t aHeight,
-                                  nsIScreen **aOutScreen)
+nsScreenManagerGtk :: ScreenForRect( int32_t aX, int32_t aY,
+                                     int32_t aWidth, int32_t aHeight,
+                                     nsIScreen **aOutScreen )
+{
+  uint32_t scale = nsScreenGtk::GetDPIScale();
+  return ScreenForRectPix(aX*scale, aY*scale, aWidth*scale, aHeight*scale,
+                          aOutScreen);
+}
+
+//
+// ScreenForRectPix
+//
+// Returns the screen that contains the rectangle. If the rect overlaps
+// multiple screens, it picks the screen with the greatest area of intersection.
+//
+// The coordinates are in device (X11) pixels.
+//
+nsresult
+nsScreenManagerGtk :: ScreenForRectPix( int32_t aX, int32_t aY,
+                                        int32_t aWidth, int32_t aHeight,
+                                        nsIScreen **aOutScreen )
 {
   nsresult rv;
   rv = EnsureInit();
   if (NS_FAILED(rv)) {
     NS_ERROR("nsScreenManagerGtk::EnsureInit() failed from ScreenForRect");
     return rv;
   }
 
@@ -351,15 +369,15 @@ nsScreenManagerGtk :: ScreenForNativeWid
 
 #if (MOZ_WIDGET_GTK == 2)
     gdk_window_get_geometry(GDK_WINDOW(aWidget), &x, &y, &width, &height,
                             &depth);
 #else
     gdk_window_get_geometry(GDK_WINDOW(aWidget), &x, &y, &width, &height);
 #endif
     gdk_window_get_origin(GDK_WINDOW(aWidget), &x, &y);
-    rv = ScreenForRect(x, y, width, height, outScreen);
+    rv = ScreenForRectPix(x, y, width, height, outScreen);
   } else {
     rv = GetPrimaryScreen(outScreen);
   }
 
   return rv;
 }
--- a/widget/gtk/nsScreenManagerGtk.h
+++ b/widget/gtk/nsScreenManagerGtk.h
@@ -32,16 +32,19 @@ public:
   
   // For internal use, or reinitialization from change notification.
   nsresult Init();
 
 private:
   virtual ~nsScreenManagerGtk();
 
   nsresult EnsureInit();
+  nsresult ScreenForRectPix(int32_t aX, int32_t aY,
+                            int32_t aWidth, int32_t aHeight,
+                            nsIScreen **aOutScreen);
 
   // Cached screen array.  Its length is the number of screens we have.
   nsCOMArray<nsIScreen> mCachedScreenArray;
 
   PRLibrary *mXineramalib;
 
   GdkWindow *mRootWindow;
 #ifdef MOZ_X11