Closed Bug 1801264 Opened 2 years ago Closed 1 year ago

Cyclic counter style represents values below 1 (zero, negative) incorrectly

Categories

(Core :: Layout: Generated Content, Lists, and Counters, defect)

Firefox 108
defect

Tracking

()

VERIFIED FIXED
111 Branch
Tracking Status
firefox111 --- verified
firefox112 --- verified

People

(Reporter: me, Assigned: GPR, Mentored, NeedInfo)

Details

(Keywords: good-first-bug)

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0

Steps to reproduce:

Load this HTML document (data:text/html,<style>@counter-style x{system:cyclic;symbols:A B C}ol{list-style:x}</style><ol start=-4><li><li><li><li><li><li><li><li><li><li>):

<style>
@counter-style x {
    system: cyclic;
    symbols: A B C;
}
ol {
    list-style: x;
}
</style>
<ol start=-4><li><li><li><li><li><li><li><li><li><li>

That is, we define a counter style using the cyclic symbols A, B and C, and use it to draw a list with values from −4 to 5 inclusive.

Actual results:

The list markers used are C, A, B, C, A, A, B, C, A, B.

That is, it’s mirrored below one (at 0.5, if you will).

Expected results:

The list markers should have been B, C, A, B, C, A, B, C, A, B.

The spec reads:

If there are N counter symbols and a representation is being constructed for the integer value, the representation is the counter symbol at index ( (value-1) mod N) of the list of counter symbols (0-indexed).

This matches my intuitive expectations of a cyclic system, and matches the implementation in Chromium.

The Bugbug bot thinks this bug should belong to the 'Core::Layout: Generated Content, Lists, and Counters' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Layout: Generated Content, Lists, and Counters
Product: Firefox → Core

Relevant code is in https://searchfox.org/mozilla-central/rev/aa329cf7506ddd966542e642ec00223fd7461599/layout/style/CounterStyleManager.cpp#50, should be a relatively straight-forward fix + test if I'm reading the code correctly

Mentor: emilio
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: good-first-bug
Severity: -- → S3
Assignee: nobody → gpr
Status: NEW → ASSIGNED

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:GPR, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit auto_nag documentation.

Flags: needinfo?(gpr)
Flags: needinfo?(emilio)

Ah, sorry, I didn't realize you didn't have commit access. Will push this for you.

Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9c3ff797a0d4
Fix cyclic counter style show incorrectly when starting from negative value. r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/38445 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 111 Branch
Upstream PR merged by moz-wptsync-bot
QA Whiteboard: [qa-111b-p2]

Reproducible on a 2023-02-05 Nightly build on macOS 12.
Verified as fixed on Firefox 111.0b6(build ID: 20230226190100) and Nightly 112.0a1(build ID: 20230226214053) on macOS 12, Windows 11, Ubuntu 22.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-111b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: