RE: [css3-page] page counters and scope

 
fantasai said:

> So here's my attempt to define the interaction of page and 
> document counters.
> 
> At every page break (including start of document, which 
> corresponds to start of root element, i.e. immediately before 
> :root::before):
> 
>    1. Apply any counter-reset and counter-increment rules to the page box,
>       creating and incrementing counters as if all page boxes, including
>       this one, were sibling elements in a document. These counters are in
>       the @page counter scope, and do not affect content in the document.

The last sentence would preclude using page numbers within the document's contents.  I think we want to allow page references.

>    2. Apply all @page resets and increments to all document 
> counters in
>       scope at every element break point at the page break. 
> That is, from
>       each element that breaks walk up the ancestor chain collecting
>       counter scopes. (In CSS3, the UA may instead collect only the
>       scopes associated with the latest break in the normal 
> flow of the
>       root element.) Then apply all @page-based counter-reset and
>       counter-increment declarations as if an element with these
>       declarations existed in each counter scope at the exact position
>       of the break point in that counter scope.
> 
>       (Multiple break points are caused by e.g. floats and 
> tables. When
>       multiple columns of content break across the page, each 
> column has
>       a break point.)

<snip />

>       The effect of @page counter rules at breaks in overflowing content
>       is undefined. (This because some implementations print incrementally,
>       and can't back up to make counter increments apply to earlier content.)

I think in general overflowing content should break predictably and follow the counting rules, because a lot of documents print in overflow mode.  Maybe we could carve out a more narrow exception, if one is needed?

>    3. Copy counters in scope at all break points, in document order,
>       into the @page counter scope, obscuring any counters of 
> the same name
>       there. (In CSS3, this step is not required.)

Presumably you mean just page counters here and below in #4...?  I find 'all break points' a bit confusing...  I don't think you mean all page break points, so I assume you must mean the point where each element breaks?  Does my following rewording attempt capture your intent?
	3. Copy all counters manipulated within page contexts that are in scope for any element split by the page break, in document order, ...?

>    4. Copy counters in scope at the latest break point in the normal
>       flow of the root element into the @page counter scope, 
> obscuring any
>       counters of the same name there. This ensures that the 
> counters in
>       the normal flow preside over counters in e.g. floated elements.

It's not clear to me that a natural precedence exists between normal flow and floated or positioned content.  I wonder if omitting this step and just going with document order wouldn't suffice.  Are there use cases that require normal flow precedence?

> Comments?
> 
> ~fantasai
> 

Received on Wednesday, 22 April 2009 22:07:58 UTC