- From: John Mellor <johnme@chromium.org>
- Date: Wed, 14 Nov 2012 15:42:34 +0000
- To: Boris Zbarsky <bzbarsky@mit.edu>, James Robinson <jamesr@google.com>, Rune Lillesveen <rune@opera.com>
- Cc: www-style list <www-style@w3.org>, Adam Barth <w3c@adambarth.com>
- Message-ID: <CAG_kaUZ=Dgh0J6LV8abPfcYHD=BqiaJKPBpWeM2J14hOBVYoSg@mail.gmail.com>
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. James is thinking of devicePixelRatio as an artifact of the display because mobile OSes generally provide a fixed default ratio between DIPs and device pixels (e.g. Android's DisplayMetrics.density<http://developer.android.com/reference/android/util/DisplayMetrics.html#density>). But if the browser changes the size of a DIP, e.g. because the user pressed Ctrl-+ on desktop, then we need to update the devicePixelRatio accordingly. So I agree with the consensus: devicePixelRatio should change when you Ctrl-+ on desktop, but not when you pinch zoom on mobile. On Mon, Nov 12, 2012 at 9:19 AM, Rune Lillesveen <rune@opera.com> wrote: > device-pixel-ratio should not change for the magnifying glass type of zoom > you have in mobile browser, but it should change for the type of zoom you > have in the Opera Desktop browser, and IIRC the resolution preference you > have in the Android browser, which both affect the ICB. > I'm not exactly sure what resolution preference in the Android browser you're talking about. But in Chrome for Android we're considering linking accessibility scaling preferences to the devicePixelRatio, in similar fashion to the above. So if you have a 2x accessibility scale, then devicePixelRatio would be double the device's normal value, DIPs would be twice as large, and "device-width" would halve such that responsive designs would display their phone layout on tablets.
Received on Wednesday, 14 November 2012 15:43:22 UTC