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: Tue, 13 Nov 2012 20:08:39 -0800
Message-ID: <CAAWBYDC60pK=iktaya_5r9LDo5W-5p_SKRjPiNLyK71pvwk69Q@mail.gmail.com>
To: James Robinson <jamesr@google.com>
Cc: "Robert O'Callahan" <robert@ocallahan.org>, Simon Fraser <smfr@me.com>, "L. David Baron" <dbaron@dbaron.org>, www-style <www-style@w3.org>
On Tue, Nov 13, 2012 at 6:02 PM, James Robinson <jamesr@google.com> wrote:
> On Tue, Nov 13, 2012 at 5:21 PM, Tab Atkins Jr. <jackalmage@gmail.com>
> wrote:
>> As far as I can tell, we do the wrong thing.  When I Ctrl-+ my way to
>> maximum "zoom" (really "rescale", I think) on my desktop (such that
>> <body> reports its width as being 272px wide instead of 1424px),
>> window.dPR still returns 1.
>
> That's a completely different type of 'zoom' from what happens on mobile.
> Ctrl+ in Chrome is 'Page Zoom' using the terminology here:
> http://trac.webkit.org/wiki/ScalesAndZooms.  Pinch zooming on a mobile
> device in WebKit is 'Page Scale' using that terminology.  Neither change
> window.devicePixelRatio - that's an artifact of the display and cannot be
> changed by user interaction.

Yes, that's what we're saying - the "zoom" operation from mobile
browsers, where zooming and panning the virtual viewport is common,
should be considered distinct from the "zoom" operation done by
desktop browsers, where you're actually changing the number of pixels
that fit into the viewport.  I've been calling the latter operation
"rescale" rather than "zoom" just to help distinguish.  When I Ctrl-+
in desktop Chrome, the ICB is actually made smaller (in px), which is
very different than scaling up the virtual viewport on mobile Chrome.

When I Ctrl-+ a lot, then ask <body> (which is filling the screen)
what its size is, it reports a number less than 1/5 what it "should"
report.  That means we're actually, for the purpose of every useful
metric, rescaling the CSS px relative to the device pixel, and
window.dPR should reflect that.  Otherwise, you get nonsensical
results.

~TJ
Received on Wednesday, 14 November 2012 04:09:26 GMT

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