Re: Behavior of device-pixel-ratio under zoom

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 UTC