Re: [css3-page] page counters and scope

Grant, Melinda wrote:
> 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.

Right, so, "and are not affected by counter increments and resets in the document"
instead, and "However if an out-of-scope counter is used in the counter() or
counters() notation in the document, and that counter exists in the @page
counter scope, then the counter()/counters() notation refers to the counter
in the @page counter scope for this page."

Does that work?

>>       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?

Yeah, probably. The case I'm concerned about is when a counter is used
on a page before a previous element ends, e.g.

<div style="counter-reset: foo">
   <span style="content: counter(foo);"/>
   <div style="height: 2em;">
     Lots of content that spills across 3 pages
   <span style="content: counter(foo);"/>

Where both spans fall on the first page.

>>    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...?

No, I mean document counters here and 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, ...?

Yeah, except the in document order part. If an element breaks in two places
at this page break, we want the counter values from the second break.

> 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?

I'm not sure. But it will help keep implementations that handle multiple
breaks per page more consistent with implementations that can only handle
one break per page.


Received on Wednesday, 22 April 2009 23:37:36 UTC