Re: [css3-page] Media Queries based on the page size

Le 02/02/2013 19:09, Simon Sapin a écrit :
> Hi,
>
> §8.1 of css3-page says
>> Media queries do not honor ‘size’: they assume the paper size that
>> would be chosen if no @page rules were specified.
>
>
> This is consistent with §2 of css3-mediaqueries:
>> To avoid circular dependencies, it is never necessary to apply the
>> style sheet in order to evaluate expressions.
>
>
> However, css3-page has an inline issue:
>> It would be useful if media queries could respond at least to sizes
>> specified on an unqualified @page.
>
> See also https://www.w3.org/Style/CSS/Tracker/issues/39
>
> I agree this would be nice in simple cases, but it would be a clear
> layering violation and against the principle set in css3-mediaqueries.
> Even ignoring that, the best we could do is to have MQs based on the
> size of the first page, while subsequent pages might have a different size.
>
> I propose resolving this issue with no change. MQs are based on the
> default page size.


This is https://www.w3.org/Style/CSS/Tracker/issues/309
but also related to https://www.w3.org/Style/CSS/Tracker/issues/308


On yesterday’s conf call we discussed doing something similar to how 
@viewport rules in css-device-adapt interact with Media Queries.

css-device-adapt has concepts of "initial viewport" and "actual 
viewport". @viewport rules are first applied (accounting for @import and 
conditional rules) by resolving MQs based on the initial viewport, and 
determine the actual viewport. Only then, the rest of the rules are 
applied by evaluation conditionals again, this time with MQs based on 
the actual viewport.


In Paged Media I proposed something similar for viewport units:
http://lists.w3.org/Archives/Public/www-style/2013Feb/0676.html

So it might be worth doing it for Media Queries too, after all. It’s a 
bit more complex than css-device-adapt, though, since there is not a 
single viewport but multiples pages that can have different sizes.

As discussed in the thread linked above, using the actual first page 
might be hard (require not only the full cascade but also box 
generation.) So we need something like a "default page size" that 
accounts for (some) @page rules.

I’ll try to figure out the details and make proposals, but suggestions 
are very welcome.

-- 
Simon Sapin

Received on Thursday, 28 February 2013 13:12:28 UTC