Re: [csswg-drafts] [css-mediaqueries] [css-page] Viewport units / media queries interaction in print documents. (#5437)

Thanks for tagging us in this issue. We have compiled some information on how we got to our current implementations and thoughts on the further development:

Media Features:

We support the deprecation of `device-width`. While we gave it a default value equal to the default page width, this was mainly to have a sensible default value for the common case that no media feature values are set in the API. We don't think there is an actual need for this feature. 

We don't oppose adding a `page-width` media feature, but don't consider it necessary, either.

The `width` media feature having a default value matching the default page content width matches the common concept of the first page content box being the equivalent of the viewport.

The reason we decided against actually using the sizes of the first page for those was to avoid multipass processing of CSS and potential cyclical dependencies, as already discussed here. However, once fully specified we'd of course adapt our behavior accordingly. 

About computing the `width` media feature value from page styles there are some details we'd like to discuss:
- Should all `@media` rules (and `@import` with non-empty media-query-list) be skipped or should expressions based on affected features specifically be considered non-matching?
- Should this pass be specifically be done only once, even if the style sheets are modified by JavaScript later on? If so, should it be guaranteed to be done before any scripts are executed?
- Should the styles be taken from the generic `@page` rules (i.e. those without selectors) or from the `@page` rules that affect the first page?

Units:

For the `vw` unit we use the width of the page area (content) of the first page. We also have the proprietary unit `-ro-pw` ("page width"), which is based on the page box (margin/trim).

After reading through this issue we are considering changing that from the first page to the generic one (computed from `@page` rules without selectors, but in this case not generally skipping `@media` rules).

As the computations for the units include `@page` rules within matching `@media` rules, and the computations for media features don't, `100vw` can differ from the value of the `width` feature.

To avoid cyclical dependencies for `vw` units in `@page` rules (at least for `size`, `margin`, `border-width` and `padding`) we'd prefer to handle this at the point of resolving the units, either using a fixed reference size or per-property fixed results, independent of the number. Either of those could be based on common values or intentionally noticeable ones. For simplicity this should affect all values in `@page` rules, regardless of their properties.

-- 
GitHub Notification of comment by bernhardf-ro
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5437#issuecomment-692679491 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 15 September 2020 12:23:20 UTC