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

Re: Behavior of device-pixel-ratio under zoom

From: James Robinson <jamesr@google.com>
Date: Tue, 13 Nov 2012 22:42:12 -0800
Message-ID: <CAD73mdJ-cqrZRN7gArN6wiRUa=Oq6Rkv+KQhszyC+070t9PPxQ@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Simon Fraser <smfr@me.com>, www-style list <www-style@w3.org>, "L. David Baron" <dbaron@dbaron.org>, "Robert O'Callahan" <robert@ocallahan.org>
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
> > 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
> > 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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:05 UTC