Closed Bug 1939352 Opened 2 months ago Closed 26 days ago

Counter is not reset when using a registered custom property

Categories

(Core :: CSS Parsing and Computation, defect)

Firefox 135
defect

Tracking

()

RESOLVED DUPLICATE of bug 1939353

People

(Reporter: kizmarh, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:135.0) Gecko/20100101 Firefox/135.0

Steps to reproduce:

  1. Open https://codepen.io/kizu/pen/emOEPXp?editors=1100 or the attached .html
  2. Look at the first 2 lines after the test1 and test2 lines.

Actual results:

These lines show 0

Expected results:

These lines should be the same as the other two lines below them.

Some notes:

  1. The test3, I think, is a different issue, and I'll open a separate bug about it.
  2. As seen from the test cases, using a non-registered property works fine, as well as calling the custom property inside a calc()
  3. Interestingly, after doing one of the things from point 2 (calc() or using a non-registered custom property), when doing the same thing with the registered one — it then works. See the last line in each test.

The Bugbug bot thinks this bug should belong to the 'Core::CSS Parsing and Computation' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core

The severity field is not set for this bug.
:jwatt, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(jwatt)

I think what you're seeing is that the effective value ends up being fractional, and counter-reset doesn't deal with that (e.g., counter-reset: test 10.5 is invalid), right?

I can also see 0 in other browsers at some zoom levels, which would support this diagnostic. If so I think the code is not wrong, you just need a round() somewhere, or making the property an <integer>.

Flags: needinfo?(jwatt) → needinfo?(kizmarh)

Ah, hmm. Yes, this looks like it, and the fractional value is there because of https://bugzilla.mozilla.org/show_bug.cgi?id=1939353, I guess.

And then because counter-reset is not reset on the last item due to the fractional value, it takes the value of that counter from the previous sibling that did reset it, so that's why it seems to “work” accidentally (but does not).

I think it should be safe to mark this as a duplicate of https://bugzilla.mozilla.org/show_bug.cgi?id=1939353 then,

Status: UNCONFIRMED → RESOLVED
Closed: 26 days ago
Duplicate of bug: 1939353
Flags: needinfo?(kizmarh)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: