Re: [css3-values] viewport units (vw/vh/vmin/vmax) and @page rules

Le 25/02/2013 00:39, Håkon Wium Lie a écrit :
> Also sprach Simon Sapin:
>
>   > >   > * Viewport units in the page context (but maybe not inside margin
>   > >   > at-rules) refer to the UA’s default page size, ignoring any stylesheet.
>   > >   >
>   > >   > * Viewport units are based not on the first page, but on an hypothetical
>   > >   > page that does not match any page name or page pseudo-
>   > >   > class. (In other words, only consider @page rules without a page selector.)
>   > >   >
>   > >   > * That hypothetical page does not inherit from the root element.
>   > >   > Alternative: @page never inherits from the root.
>   > >   >
>   > >   > Would that work?
>   > >
>   > > Yes, it seems to make sense.
>   > >
>   > > I'd like for @page to inherit from the root element, to avoid having
>   > > to set font family, size etc.
>   >
>   > Yes, I’d like to preserve that use case too. But it’s really tricky to
>   > keep that and still avoid having a viewport unit depend on itself.
>   >
>   > One way maybe is to cut inheritance only for the purpose of determining
>   > viewport units, but that seems slippery.
>
> I think it's ok. It's better than having lots of error situations, or
> having to set lots of declarations. The general principle should be
> that the root provides any information it can provide, and the
> mythical ur-page provides the rest.

Which part does "it" refer to, and what does "ur-page" mean?

If I rephrase what I think we agree on so far, in terms of what a UA has 
to do:

(This is still a proposal.)

----

1. Determine the outer (device, paper sheet) and inner (content area) 
"default page size" that would be used if no stylesheet were applied.

2. Resolve conditional rules. Media Queries are based on the default 
page size.

3. Find @page rules that are not qualified by a page selector, cascade 
them together without inheritance. Viewport units there are based on the 
default page size. Determine the used inner width and height of the 
imaginary page box. This is the new reference for viewport units from 
now on.

Note: Step 3 might give unexpected results eg. if authors specify the 
page size in both :left and :right but not in unqualified rules.

4. Do the usual cascade on elements.

5. When generating actual page boxes, cascade all @page rules that 
apply, inheriting from the root element.

6. Page margin boxes inherit from the result of step 5.

----

Sounds good?

Of course the spec wording would be less "procedural", and more of 
general statements.

Next: where do we write all this? I suggest css3-page, subject to "If 
the UA also supports viewport-percentage length units, …".

In css3-values, have something like this:

> In paged media, the initial containing block is based on on the page
> area [1], but the exact calculation or usage of viewport-percentage
> lengths in the page context [2] are undefined in this specification.
> CSS Paged Media Level 3 [[CSS3PAGE]] is expected to have a more
> precise definition.
>
> [1] http://www.w3.org/TR/CSS21/page.html#page-area
> [2] http://www.w3.org/TR/CSS21/page.html#page-context

-- 
Simon Sapin

Received on Monday, 25 February 2013 09:44:41 UTC