summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/mac/PlatformScreenMac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/mac/PlatformScreenMac.mm')
-rw-r--r--Source/WebCore/platform/mac/PlatformScreenMac.mm13
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/WebCore/platform/mac/PlatformScreenMac.mm b/Source/WebCore/platform/mac/PlatformScreenMac.mm
index 5dbfcf4..916fc9f 100644
--- a/Source/WebCore/platform/mac/PlatformScreenMac.mm
+++ b/Source/WebCore/platform/mac/PlatformScreenMac.mm
@@ -76,12 +76,21 @@ NSScreen *screenForWindow(NSWindow *window)
return nil;
}
+static CGFloat windowScaleFactor(NSWindow *window)
+{
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ return [window backingScaleFactor];
+#else
+ return [window userSpaceScaleFactor];
+#endif
+}
+
FloatRect toUserSpace(const NSRect& rect, NSWindow *destination)
{
FloatRect userRect = rect;
userRect.setY(NSMaxY([screenForWindow(destination) frame]) - (userRect.y() + userRect.height())); // flip
if (destination)
- userRect.scale(1 / [destination userSpaceScaleFactor]); // scale down
+ userRect.scale(1 / windowScaleFactor(destination)); // scale down
return userRect;
}
@@ -89,7 +98,7 @@ NSRect toDeviceSpace(const FloatRect& rect, NSWindow *source)
{
FloatRect deviceRect = rect;
if (source)
- deviceRect.scale([source userSpaceScaleFactor]); // scale up
+ deviceRect.scale(windowScaleFactor(source)); // scale up
deviceRect.setY(NSMaxY([screenForWindow(source) frame]) - (deviceRect.y() + deviceRect.height())); // flip
return deviceRect;
}