W3C home > Mailing lists > Public > www-style@w3.org > March 2015

Re: [css-page] properties that only apply within the page context

From: Simon Sapin <simon.sapin@exyr.org>
Date: Thu, 26 Mar 2015 14:14:09 +0100
Message-ID: <55140621.8070201@exyr.org>
To: www-style@w3.org
On 25/03/15 23:37, Tab Atkins Jr. wrote:
> The implications of each possibility are:
> # If they're descriptors
> * They don't show up in the gCS()/etc results for normal elements.
> * The inheritance behavior needs to be defined in reasonable detail,
> rather than relying on the cascade.  (This isn't hard to do.)
> # If they're properties
> * They show up in gCS()/etc for all elements.
> * Inheritance is "free"
> * The page becomes an element in the element tree; is basically a
> pseudo-element that has a weird at-rule syntax for legacy reasons.

CSS 2 defines:

> In CSS 2.1, only the margin properties ('margin-top', 'margin-right',
> 'margin-bottom', 'margin-left', and 'margin') apply within the page
> context.

This is the margin-top property, with the same definition and semantics 
as for elements. Not a descriptor that happens to have the same name.

In CSSOM, CSSPageRule and CSSMarginRule have a `style` attribute of type 
CSSStyleDeclaration, same as the `style` attribute of CSSStyleRule.


Compare with e.g. CSSFontFaceRule which directly has attributes like 
`family` and `weight` of type `DOMString`.

CSS Paged Media has, in section titles, "the size property", "the bleed 
property", "CSS 2.1 Properties that apply within the page context" etc.


These properties inherit:

> The normal rules for CSS properties apply with the following exceptions:
> * page-margin boxes inherit from the page context. The page context
> inherits from the root element.

The word "descriptor" only appears in the spec in an index automatically 
generated by Bikeshed. (For some reason, only 'bleed' is listed there, 
not 'size' or 'marks'.)

Page boxes and page-margin boxes are not generated by any element or 
pseudo-element. I don’t think it makes sense to call them pseudo 
elements. But they are part of the box tree and have computed values and 
used values of properties. Layout algorithms are based on these properties.

Now, we could rewrite everything to define @page { margin: 2cm } as a 
descriptor that just happens to behave like a property in every aspect, 
but that’s a lot of work and duplicated definitions for no benefit that 
I can see.

Simon Sapin
Received on Thursday, 26 March 2015 13:14:44 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:52 UTC