Cyclic counter style represents values below 1 (zero, negative) incorrectly
Categories
(Core :: Layout: Generated Content, Lists, and Counters, defect)
Tracking
()
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.
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.
Comment 1•2 years ago
|
||
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.
Comment 2•2 years ago
|
||
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
Updated•2 years ago
|
Assignee | ||
Comment 3•1 year ago
|
||
Updated•1 year ago
|
Comment 4•1 year ago
|
||
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.
Comment 5•1 year ago
|
||
Ah, sorry, I didn't realize you didn't have commit access. Will push this for you.
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
Comment 8•1 year ago
|
||
bugherder |
Upstream PR merged by moz-wptsync-bot
Updated•1 year ago
|
Comment 10•1 year ago
|
||
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.
Description
•