[webkit-changes] [WebKit/WebKit] 231e26: [css-counter-styles] Implement complex predefined ...

Tim Nguyen noreply at github.com
Sun Apr 30 15:46:58 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 231e2671c75e017d86898fcdb1f3e9c1c88de9ac
      https://github.com/WebKit/WebKit/commit/231e2671c75e017d86898fcdb1f3e9c1c88de9ac
  Author: Tim Nguyen <ntim at apple.com>
  Date:   2023-04-30 (Sun, 30 Apr 2023)

  Changed paths:
    M LayoutTests/TestExpectations
    M Source/WebCore/css/CSSCounterStyle.cpp
    M Source/WebCore/css/CSSCounterStyle.h
    M Source/WebCore/css/CSSCounterStyleDescriptors.cpp
    M Source/WebCore/css/CSSCounterStyleDescriptors.h
    M Source/WebCore/css/CSSCounterStyleRegistry.cpp
    M Source/WebCore/css/CSSCounterStyleRule.cpp
    M Source/WebCore/css/CSSProperties.json
    M Source/WebCore/css/CSSValueKeywords.in
    M Source/WebCore/css/counterStyles.css
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.h
    M Source/WebCore/rendering/RenderListMarker.cpp

  Log Message:
  -----------
  [css-counter-styles] Implement complex predefined counter styles
https://bugs.webkit.org/show_bug.cgi?id=256154
rdar://103021467

Reviewed by Darin Adler.

Implement the following as complex counter style systems:

simp-chinese-informal
simp-chinese-formal
trad-chinese-informal
trad-chinese-formal
ethiopic-numeric

As a result, authors can now create counter styles that extend the above.

Specification: https://drafts.csswg.org/css-counter-styles/#complex-predefined-counters

To implement this, we create UA sheet only values for the system descriptors.
The algorithms are just moved over from RenderListMarker, and re-used in both places as static methods on CSSCounterStyle.

* LayoutTests/TestExpectations:
* Source/WebCore/css/CSSCounterStyle.cpp: Move over code from RenderListMarker
(WebCore::counterForSystemCJK):
(WebCore::CSSCounterStyle::counterForSystemSimplifiedChineseInformal):
(WebCore::CSSCounterStyle::counterForSystemSimplifiedChineseFormal):
(WebCore::CSSCounterStyle::counterForSystemTraditionalChineseInformal):
(WebCore::CSSCounterStyle::counterForSystemTraditionalChineseFormal):
(WebCore::CSSCounterStyle::counterForSystemEthiopicNumeric):
(WebCore::CSSCounterStyle::initialRepresentation const):
(WebCore::CSSCounterStyle::isInRange const):
* Source/WebCore/css/CSSCounterStyle.h:
* Source/WebCore/css/CSSCounterStyleDescriptors.cpp: Pipe the CSS value for system descriptor
(WebCore::CSSCounterStyleDescriptors::areSymbolsValidForSystem):
(WebCore::CSSCounterStyleDescriptors::systemCSSText const):
* Source/WebCore/css/CSSCounterStyleDescriptors.h:
* Source/WebCore/css/CSSCounterStyleRegistry.cpp: Enable the new codepath for complex system
(WebCore::isCounterStyleUnsupportedByUserAgent):
* Source/WebCore/css/CSSCounterStyleRule.cpp: Pipe the CSS value for system descriptor
(WebCore::toCounterStyleSystemEnum):
* Source/WebCore/css/CSSProperties.json: Pass in the context, so the parser knows whether it's in UA sheet mode
* Source/WebCore/css/CSSValueKeywords.in: Add internal CSS values
* Source/WebCore/css/counterStyles.css: Define the new complex counter styles
(@counter-style simp-chinese-informal):
(@counter-style simp-chinese-formal):
(@counter-style trad-chinese-informal):
(@counter-style trad-chinese-formal):
(@counter-style cjk-ideographic):
(@counter-style ethiopic-numeric):
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp: Parse the new internal CSS values
(WebCore::CSSPropertyParserHelpers::consumeCounterStyleSystem): Remove outdated FIXME that is handled by CSSCounterStyleDescriptors::areSymbolsValidForSystem
* Source/WebCore/css/parser/CSSPropertyParserHelpers.h:
* Source/WebCore/rendering/RenderListMarker.cpp: Delete code that was moved to CSSCounterStyle, and re-use the methods there
(WebCore::listMarkerText):
(WebCore::toCJKIdeographic): Deleted.
(WebCore::toEthiopicNumeric): Deleted.

Canonical link: https://commits.webkit.org/263544@main




More information about the webkit-changes mailing list