Skip to content

[css-counter-styles] Support CJK counter styles outside of range #46446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

igower
Copy link
Contributor

@igower igower commented Jun 6, 2025

3f54df7

[css-counter-styles] Support CJK counter styles outside of range
https://bugs.webkit.org/show_bug.cgi?id=257369
rdar://problem/109875198

Reviewed by NOBODY (OOPS!).

Updated the counterForSystemCJK function to account for values in an expanded range. Now in range 10^-16 + 1 to 10^16 -1 for Chinese and Japanese styles. For tests, switched out expected behavior to behavior defined in alt-ref files to match increased range.

* LayoutTests/fast/lists/li-values-expected.txt:
* LayoutTests/fast/lists/li-values.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/japanese-formal/css3-counter-styles-049-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/japanese-formal/css3-counter-styles-049.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/japanese-informal/counter-japanese-informal-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/japanese-informal/css3-counter-styles-044-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/japanese-informal/css3-counter-styles-044.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/korean-hangul-formal/css3-counter-styles-054-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/korean-hangul-formal/css3-counter-styles-054.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/korean-hanja-formal/css3-counter-styles-064-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/korean-hanja-formal/css3-counter-styles-064.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/korean-hanja-informal/css3-counter-styles-059-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/korean-hanja-informal/css3-counter-styles-059.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/simp-chinese-formal/css3-counter-styles-078-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/simp-chinese-formal/css3-counter-styles-078.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/simp-chinese-informal/counter-simp-chinese-informal-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/simp-chinese-informal/css3-counter-styles-073-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/simp-chinese-informal/css3-counter-styles-073.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/trad-chinese-formal/css3-counter-styles-088-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/trad-chinese-formal/css3-counter-styles-088.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/trad-chinese-informal/counter-trad-chinese-informal-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/trad-chinese-informal/css3-counter-styles-083-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/trad-chinese-informal/css3-counter-styles-083.html:
* Source/WebCore/css/CSSCounterStyle.cpp:
(WebCore::counterForSystemCJK):
(WebCore::CSSCounterStyle::counterForSystemSimplifiedChineseInformal):
(WebCore::CSSCounterStyle::counterForSystemSimplifiedChineseFormal):
(WebCore::CSSCounterStyle::counterForSystemTraditionalChineseInformal):
(WebCore::CSSCounterStyle::counterForSystemTraditionalChineseFormal):
(WebCore::CSSCounterStyle::counterForSystemJapaneseInformal):
(WebCore::CSSCounterStyle::counterForSystemJapaneseFormal):
(WebCore::CSSCounterStyle::counterForSystemKoreanHangulFormal):
(WebCore::CSSCounterStyle::counterForSystemKoreanHanjaInformal):
(WebCore::CSSCounterStyle::counterForSystemKoreanHanjaFormal):
(WebCore::CSSCounterStyle::initialRepresentation const):
(WebCore::CSSCounterStyle::isInRange const):
* Source/WebCore/css/CSSCounterStyle.h:
* Source/WebCore/css/CSSCounterStyleDescriptors.cpp:
(WebCore::CSSCounterStyleDescriptors::areSymbolsValidForSystem):
(WebCore::CSSCounterStyleDescriptors::systemCSSText const):
* Source/WebCore/css/CSSCounterStyleDescriptors.h:
* Source/WebCore/css/CSSCounterStyleRule.cpp:
(WebCore::toCounterStyleSystemEnum):
* Source/WebCore/css/CSSValueKeywords.in:
* Source/WebCore/css/counterStyles.css:
(@counter-style simp-chinese-informal):
(@counter-style simp-chinese-formal):
(@counter-style trad-chinese-informal):
(@counter-style trad-chinese-formal):
(@counter-style japanese-informal):
(@counter-style japanese-formal):
(@counter-style korean-hangul-formal):
(@counter-style korean-hanja-informal):
(@counter-style korean-hanja-formal):
* Source/WebCore/css/parser/CSSPropertyParserConsumer+CounterStyles.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleSystem):

3f54df7

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ⏳ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ❌ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 🛠 playstation
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 7, 2025
@igower igower force-pushed the increase-range-CJK-counter-styles branch from b32655f to 723f31f Compare June 7, 2025 00:26
@webkit-early-warning-system
Copy link
Collaborator

Starting EWS tests for af07675. Live statuses available at the PR page, #46446

@igower igower force-pushed the increase-range-CJK-counter-styles branch from af07675 to 0124960 Compare June 9, 2025 16:26
@igower igower changed the title [css-counter-styles] Support CJK counter styles outside of range Need a short description (OOPS!). Jun 9, 2025
@igower igower force-pushed the increase-range-CJK-counter-styles branch from 0124960 to 7befb85 Compare June 9, 2025 21:46
@igower igower changed the title Need a short description (OOPS!). [css-counter-styles] Support CJK counter styles outside of range Jun 9, 2025
@igower igower force-pushed the increase-range-CJK-counter-styles branch from 7befb85 to 178f089 Compare June 9, 2025 21:48
@igower igower force-pushed the increase-range-CJK-counter-styles branch from 178f089 to 16355ae Compare June 9, 2025 21:51
@webkit-early-warning-system
Copy link
Collaborator

Starting EWS tests for 16355ae. Live statuses available at the PR page, #46446

@igower igower force-pushed the increase-range-CJK-counter-styles branch from 16355ae to 7e4f88e Compare June 10, 2025 00:30
@Ahmad-S792 Ahmad-S792 added CSS Cascading Style Sheets implementation and removed merging-blocked Applied to prevent a change from being merged labels Jun 10, 2025
Comment on lines 43 to 46
<li value="10000" style="list-style-type: japanese-informal;">The list marker should show (decimal 10000) (japanese-informal: -9999999999999999 9999999999999999).</li>
<li value="-10000" style="list-style-type: japanese-informal;">The list marker should show (decimal -10000) (japanese-informal: -9999999999999999 9999999999999999).</li>
<li value="10000" style="list-style-type: japanese-formal;">The list marker should show (decimal 10000) (japanese-formal: -9999999999999999 9999999999999999).</li>
<li value="-10000" style="list-style-type: japanese-formal;">The list marker should show (decimal -10000) (japanese-formal: -9999999999999999 9999999999999999).</li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to use a dash between the numbers, to be consistent with the other entries in this test. :)

Comment on lines 199 to 200
addSpace = false;
bool trailingZero = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment about what these are about?

Comment on lines -6 to +9
<link rel='author' title='Richard Ishida' href='mailto:[email protected]'>
<link rel="author" title="Mats Palmgren" href="mailto:[email protected]">
<link rel='help' href='http://www.w3.org/TR/css-counter-styles-3/#complex-cjk'>
<link rel="reviewer" title="Chris Lilley" href="mailto:[email protected]" />
<meta name="assert" content="[Exploratory] list-style-type: trad-chinese-formal produces counter values outside its range without using the prescribed fallback style.">
<style type='text/css'>
<link rel='help' href='https://bugzilla.mozilla.org/show_bug.cgi?id=1738356'>
<style>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing these are import changes? It seems weird to change the credits given the the test writer.

Copy link
Contributor

@fantasai fantasai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have test coverage for values such as:

1,2345,6789 (all digits non-zero)
12,0045,3001 ( leading zero in group, sandwiched zeros in group)
987,000,0123 (skipped group, leading zeros and ones)
509,000,1234 (skipped group, leading one)

?

@igower
Copy link
Contributor Author

igower commented Jun 11, 2025

@fantasai Not yet, it would be helpful to have verified results to test against.

@fantasai
Copy link
Contributor

@igower Get the results from Firefox, they're almost certainly correct. You can cross-check by tracing through the spec algorithm.

@igower igower force-pushed the increase-range-CJK-counter-styles branch from 7e4f88e to 851e952 Compare June 16, 2025 23:54
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 17, 2025
@igower igower force-pushed the increase-range-CJK-counter-styles branch from 851e952 to d7bc232 Compare June 17, 2025 16:29
@igower igower force-pushed the increase-range-CJK-counter-styles branch from d7bc232 to 55630f8 Compare June 17, 2025 17:35
https://bugs.webkit.org/show_bug.cgi?id=257369
rdar://problem/109875198

Reviewed by NOBODY (OOPS!).

Updated the counterForSystemCJK function to account for values in an expanded range. Now in range 10^-16 + 1 to 10^16 -1 for Chinese and Japanese styles. For tests, switched out expected behavior to behavior defined in alt-ref files to match increased range.

* LayoutTests/fast/lists/li-values-expected.txt:
* LayoutTests/fast/lists/li-values.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/japanese-formal/css3-counter-styles-049-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/japanese-formal/css3-counter-styles-049.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/japanese-informal/counter-japanese-informal-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/japanese-informal/css3-counter-styles-044-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/japanese-informal/css3-counter-styles-044.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/korean-hangul-formal/css3-counter-styles-054-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/korean-hangul-formal/css3-counter-styles-054.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/korean-hanja-formal/css3-counter-styles-064-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/korean-hanja-formal/css3-counter-styles-064.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/korean-hanja-informal/css3-counter-styles-059-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/korean-hanja-informal/css3-counter-styles-059.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/simp-chinese-formal/css3-counter-styles-078-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/simp-chinese-formal/css3-counter-styles-078.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/simp-chinese-informal/counter-simp-chinese-informal-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/simp-chinese-informal/css3-counter-styles-073-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/simp-chinese-informal/css3-counter-styles-073.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/trad-chinese-formal/css3-counter-styles-088-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/trad-chinese-formal/css3-counter-styles-088.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/trad-chinese-informal/counter-trad-chinese-informal-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/trad-chinese-informal/css3-counter-styles-083-expected.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-counter-styles/trad-chinese-informal/css3-counter-styles-083.html:
* Source/WebCore/css/CSSCounterStyle.cpp:
(WebCore::counterForSystemCJK):
(WebCore::CSSCounterStyle::counterForSystemSimplifiedChineseInformal):
(WebCore::CSSCounterStyle::counterForSystemSimplifiedChineseFormal):
(WebCore::CSSCounterStyle::counterForSystemTraditionalChineseInformal):
(WebCore::CSSCounterStyle::counterForSystemTraditionalChineseFormal):
(WebCore::CSSCounterStyle::counterForSystemJapaneseInformal):
(WebCore::CSSCounterStyle::counterForSystemJapaneseFormal):
(WebCore::CSSCounterStyle::counterForSystemKoreanHangulFormal):
(WebCore::CSSCounterStyle::counterForSystemKoreanHanjaInformal):
(WebCore::CSSCounterStyle::counterForSystemKoreanHanjaFormal):
(WebCore::CSSCounterStyle::initialRepresentation const):
(WebCore::CSSCounterStyle::isInRange const):
* Source/WebCore/css/CSSCounterStyle.h:
* Source/WebCore/css/CSSCounterStyleDescriptors.cpp:
(WebCore::CSSCounterStyleDescriptors::areSymbolsValidForSystem):
(WebCore::CSSCounterStyleDescriptors::systemCSSText const):
* Source/WebCore/css/CSSCounterStyleDescriptors.h:
* Source/WebCore/css/CSSCounterStyleRule.cpp:
(WebCore::toCounterStyleSystemEnum):
* Source/WebCore/css/CSSValueKeywords.in:
* Source/WebCore/css/counterStyles.css:
(@counter-style simp-chinese-informal):
(@counter-style simp-chinese-formal):
(@counter-style trad-chinese-informal):
(@counter-style trad-chinese-formal):
(@counter-style japanese-informal):
(@counter-style japanese-formal):
(@counter-style korean-hangul-formal):
(@counter-style korean-hanja-informal):
(@counter-style korean-hanja-formal):
* Source/WebCore/css/parser/CSSPropertyParserConsumer+CounterStyles.cpp:
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleSystem):
@igower igower force-pushed the increase-range-CJK-counter-styles branch from 55630f8 to 3f54df7 Compare June 17, 2025 18:02
@igower
Copy link
Contributor Author

igower commented Jun 17, 2025

Tests have been included for 123456789 (all digits non-zero), 1200453001 ( leading zero in group, sandwiched zeros in group), 700000123 (skipped group, leading zeros and ones), 1000001234 (skipped group, leading one). All Chinese, Japanese, and Korean styles have been updated. WPT tests have been changed to fit the altered ranges.

@igower igower requested a review from fantasai June 17, 2025 21:55
@igower igower requested a review from nt1m June 26, 2025 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Cascading Style Sheets implementation merging-blocked Applied to prevent a change from being merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants