Re: [css3-values][css3-page] Viewport-percentage length units in the page context.

Le 19/10/2012 15:33, Leif Arne Storset a écrit :
> On Sat, 13 Oct 2012 13:57:11 +0200, Simon Sapin <simon.sapin@kozea.fr>
> wrote:
>
>> Le 13/10/2012 10:55, Simon Sapin a écrit :
>>> While writing this, I notice another kind of cycle. css3-page defines:
>>> "The page context inherits from the root element." How about this?
>>>
>>>        :root { font-size: 1vw }
>>>        @page { width: 200em }
>>>
>>> I can’t find a satisfying way to resolve this one. Any ideas?
>
> How about disallowing the least useful of the two? In my mind, expressing
> font-size in viewport units seems least useful, and there's no precedent
> for sizing fonts relative to a box.

I’ve seen it used: http://css-tricks.com/viewport-sized-typography/
It also seems useful to have the root’s font-size inherit (through the 
page context) to page-margin boxes.

Therefore, another suggestion:
Disallow viewport-based and font-based units on size, width, height, 
margin-*, border-*-width and padding-*.
Since font-based units are also excluded, font-size can be left alone.


>> It’s actually worse than I thought. With css3-page, the size of the page
>> (and thus, of the ICB) can change in across pages in the same document.
>> css3-values explicitly says that vw and friends are affected.
>>
>> However, the computed value of most length-based properties is supposed
>> to be absolute. For example, em-based values are made absolute at this
>> point, much earlier than layout. What about vw? Computed values apply to
>> elements, not box fragments. Should every element have a (potentially)
>> different set of computed values for every page?
>
> Doesn't this apply to percentage lengths as well? Their computed values
> are still percentages (for relevant properties). What happens for them
> when laid out over multiple differently-sized pages?

(Note that this whole thing is only an issue in paged media.)

Percentages get a special treatment when they are based on layout: they 
are resolved in used values, not computed values.

For example:
http://www.w3.org/TR/CSS21/box.html#propdef-margin-top
> Computed value: the percentage as specified or the absolute length

Some properties accept lengths but not percentages, so the computed 
value is always an absolute length:

http://www.w3.org/TR/css3-multicol/#cw
> Computed value: the absolute length, zero or larger

This means that without viewport-based units, computed values never 
change across pages of the same document.


I think that the only sane way to handle viewport-percentage units in 
paged media is to treat them like other layout-based percentages: keep 
the percentage in the computed value and only convert it to an absolute 
unit in used values.

This should not change the layout, even if these computed values end up 
being inherited: the initial containing block is still the same. It 
might be visible in the CSSOM, but I’m not sure.

Spec-wise however, this is in contradiction with the "Computed value" 
line of every property that accept <length>.

-- 
Simon Sapin

Received on Friday, 19 October 2012 16:01:04 UTC