Title: [99291] trunk/Source/WebKit/chromium
- Revision
- 99291
- Author
- fsam...@chromium.org
- Date
- 2011-11-04 10:10:03 -0700 (Fri, 04 Nov 2011)
Log Message
[Chromium] Expose deviceScaleFactor to WebKit API
https://bugs.webkit.org/show_bug.cgi?id=70614
Reviewed by Darin Fisher.
This exposes the device scale factor to the Chromium-WebKit API.
This scale factor is the ratio between the current device's DPI
and the target device's DPI.
For details on how this can be accessed from CSS and _javascript_, please
see here:
http://developer.android.com/guide/webapps/targeting.html#DensityCSS
* public/WebView.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::deviceScaleFactor):
(WebKit::WebViewImpl::setDeviceScaleFactor):
* src/WebViewImpl.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (99290 => 99291)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-11-04 17:06:06 UTC (rev 99290)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-11-04 17:10:03 UTC (rev 99291)
@@ -1,3 +1,25 @@
+2011-11-04 Fady Samuel <fsam...@chromium.org>
+
+ [Chromium] Expose deviceScaleFactor to WebKit API
+ https://bugs.webkit.org/show_bug.cgi?id=70614
+
+ Reviewed by Darin Fisher.
+
+ This exposes the device scale factor to the Chromium-WebKit API.
+ This scale factor is the ratio between the current device's DPI
+ and the target device's DPI.
+
+ For details on how this can be accessed from CSS and _javascript_, please
+ see here:
+
+ http://developer.android.com/guide/webapps/targeting.html#DensityCSS
+
+ * public/WebView.h:
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::deviceScaleFactor):
+ (WebKit::WebViewImpl::setDeviceScaleFactor):
+ * src/WebViewImpl.h:
+
2011-11-03 Adrienne Walker <e...@google.com>
[chromium] Fix incorrect visibility/scissor rect for threaded compositing
Modified: trunk/Source/WebKit/chromium/public/WebView.h (99290 => 99291)
--- trunk/Source/WebKit/chromium/public/WebView.h 2011-11-04 17:06:06 UTC (rev 99290)
+++ trunk/Source/WebKit/chromium/public/WebView.h 2011-11-04 17:10:03 UTC (rev 99291)
@@ -216,7 +216,13 @@
// On the other hand, zooming affects layout of the page.
virtual void scalePage(float scaleFactor, WebPoint origin) = 0;
+ // The ratio of the current device's screen DPI to the target device's screen DPI.
+ virtual float deviceScaleFactor() const = 0;
+ // Sets the ratio as computed by computeViewportAttributes.
+ virtual void setDeviceScaleFactor(float) = 0;
+
+
// Fixed Layout --------------------------------------------------------
// In fixed layout mode, the layout of the page is independent of the
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (99290 => 99291)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-11-04 17:06:06 UTC (rev 99290)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2011-11-04 17:10:03 UTC (rev 99291)
@@ -1854,6 +1854,22 @@
page()->setPageScaleFactor(scaleFactor, origin);
}
+float WebViewImpl::deviceScaleFactor() const
+{
+ if (!page())
+ return 1;
+
+ return page()->deviceScaleFactor();
+}
+
+void WebViewImpl::setDeviceScaleFactor(float scaleFactor)
+{
+ if (!page())
+ return;
+
+ page()->setDeviceScaleFactor(scaleFactor);
+}
+
bool WebViewImpl::isFixedLayoutModeEnabled() const
{
if (!page())
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (99290 => 99291)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.h 2011-11-04 17:06:06 UTC (rev 99290)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h 2011-11-04 17:10:03 UTC (rev 99291)
@@ -159,6 +159,8 @@
double maximumZoomLevel);
virtual float pageScaleFactor() const;
virtual void scalePage(float scaleFactor, WebPoint origin);
+ virtual float deviceScaleFactor() const;
+ virtual void setDeviceScaleFactor(float);
virtual bool isFixedLayoutModeEnabled() const;
virtual void enableFixedLayoutMode(bool enable);
virtual WebSize fixedLayoutSize() const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes