summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorevan.exe@gmail.com <evan.exe@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-29 14:15:21 +0000
committerevan.exe@gmail.com <evan.exe@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-29 14:15:21 +0000
commitd5bfb3d72af53b0be61f374c14db7caec9c225c5 (patch)
tree636b7a64daa9466baa66b31281e9556eaac42e80 /webkit
parenta7f99f046eadc534b91bb3c3ff1838da12d8b224 (diff)
downloadchromium_src-d5bfb3d72af53b0be61f374c14db7caec9c225c5.zip
chromium_src-d5bfb3d72af53b0be61f374c14db7caec9c225c5.tar.gz
chromium_src-d5bfb3d72af53b0be61f374c14db7caec9c225c5.tar.bz2
Fix appearance of custom CSS cursors on retina displays with -webkit-image-set.
Set the size of the NSImageRep to the size of the NSImage that contains it. BUG=268537 TEST=Check http://jsbin.com/ewilah on a retina display, cursor should not be a solid color Review URL: https://chromiumcodereview.appspot.com/22278002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@220284 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/common/cursors/webcursor_mac.mm4
1 files changed, 4 insertions, 0 deletions
diff --git a/webkit/common/cursors/webcursor_mac.mm b/webkit/common/cursors/webcursor_mac.mm
index 1a1dc44..58cff81 100644
--- a/webkit/common/cursors/webcursor_mac.mm
+++ b/webkit/common/cursors/webcursor_mac.mm
@@ -208,8 +208,12 @@ NSCursor* CreateCustomCursor(const std::vector<char>& custom_data,
NSPoint dip_hotspot = NSPointFromCGPoint(gfx::ToFlooredPoint(
gfx::ScalePoint(hotspot, 1 / custom_scale)).ToCGPoint());
+ // Both the image and its representation need to have the same size for
+ // cursors to appear in high resolution on retina displays. Note that the
+ // size of a representation is not the same as pixelsWide or pixelsHigh.
NSImage* cursor_image = gfx::SkBitmapToNSImage(bitmap);
[cursor_image setSize:dip_size];
+ [[[cursor_image representations] objectAtIndex:0] setSize:dip_size];
NSCursor* cursor = [[NSCursor alloc] initWithImage:cursor_image
hotSpot:dip_hotspot];