Title: [133927] trunk/Source
Revision
133927
Author
[email protected]
Date
2012-11-08 12:03:58 -0800 (Thu, 08 Nov 2012)

Log Message

Introduce WebScreenInfo.deviceScaleFactor
https://bugs.webkit.org/show_bug.cgi?id=101613

Patch by Sami Kyostila <[email protected]> on 2012-11-08
Reviewed by Adam Barth.

Introduce the WebScreenInfo.deviceScaleFactor property, which specifies the
ratio between physical and logical pixels. This is the first step in replacing
horizontalDPI/verticalDPI in favor of the deviceScaleFactor.

For now, this value is only initialized on Mac, because the other ports that
use it initialize the value in Chromium, whereas Windows and X11 default to a
factor of 1. The value on Mac is truncated to an integer to match the
expectation in Chromium's RenderWidget.

Source/Platform:

* chromium/public/WebScreenInfo.h:
(WebScreenInfo):
(WebKit::WebScreenInfo::WebScreenInfo):

Source/WebKit/chromium:

* src/mac/WebScreenInfoFactory.mm:
(WebKit::WebScreenInfoFactory::screenInfo):

Modified Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (133926 => 133927)


--- trunk/Source/Platform/ChangeLog	2012-11-08 19:37:50 UTC (rev 133926)
+++ trunk/Source/Platform/ChangeLog	2012-11-08 20:03:58 UTC (rev 133927)
@@ -1,3 +1,23 @@
+2012-11-08  Sami Kyostila  <[email protected]>
+
+        Introduce WebScreenInfo.deviceScaleFactor
+        https://bugs.webkit.org/show_bug.cgi?id=101613
+
+        Reviewed by Adam Barth.
+
+        Introduce the WebScreenInfo.deviceScaleFactor property, which specifies the
+        ratio between physical and logical pixels. This is the first step in replacing
+        horizontalDPI/verticalDPI in favor of the deviceScaleFactor.
+
+        For now, this value is only initialized on Mac, because the other ports that
+        use it initialize the value in Chromium, whereas Windows and X11 default to a
+        factor of 1. The value on Mac is truncated to an integer to match the
+        expectation in Chromium's RenderWidget.
+
+        * chromium/public/WebScreenInfo.h:
+        (WebScreenInfo):
+        (WebKit::WebScreenInfo::WebScreenInfo):
+
 2012-11-08  Keishi Hattori  <[email protected]>
 
         Add properties for week/month picker in DateTimeChooserImpl::writeDocument

Modified: trunk/Source/Platform/chromium/public/WebScreenInfo.h (133926 => 133927)


--- trunk/Source/Platform/chromium/public/WebScreenInfo.h	2012-11-08 19:37:50 UTC (rev 133926)
+++ trunk/Source/Platform/chromium/public/WebScreenInfo.h	2012-11-08 20:03:58 UTC (rev 133927)
@@ -36,12 +36,16 @@
 namespace WebKit {
 
 struct WebScreenInfo {
-    // The horizontal screen dpi.
+    // The horizontal screen dpi (deprecated).
     int horizontalDPI;
 
-    // The vertical screen dpi.
+    // The vertical screen dpi (deprecated).
     int verticalDPI;
 
+    // Device scale factor. Specifies the ratio between physical and logical
+    // pixels.
+    float deviceScaleFactor;
+
     // The screen depth in bits per pixel
     int depth;
 
@@ -72,6 +76,7 @@
     WebScreenInfo()
         : horizontalDPI(0)
         , verticalDPI(0)
+        , deviceScaleFactor(1)
         , depth(0)
         , depthPerComponent(0)
         , isMonochrome(false) { }

Modified: trunk/Source/WebKit/chromium/ChangeLog (133926 => 133927)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-11-08 19:37:50 UTC (rev 133926)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-11-08 20:03:58 UTC (rev 133927)
@@ -1,3 +1,22 @@
+2012-11-08  Sami Kyostila  <[email protected]>
+
+        Introduce WebScreenInfo.deviceScaleFactor
+        https://bugs.webkit.org/show_bug.cgi?id=101613
+
+        Reviewed by Adam Barth.
+
+        Introduce the WebScreenInfo.deviceScaleFactor property, which specifies the
+        ratio between physical and logical pixels. This is the first step in replacing
+        horizontalDPI/verticalDPI in favor of the deviceScaleFactor.
+
+        For now, this value is only initialized on Mac, because the other ports that
+        use it initialize the value in Chromium, whereas Windows and X11 default to a
+        factor of 1. The value on Mac is truncated to an integer to match the
+        expectation in Chromium's RenderWidget.
+
+        * src/mac/WebScreenInfoFactory.mm:
+        (WebKit::WebScreenInfoFactory::screenInfo):
+
 2012-11-08  Dan Carney  <[email protected]>
 
         Cleanup IDBBindingUtilitiesTest

Modified: trunk/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm (133926 => 133927)


--- trunk/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm	2012-11-08 19:37:50 UTC (rev 133926)
+++ trunk/Source/WebKit/chromium/src/mac/WebScreenInfoFactory.mm	2012-11-08 20:03:58 UTC (rev 133927)
@@ -98,6 +98,7 @@
     float deviceDPI = 160 * deviceScaleFactor(view);
     results.horizontalDPI = deviceDPI;
     results.verticalDPI = deviceDPI;
+    results.deviceScaleFactor = static_cast<int>(deviceScaleFactor(view));
 
     results.depth = NSBitsPerPixelFromDepth([screen depth]);
     results.depthPerComponent = NSBitsPerSampleFromDepth([screen depth]);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to