Intent to implement and ship: Update window.devicePixelRatio on zoom

537 views
Skip to first unread message

Emil A Eklund

unread,
Aug 13, 2013, 11:21:10 AM8/13/13
to blink-dev
Primary eng/PM emails
e...@chromium.org

Spec
de-facto

Summary
Update window.devicePixelRatio on full page zoom so that it accurately
portraitists the ratio between css and device pixels.
This does not affect text-zoom, pinch-zoom nor CSS transforms.

Motivation
Having devicePixelRatio contain the ratio between css and device
pixels allows web apps that use image or canvas resources to scale
those properly when zoomed.

Compatibility Risk
Low. Matches current Firefox and IE 11 preview behavior.

Ongoing technical constraints
None

Will this feature be supported on all five Blink platforms (Windows,
Mac, Linux, Chrome OS and Android)?
Yes

OWP launch tracking bug?
None

Implementation bug?
https://code.google.com/p/chromium/issues/detail?id=177836

Row on feature dashboard?
Yes, http://www.chromestatus.com/features/5269993591668736

Requesting approval to ship?
Yes

Darin Fisher

unread,
Aug 13, 2013, 11:33:34 AM8/13/13
to Emil A Eklund, blink-dev
LGTM

For how long has Firefox been shipping this behavior?

-Darin

Emil A Eklund

unread,
Aug 13, 2013, 11:38:34 AM8/13/13
to Darin Fisher, blink-dev
On Tue, Aug 13, 2013 at 8:33 AM, Darin Fisher <da...@chromium.org> wrote:
> For how long has Firefox been shipping this behavior?

Since FF 18 it looks like.

Dimitri Glazkov

unread,
Aug 13, 2013, 12:17:12 PM8/13/13
to Emil A Eklund, Darin Fisher, blink-dev
LGTM

Adam Barth

unread,
Aug 13, 2013, 3:51:35 PM8/13/13
to Dimitri Glazkov, Emil A Eklund, Darin Fisher, blink-dev
LGTM

Masataka Yakura

unread,
Aug 13, 2013, 11:19:00 PM8/13/13
to Emil A Eklund, blink-dev
On Wed, Aug 14, 2013 at 12:21 AM, Emil A Eklund <e...@google.com> wrote:
Summary
Update window.devicePixelRatio on full page zoom so that it accurately
portraitists the ratio between css and device pixels.
This does not affect text-zoom, pinch-zoom nor CSS transforms.

Motivation
Having devicePixelRatio contain the ratio between css and device
pixels allows web apps that use image or canvas resources to scale
those properly when zoomed.

Compatibility Risk
Low. Matches current Firefox and IE 11 preview behavior.

Did Apple change their mind? In an old thread on www-style they said they didn't want to change the behavior [1].

I also wonder what window.devicePixelRatio will be when the system dpi setting or screen resolution change; e.g. a Windows PC configured its DPI to 144dpi or a 15-inch Retina MacBook Pro (which has 2800x1800 device pixels) configured its screen resolution to 1920x1200, should browsers on that machines return 1.5 on 100% zoom level? 

--
Masataka Yakura
<myaku...@gmail.com>

Masataka Yakura

unread,
Aug 13, 2013, 11:22:50 PM8/13/13
to Emil A Eklund, blink-dev
On Wed, Aug 14, 2013 at 12:19 PM, Masataka Yakura <myaku...@gmail.com> wrote:
Did Apple change their mind? In an old thread on www-style they said they didn't want to change the behavior [1].

Oops, forgot to include the pointer. I meant http://lists.w3.org/Archives/Public/www-style/2012Nov/0164.html
 
--
Masataka Yakura
<myaku...@gmail.com>

Adam Barth

unread,
Aug 14, 2013, 1:30:15 AM8/14/13
to Masataka Yakura, Emil A Eklund, blink-dev
On Tue, Aug 13, 2013 at 8:22 PM, Masataka Yakura <myaku...@gmail.com> wrote:
On Wed, Aug 14, 2013 at 12:19 PM, Masataka Yakura <myaku...@gmail.com> wrote:
Did Apple change their mind? In an old thread on www-style they said they didn't want to change the behavior [1].

Oops, forgot to include the pointer. I meant http://lists.w3.org/Archives/Public/www-style/2012Nov/0164.html

It's unclear from that email whether Simon was speaking about pinch-to-zoom or full-page-zoom.  In any case, I think we should match the behavior of Firefox and Internet Explorer.  Safari is most popular on mobile, where full-page-zoom doesn't exist.  That means that implementing this feature increases, rather than decreases, compatibility.

Adam

John Mellor

unread,
Aug 14, 2013, 6:42:59 AM8/14/13
to Adam Barth, Masataka Yakura, Emil A Eklund, blink-dev
Does the scope of this intent to implement and ship also include updating the -webkit-device-pixel-ratio and resolution media queries to match window.devicePixelRatio? It would be good to change all of these at the same time; at least on Firefox their values always match (I haven't got a copy of IE to hand).

Rune Lillesveen

unread,
Aug 14, 2013, 8:58:40 AM8/14/13
to blink-dev
On Wed, Aug 14, 2013 at 12:42 PM, John Mellor <joh...@chromium.org> wrote:
> Does the scope of this intent to implement and ship also include updating
> the -webkit-device-pixel-ratio and resolution media queries to match
> window.devicePixelRatio? It would be good to change all of these at the same
> time; at least on Firefox their values always match (I haven't got a copy of
> IE to hand).

Yes, they should. Include the resolution[1] media feature, too. The
CL[2] only changes window.devicePixelRatio AFAICT.

[1] "@media (max-resolution: 1dppx)" changes when zoom > 100% in Firefox
[2] https://chromiumcodereview.appspot.com/23000005

--
Rune Lillesveen

Rune Lillesveen

unread,
Aug 14, 2013, 9:27:12 AM8/14/13
to blink-dev
On Wed, Aug 14, 2013 at 2:58 PM, Rune Lillesveen <ru...@opera.com> wrote:
> On Wed, Aug 14, 2013 at 12:42 PM, John Mellor <joh...@chromium.org> wrote:
>> Does the scope of this intent to implement and ship also include updating
>> the -webkit-device-pixel-ratio and resolution media queries to match
>> window.devicePixelRatio? It would be good to change all of these at the same
>> time; at least on Firefox their values always match (I haven't got a copy of
>> IE to hand).
>
> Yes, they should. Include the resolution[1] media feature, too. The

Doh, you actually did mention that.

--
Rune Lillesveen

Rune Lillesveen

unread,
Aug 14, 2013, 10:47:52 AM8/14/13
to blink-dev, joh...@chromium.org, e...@chromium.org
On Wed, Aug 14, 2013 at 2:58 PM, Rune Lillesveen <ru...@opera.com> wrote:
I took the liberty to upload a patch: https://codereview.chromium.org/23192002/

--
Rune Lillesveen
Reply all
Reply to author
Forward
0 new messages