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

Re: [css3-regions][css3-gcpm] Thoughts on Plan A and Plan B

From: Brad Kemper <brad.kemper@gmail.com>
Date: Wed, 22 Feb 2012 09:41:57 -0800
Cc: "www-style@w3.org Style" <www-style@w3.org>
Message-Id: <88600923-30EB-431A-BE9A-3754C4186FE3@gmail.com>
To: Christoph Päper <christoph.paeper@crissov.de>

On Feb 22, 2012, at 5:50 AM, Christoph Päper wrote:

> Håkon Wium Lie:
> 
>> @page :first { columns: 3 }
>> @page { columns: 2 }
>> 
>> body::first-page { columns: 3 }
>> body { columns: 2 }
>> 
>> @page :first {
>>   h1 { color: red }
>> }
>> 
>> @page :first {
>>   columns: 3;
>>   h1 { color: red }
>> }
>> 
>> @page :first h1 {
>>   color: red
>> }
> 
> The selector “@page :first” (at-scope) selects the first physical or logical page in a set. This page has outer properties like physical dimensions (height and width), but it should be a stupid canvas, agnostic of what is painted on it. It’s debatable whether it may be an appropriate multi-column host.

Everything is debatable, but I disagree that the @page rule cannot say anything about what is painted on it. I would like it to be more like @region. Regions and pages are very similar concepts.

> The selector “body::first-page” (pseudo-element) would match the first page that is used for the content of the ‘body’ element, which may or may not be the first page of all the pages for the current document. This page is restricted style-wise in the same way as ‘@page’. 
> Like ‘::first-line’ and ‘::first-letter’ this pseudo-element would have to be restricted to the subject of the selector, which in level 3 is the final place in the chain of compound selectors, because it does not exist in the element tree – only in the box tree – and therefore cannot be used to select further descendants. Matching against the box tree is nothing Selectors currently allows.

I also disagree that selecting the children of a pseudo-element is an insurmountable problem. I think we should remove this restriction from the selectors spec. It does not serve the needs of authors; it only seems to be there to make things more convenient for implementors.

> The selector “body:first-page” (pseudo-class) would match the ‘body’ element (that is all of it and its descendants) if and only if it is completely on the first page of all the pages there are for this document.

Only if we spec it that way, and I can't imagine why we would. Regions styles items if they are partially within the region. If they can do that, then so should pages. But I do prefer putting the styling inside the @rule, as regions does, rather than as a general pseudo-class.

> Sometimes “body *:first-page” or “body>*:first-page” might give the desired result.
> 
> What you want instead is a selector to style all parts and descendants (or parts thereof) of a basic selector which will appear on the first page. Since changing their style might make them not appear on this page, there are possible recursions. This makes the design more complicated.
> 
> There are basically two syntactic choices that are not counter-intuitive based on how other selectors work:
> 
> 1.  ‘@page’ <page-name>? <page-pseudo>? <normal-selector>
> 2.  <pseudo-region> :=
>                 ‘:::first-page’
>               | ‘:::last-page’
>               | ‘:::only-page’
>               | ‘:::empty-page’
>               | ‘:::nth-page(’ a ‘n’ [ ‘+’ b ]? ‘)’
>               | ‘:::nth-last-page(’ a ‘n’ [ ‘+’ b ]? ‘)’
> 
> The former variant appears in the quotation as the last suggestion.
> 
> The latter variant extends the differentiation between pseudo-classes (1 colon) and pseudo-elements (2 colons) to pseudo-regions or pseudo-pages (3 colons). Like pseudo-classes may apply to pseudo-elements, both may apply to pseudo-regions.

This seems overly complicated, compared to putting the rules inside @page, with no real gain. It would be more confusing for authors to have to learn this new pattern, when they already get confused about the difference between a pseudo-class and a pseudo-element.

> One could replace the three colons by “:on-” to make equivalent pseudo-classes, where naming makes all the difference from the pseudo-class discussed above. I don’t think that’s a good idea, though.
> 
> The variant with selectors and rulesets inside an at-block does not work for ‘@page’, because it already has property-value pairs – or descriptors? – directly inside itself. Rules and rulesets shall not appear on the same syntactic level.

Agreed WRT combining them at the same level, but it is not too late to change @page to not have bare declarations without a selector and braces. If we fix that, then we have a very useful place to put selectors for things that appear on the page, and it would be consistent with @region.

> The same thoughts apply to regions.
Received on Wednesday, 22 February 2012 17:42:29 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:51 GMT