W3C home > Mailing lists > Public > www-style@w3.org > October 2012

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

From: Simon Sapin <simon.sapin@kozea.fr>
Date: Fri, 19 Oct 2012 18:00:31 +0200
Message-ID: <5081791F.6070309@kozea.fr>
To: Leif Arne Storset <lstorset@opera.com>
CC: WWW Style <www-style@w3.org>
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:
> 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:

> 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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:04 UTC