Closed Bug 348278 Opened 18 years ago Closed 18 years ago

CSS counter regression; what worked in 1.5.0.0 now doesn't

Categories

(Core :: CSS Parsing and Computation, defect)

1.8 Branch
All
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: dwheeler, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6

The CSS counter implementation, which worked in 1.5.0.0, now doesn't seem to.
Counters that are supposed to increment don't; counters that aren't supposed to be shown are.


Reproducible: Always

Steps to Reproduce:
View http://www.dwheeler.com/essays/opendocument-open.html


Actual Results:  
For example, look at this, which rendered correctly in 1.5.0.0:
http://www.dwheeler.com/essays/opendocument-open.html

I expected the title to NOT display a counter, but for the other h1 headings to show an increment the counter - instead, they ALL show "1" (no hiding, no incrementing).  I expected level 2s to increment, which they don't.  This worked on 1.5.0.0.


Expected Results:  
I expected the title (first h1) to NOT show a counter, and for the rest of the counters to increment.

There is an old bug 3247 that is not the same.  There, it was noted that
counter-increment must be on the real element, not in the pseudo-element (:before in this case).  But as long as the counter was on the real element, it used to work.  Now it doesn't.
Component: General → Style System (CSS)
Product: Firefox → Core
Version: unspecified → 1.8 Branch
I don't see how this ever worked without resetting h1c on the body.
And I see the exact same behavior on the trunk, 1.5.0.6, and 1.5.
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → INVALID
And, to be clear, the numbering I see is:

1.
1.
0.1.
0.2.
...

which is what I'd expect to see based on the style sheet.
I see identical rendering in Firefox 1.5.0.0, Firefox 1.5.0.6, and on trunk:

* All the <h1>s are numbered "1."
* The <h2>s are numbered "0.1.", "0.2.", and so on.

The first of these is correct.  The basic issue is that there are no counter-resets for the "h1c" counter anywhere.  This means that it's reset on every new scope where it gets incremented.  Since the only counter-increments for "h1c" are in h1:before, it gets reset to 0, then incremented, then goes out of scope when the h1 ends.  As a result, the value of the counter in h1::before is always 1, and is always 0 outside the <h1>s.

Putting "counter-reset: h1c" on the <body> would help.  So would moving the counter-increment for "h1c" from h1::before to h1.

Note that the "h1.title" rule in the stylesheet has no effect since there is no <h1> with that class.  If I style the first <h1> to have that class, I get rendering that matches your expected results on trunk (and still the same rendering as before in both 1.5.0.0 and 1.5.0.6 -- that would be a bug in those, but it's fixed on trunk, apparently).
Component: Style System (CSS) → General
Product: Core → Firefox
Resolution: INVALID → WORKSFORME
Version: 1.8 Branch → unspecified
Component: General → Style System (CSS)
Product: Firefox → Core
Version: unspecified → 1.8 Branch
You need to log in before you can comment on or make changes to this bug.