W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2010

[whatwg] Processing the zoom level - MS extensions to window.screen

From: Charles Pritchard <chuck@jumis.com>
Date: Fri, 19 Nov 2010 12:04:53 -0800
Message-ID: <4CE6D865.8040404@jumis.com>
It's not possible to discover the scaling of CSS pixels to actual device 
pixels, with the current standard.

There are three non-standard ways to access them, from what I can see.

Mozilla:
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils).screenPixelsPerCSSPixel

Google:
chrome.tabs.getZoomPercentage
window.innerWidth and window.outerWidth are decoupled, one is in CSS pixels,
the other is in screen pixels. So that's a minor work-around.

Microsoft:
window.screen

This is apart from the existing convention on mobile phones of 
targetDpiDensity and dpiPixelRatio.

Microsoft's solution, seems to be superior, by exposing everything:
http://msdn.microsoft.com/en-us/library/ms535868(v=VS.85).aspx

systemXDPI, deviceXDPI, logicalXDPI  (and YDPI ).

They also have fontSmoothingEnabled and updateInterval;
which are handy, but out of scope for this section.

Moz has animation hooks:
window.mozAnimationStartTime
window.addEventListener("MozBeforePaint")
window.mozRequestAnimationFrame()


I'm pushing Microsoft's solution, of exposing the data through 
window.screen.
Can we all get on board with that one? Are there other proposals?
Received on Friday, 19 November 2010 12:04:53 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:28 UTC