Bug 78087

Summary: Enable the 'resolution' media query by default
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: CSSAssignee: Sam Sneddon [:gsnedders] <gsnedders>
Status: RESOLVED FIXED    
Severity: Normal CC: adele, alexander.shalamov, ap, astorino.design, bfulgham, commit-queue, dino, eoconnor, eric, gsnedders, jicheu, kenneth, matthew.wade, nicolas, rik, sh4.seo, simon.fraser, spamfaenger, syoichi, vertigoback, webkit-bug-importer, webkit, zalan
Priority: P2 Keywords: BrowserCompat, InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=100137
Bug Depends on: 99077, 100231, 100382, 229776, 229777, 236734    
Bug Blocks: 93304, 16832    
Attachments:
Description Flags
Patch none

Simon Fraser (smfr)
Reported 2012-02-08 01:26:57 PST
Need to implement http://dev.w3.org/csswg/css3-mediaqueries/#resolution0 See FIXME in MediaQueryEvaluator.cpp: FIXME: following media features are not implemented: color_index, scan, resolution
Attachments
Patch (1.46 KB, patch)
2021-12-10 10:33 PST, Sam Sneddon [:gsnedders]
no flags
Simon Fraser (smfr)
Comment 1 2012-02-08 01:28:11 PST
This should do the right thing when printing too (report printer output resolution).
Simon Fraser (smfr)
Comment 2 2012-02-08 01:43:21 PST
Also need to match what other browsers do when pageScale changes.
Radar WebKit Bug Importer
Comment 3 2012-02-08 12:03:32 PST
Eric Meyer
Comment 4 2012-04-17 07:14:09 PDT
If you want a quick initial test, http://meyerweb.com/eric/css/tests/mq-valueless.html includes valueless, iPhone 4S value (I think), and min/max queries. See test 11. If not, no harm done.
Theresa O'Connor
Comment 5 2012-06-27 10:20:59 PDT
General comment: It's not clear to me why we would implement the resolution media query, considering how broken it is. Eric, that isn't the correct iPhone 4S value per the spec, because the CSS dpi unit is "physical pixels per CSS inch" and a CSS inch is 96 CSS pixels. So "resolution: 192dpi" should match on an iPhone 4S.
Seo Sanghyeon
Comment 6 2012-06-27 21:46:32 PDT
How does this relate to bug 85262?
Simon Fraser (smfr)
Comment 7 2012-06-27 21:59:37 PDT
(In reply to comment #6) > How does this relate to bug 85262? That is about a new CSS property based on the resolution of image resources. This is about a media query based on screen resolution.
Adele Peterson
Comment 8 2012-10-23 10:01:19 PDT
Kenneth Rohde Christiansen
Comment 9 2012-10-23 10:05:06 PDT
(In reply to comment #8) > Should we dupe this to https://bugs.webkit.org/show_bug.cgi?id=99077? It still need some special handling when printing as smfr pointed out, but maybe that is another bug
Kenneth Rohde Christiansen
Comment 10 2012-10-24 05:12:04 PDT
(In reply to comment #2) > Also need to match what other browsers do when pageScale changes. According to https://bugzilla.mozilla.org/show_bug.cgi?id=662061 zooming ( and I assume pageScale) should not affect the resolution values. It currently does in Firefox 16, at least full page zoom, though not text size zoom.
Simon Fraser (smfr)
Comment 11 2013-09-09 14:04:01 PDT
Support for the 'resolution' media query was added behind ENABLE(RESOLUTION_MEDIA_QUERY) via bug 99077.
Albert Scheiner
Comment 12 2014-12-13 20:26:10 PST
Are there any plans to enable it by default any time soon? Once dppx support lands in IE (it's currently in preview built) all other major browser have added full support. http://dabblet.com/gist/7166616 https://status.modern.ie/dppxunitfortheresolutionmediaquery?term=dppx
Chris Rebert
Comment 13 2015-10-05 12:39:13 PDT
MS Edge has shipped this (see http://caniuse.com/#feat=css-media-resolution ), so now only WebKit doesn't support this.
Mattia Astorino
Comment 14 2020-07-23 12:22:19 PDT
This bug was filed 8 years ago, even IE 9 supports this important media query. What happened here? 😕
Brent Fulgham
Comment 15 2021-08-24 15:43:36 PDT
(In reply to Mattia Astorino from comment #14) > This bug was filed 8 years ago, even IE 9 supports this important media > query. What happened here? 😕 The media query has existed in WebKit since 2012. It looks like some details specific to printing were not completed @Mattia: What issues have you had when you used the 'resolution' media query in Webkit? Were you attempting printing?
Brent Fulgham
Comment 16 2021-08-24 17:22:26 PDT
(In reply to Brent Fulgham from comment #15) > (In reply to Mattia Astorino from comment #14) > > This bug was filed 8 years ago, even IE 9 supports this important media > > query. What happened here? 😕 > > The media query has existed in WebKit since 2012. It looks like some details > specific to printing were not completed > > @Mattia: What issues have you had when you used the 'resolution' media query > in Webkit? Were you attempting printing? I see - it's present but apparently not enabled by default? I'm trying to see what the correct state of this flag should be.
Sam Sneddon [:gsnedders]
Comment 17 2021-08-25 00:35:19 PDT
(In reply to Brent Fulgham from comment #16) > (In reply to Brent Fulgham from comment #15) > > (In reply to Mattia Astorino from comment #14) > > > This bug was filed 8 years ago, even IE 9 supports this important media > > > query. What happened here? 😕 > > > > The media query has existed in WebKit since 2012. It looks like some details > > specific to printing were not completed > > > > @Mattia: What issues have you had when you used the 'resolution' media query > > in Webkit? Were you attempting printing? > > I see - it's present but apparently not enabled by default? I'm trying to > see what the correct state of this flag should be. Correct; ENABLE_RESOLUTION_MEDIA_QUERY is not defined for any current port, as far as I can tell (and that's likely been the case since the Blink fork). It doesn't look like there's anything too likely to have bitrotted or is missing there, at least. (In reply to Theresa O'Connor from comment #5) > General comment: It's not clear to me why we would implement the resolution > media query, considering how broken it is. The thread starting at https://lists.w3.org/Archives/Public/www-style/2012Apr/0674.html is about this brokenness, and summarised in Maciej's response in https://lists.w3.org/Archives/Public/www-style/2012Apr/0747.html: > For comparison, device-pixel-ratio was first implemented as a vendor extension in 2006[1] and exists (prefixed) in at least WebKit, Presto and Gecko. So I wondered why device-pixel-ratio counts as "add[ing] anything new" but the [first defined in late 2011/early 2012] dppx unit does not. I don't follow closely, so maybe there is some reason for diverging from content and implementations here. Regardless, while it might be the case that resolution: [n]dppx (and the other <resolution> units, aside from dppx, are confusing) is redundant with -webkit-device-pixel-ratio: n (which is itself now standardised in https://compat.spec.whatwg.org/#css-media-queries-webkit-device-pixel-ratio), I think it's pretty clear the ship here has sailed.
Sam Sneddon [:gsnedders]
Comment 18 2021-12-10 10:33:48 PST
EWS
Comment 19 2021-12-10 13:57:34 PST
Committed r286874 (245104@main): <https://commits.webkit.org/245104@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 446755 [details].
WebKit Commit Bot
Comment 20 2022-02-16 14:37:49 PST
Re-opened since this is blocked by bug 236734
Sam Sneddon [:gsnedders]
Comment 21 2022-02-18 05:50:02 PST
bug 236804 reverted the revert; this shouldn't have been reverted on trunk for that breakage
matthew.wade
Comment 22 2022-05-25 09:58:28 PDT
I'm having trouble understanding the recent commits / reverts on this. Is there an intent to *enable* the 'resolution' media query by default in Webkit (Safari)? Or when we say "that ship has sailed," are we saying that Safari will continue to *not* support the 'resolution' media query in lieu of the '-webkit-device-pixel-ratio' feature?
Sam Sneddon [:gsnedders]
Comment 23 2022-05-25 11:03:28 PDT
(In reply to matthew.wade from comment #22) > I'm having trouble understanding the recent commits / reverts on this. > > Is there an intent to *enable* the 'resolution' media query by default in > Webkit (Safari)? > > Or when we say "that ship has sailed," are we saying that Safari will > continue to *not* support the 'resolution' media query in lieu of the > '-webkit-device-pixel-ratio' feature? It is enabled by default, and has been on trunk since December. It was disabled on one Safari release branch (and, inadvertently also on trunk briefly) due to site breakage caused by enabling it (mostly sites using `@media not all and (min-resolution:.001dpcm)` to specifically target WebKit, which inevitably stops matching with support for the resolution feature). As for Safari, Apple does not comment on future releases.
matthew.wade
Comment 24 2022-05-26 09:52:13 PDT
(In reply to Sam Sneddon [:gsnedders] from comment #23) > (In reply to matthew.wade from comment #22) > > I'm having trouble understanding the recent commits / reverts on this. > > > > Is there an intent to *enable* the 'resolution' media query by default in > > Webkit (Safari)? > > > > Or when we say "that ship has sailed," are we saying that Safari will > > continue to *not* support the 'resolution' media query in lieu of the > > '-webkit-device-pixel-ratio' feature? > > It is enabled by default, and has been on trunk since December. It was > disabled on one Safari release branch (and, inadvertently also on trunk > briefly) due to site breakage caused by enabling it (mostly sites using > `@media not all and (min-resolution:.001dpcm)` to specifically target > WebKit, which inevitably stops matching with support for the resolution > feature). > > As for Safari, Apple does not comment on future releases. Thanks, this is very helpful! Also, you practically read my mind with the `@media not all and (min-resolution: .001dpcm)` hack, I was essentially asking how "safe" that is to continue using as a way to detect Safari. Based on all this, my guess is the answer is basically "it still works in the latest Safari, but could stop working at any time." I didn't realize the split between Webkit and how Apple uses it in Safari releases, so thanks for that context as well.
Note You need to log in before you can comment on or make changes to this bug.