Re: Behavior of device-pixel-ratio under zoom

On Nov 13, 2012 8:09 PM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:
>
> 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.

That doesn't follow for me - devicePixelRatio is a physical property of the
display which unless your laptop is a lot cooler than mine doesn't change
when you press Ctrl-+.

- James

>
> ~TJ

Received on Wednesday, 14 November 2012 06:42:40 UTC