WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
202752
devicePixelRatio always reporting 1
https://bugs.webkit.org/show_bug.cgi?id=202752
Summary
devicePixelRatio always reporting 1
Roger Far
Reported
2019-10-09 08:52:47 PDT
In the latest Safari releases it seems that devicePixelRatio is always reporting 1 no matter how far your browser is zoomed in or out (either desktop safari or mobile iOS).
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2019-10-11 16:20:39 PDT
I cannot reproduce this on my Mac. No zooming, retina display -> devicePixelRatio is 2.
Roger Far
Comment 2
2019-10-11 16:26:33 PDT
If you do zoom in, does the devicePixelRatio change? For me it stays on 1 all the time.
Tim Horton
Comment 3
2019-10-11 16:34:13 PDT
devicePixelRatio is /not/ affected by zooming. If you have a 1x display, it will always be 1, if you have a 2x display, it will always be 2.
Alexey Proskuryakov
Comment 4
2019-10-11 17:02:56 PDT
Turns out that it affected by zooming is in Firefox and Chrome. Which even makes some sense.
Roger Far
Comment 5
2019-10-11 17:07:30 PDT
I would have to do some regression testing, but we've only seen this change with customers on newer Safari versions. Also maybe related, if you put iOS 13 on "Request desktop page" it will always return 1, where 2 would make more sense (but this might be done on purpose to not use it as a workaround to detect mobile).
Tim Horton
Comment 6
2019-10-11 17:33:16 PDT
> Also maybe related, if you put iOS 13 on "Request desktop page" it will always return 1, where 2 would make more sense (but this might be done on purpose to not use it as a workaround to detect mobile).
No, that's not the intent. Desktop displays can be 2x as well. I would not expect devicePixelRatio to be 1 in "Request desktop" mode.
Tim Horton
Comment 7
2019-10-11 17:35:36 PDT
I also cannot reproduce any such behavior; devicePixelRatio is maintained correctly between mobile and desktop mode for me. Do you have any more details about the devices, like what version of iOS they're running?
Simon Fraser (smfr)
Comment 8
2019-10-14 13:12:29 PDT
Please re-open if you can more specific about the scenario in which this occurs.
Simon Fraser (smfr)
Comment 9
2019-10-14 14:26:36 PDT
Roger, can you clarify you intent with this bug? I think you're saying that you would expect devicePixelRatio to change on zooming (as it does in Gecko and Blink)? WebKit has always disagreed with this behavior, since it exposes zooming to the author, and we suspect that many web developers would naively use it to scale canvas backing store, but often trigger out-of-memory issues if they do this wrong. You said "In the latest Safari releases" but this behavior hasn't changed in the latest releases.
Roger Far
Comment 10
2019-10-14 14:31:31 PDT
Sorry for the delay, it's Thanksgiving long weekend here in Canada, I'll post some samples tomorrow.
Roger Far
Comment 11
2019-10-15 07:17:22 PDT
I created a repo and tried to reproduce the issue, which I couldn't it works as expected, except one difference. If you zoom to 75% in Chromium it will update devicePixelRatio to 0.75, in Safari this number stays constant to 2 but doesn't account for zooming. The issue came from a user who had their iOS Safari set to "Request Desktop Mode" which in our codebase ignored the devicePixelRatio due to the user-agent string changing, which made me now realize that zooming doesn't change the devicePixelRatio on Safari at all. The only issue I found is this one:
https://bugs.webkit.org/show_bug.cgi?id=124862
where the "webkitPageZoomRatio" property was discussed, but this either doesn't seem to have made it's way into master or was removed again at some point because I can't find it being exposed on the "window" property. So this reported issue seems to be a non-issue, but I would like to see a discussion if it's wanted to add the webkitPageZoomRatio in again.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug