[csswg-drafts] [css-mediaqueries] Precisely define which media features an undisplayed page has. (#3800)

emilio has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-mediaqueries] Precisely define which media features an undisplayed page has. ==
Gecko has never evaluated media features in display: none iframes, which causes interop issues (because `matchMedia` wouldn't work and pages would get confused).

I'm fixing that (https://bugzilla.mozilla.org/show_bug.cgi?id=1490401), but that raises the question of what should the values for the different media features be in this case.

I know that people rely at least on having a viewport of 0x0, and a device-size that doesn't always evaluate to false: https://bugzilla.mozilla.org/show_bug.cgi?id=1519463

With my patch, all engines agree on having a 0x0 viewport, afaik. But Gecko will also report 0x0 device size (in which screen is a display: none iframe displayed?). I don't think we have a compat constraint on that, but I think we should define what the expected result is.

In general, Gecko will just return dummy values for things that depend on the device. In particular:

 * `device-size` will be 0x0
 * media type will be `screen`.
 * DPR will be 1.0
 * `color` will be 8.

I think that's reasonable. We could do a bit more effort for the last three and check the parent document for iframes that are children of displayed pages, but for pages that are not displayed (e.g. have been navigated away, or are in the bfcache) we don't know what is the value for those in a multi-display situation anyway.

What do other engines do? What should they do?

/cc @lilles

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3800 using your GitHub account

Received on Thursday, 4 April 2019 11:23:11 UTC