Bug 888781 part 2 - Scale cursor with the window scale on Windows. r=jimm
authorXidorn Quan <me@upsuper.org>
Mon, 19 Sep 2016 10:35:48 +1000
changeset 314424 ff28b15107631c762ed5db714c8310260343bd27
parent 314423 b4a82f0cb935511ecb6ea1ff51b4a733db77d5fa
child 314425 9769cc42f54995f1d087200259ad3464be881a2c
push id20574
push usercbook@mozilla.com
push dateTue, 20 Sep 2016 10:05:16 +0000
treeherderfx-team@14705f779a46 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs888781
milestone52.0a1
Bug 888781 part 2 - Scale cursor with the window scale on Windows. r=jimm MozReview-Commit-ID: C9LZpJF98mQ
widget/windows/nsWindow.cpp
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -2780,18 +2780,18 @@ NS_IMETHODIMP nsWindow::SetCursor(imgICo
   // Reject cursors greater than 128 pixels in either direction, to prevent
   // spoofing.
   // XXX ideally we should rescale. Also, we could modify the API to
   // allow trusted content to set larger cursors.
   if (width > 128 || height > 128)
     return NS_ERROR_NOT_AVAILABLE;
 
   HCURSOR cursor;
-  // No scaling
-  IntSize size(0, 0);
+  double scale = GetDefaultScale().scale;
+  IntSize size = RoundedToInt(Size(width * scale, height * scale));
   rv = nsWindowGfx::CreateIcon(aCursor, true, aHotspotX, aHotspotY, size, &cursor);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mCursor = nsCursor(-1);
   ::SetCursor(cursor);
 
   NS_IF_RELEASE(sCursorImgContainer);
   sCursorImgContainer = aCursor;