W3C home > Mailing lists > Public > www-style@w3.org > November 2012

Re: Behavior of device-pixel-ratio under zoom

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 14 Nov 2012 08:55:12 -0800
Message-ID: <CAAWBYDAOvjy1=TtkKwPN8sDQSP_OUu2fidQnhF5zfg9XM-X5hA@mail.gmail.com>
To: John Mellor <johnme@chromium.org>
Cc: Boris Zbarsky <bzbarsky@mit.edu>, James Robinson <jamesr@google.com>, Rune Lillesveen <rune@opera.com>, www-style list <www-style@w3.org>, Adam Barth <w3c@adambarth.com>
On Wed, Nov 14, 2012 at 7:42 AM, John Mellor <johnme@chromium.org> wrote:
> On Wed, Nov 14, 2012 at 9:14 AM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>> On 11/13/12 6:02 PM, James Robinson wrote:
>>> Neither change
>>> window.devicePixelRatio - that's an artifact of the display and cannot
>>> be changed by user interaction.
>>
>> How is it an artifact of the display?  It's a ratio of CSS pixels to
>> device pixels; the display knows nothing about CSS pixels, and in fact "page
>> zoom" in your terminology changes this ratio!
>
> Minor nitpick: it's the ratio of density-independent pixels (aka
> device-independent/logical/UI pixels) to device pixels (aka physical screen
> pixels). On mobile, if you have a width=device-width viewport, then DIPs are
> initially equivalent to CSS pixels, but when the user pinch-zooms, the size
> of CSS pixels changes, whereas the size of DIPs does not change, hence the
> devicePixelRatio does not change either when you pinch zoom.

That's one way of thinking of it.  I prefer to keep it as "CSS pixels"
in my head, and take its ratio with "the width that the virtual
viewport would have, in device pixels".  The two are probably
equivalent.

~TJ
Received on Wednesday, 14 November 2012 16:56:06 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:02 GMT