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

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:

http://dev.w3.org/csswg/css2/page.html#page-margins
> 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.

http://dev.w3.org/csswg/cssom/#the-csspagerule-interface

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.

http://dev.w3.org/csswg/css-page/#page-property-list

These properties inherit:

http://dev.w3.org/csswg/css-page/#page-properties
> 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