@@ -79,6 +79,7 @@ public function __construct( MatcherFactory $matcherFactory ) {
7979 $ this ->addKnownProperties ( $ this ->cssSizing4 ( $ matcherFactory ) );
8080 $ this ->addKnownProperties ( $ this ->cssLogical1 ( $ matcherFactory ) );
8181 $ this ->addKnownProperties ( $ this ->cssRuby1 ( $ matcherFactory ) );
82+ $ this ->addKnownProperties ( $ this ->cssLists3 ( $ matcherFactory ) );
8283 }
8384
8485 /**
@@ -138,25 +139,21 @@ protected function css2( MatcherFactory $matcherFactory ) {
138139 ] );
139140
140141 // https://www.w3.org/TR/2011/REC-CSS2-20110607/generate.html
141- $ props ['list-style-type ' ] = new KeywordMatcher ( [
142- 'disc ' , 'circle ' , 'square ' , 'decimal ' , 'decimal-leading-zero ' , 'lower-roman ' , 'upper-roman ' ,
143- 'lower-greek ' , 'lower-latin ' , 'upper-latin ' , 'armenian ' , 'georgian ' , 'lower-alpha ' ,
144- 'upper-alpha ' , 'none '
145- ] );
146142 $ props ['content ' ] = new Alternative ( [
147143 new KeywordMatcher ( [ 'normal ' , 'none ' ] ),
148144 Quantifier::plus ( new Alternative ( [
149145 $ matcherFactory ->string (),
150146 // Replaces <url> per https://www.w3.org/TR/css-images-3/#placement
151147 $ matcherFactory ->image (),
148+ // Updated by https://www.w3.org/TR/2020/WD-css-lists-3-20201117/#counter-functions
152149 new FunctionMatcher ( 'counter ' , new Juxtaposition ( [
153150 $ matcherFactory ->ident (),
154- Quantifier::optional ( $ props [ ' list-style-type ' ] ),
151+ Quantifier::optional ( $ matcherFactory -> counterStyle () ),
155152 ], true ) ),
156153 new FunctionMatcher ( 'counters ' , new Juxtaposition ( [
157154 $ matcherFactory ->ident (),
158155 $ matcherFactory ->string (),
159- Quantifier::optional ( $ props [ ' list-style-type ' ] ),
156+ Quantifier::optional ( $ matcherFactory -> counterStyle () ),
160157 ], true ) ),
161158 new FunctionMatcher ( 'attr ' , $ matcherFactory ->ident () ),
162159 new KeywordMatcher ( [ 'open-quote ' , 'close-quote ' , 'no-open-quote ' , 'no-close-quote ' ] ),
@@ -167,22 +164,6 @@ protected function css2( MatcherFactory $matcherFactory ) {
167164 $ matcherFactory ->string (), $ matcherFactory ->string ()
168165 ] ) ),
169166 ] );
170- $ props ['counter-reset ' ] = new Alternative ( [
171- $ none ,
172- Quantifier::plus ( new Juxtaposition ( [
173- $ matcherFactory ->ident (), Quantifier::optional ( $ matcherFactory ->integer () )
174- ] ) ),
175- ] );
176- $ props ['counter-increment ' ] = $ props ['counter-reset ' ];
177- $ props ['list-style-image ' ] = new Alternative ( [
178- $ none ,
179- // Replaces <url> per https://www.w3.org/TR/css-images-3/#placement
180- $ matcherFactory ->image ()
181- ] );
182- $ props ['list-style-position ' ] = new KeywordMatcher ( [ 'inside ' , 'outside ' ] );
183- $ props ['list-style ' ] = UnorderedGroup::someOf ( [
184- $ props ['list-style-type ' ], $ props ['list-style-position ' ], $ props ['list-style-image ' ]
185- ] );
186167
187168 // https://www.w3.org/TR/2011/REC-CSS2-20110607/tables.html
188169 $ props ['caption-side ' ] = new KeywordMatcher ( [ 'top ' , 'bottom ' ] );
@@ -2118,4 +2099,52 @@ protected function cssRuby1( $matcherFactory ) {
21182099 'ruby-overhang ' => new KeywordMatcher ( [ 'auto ' , 'none ' ] ),
21192100 ];
21202101 }
2102+
2103+ /**
2104+ * CSS Lists and Counters Module Level 3
2105+ * @see https://www.w3.org/TR/2020/WD-css-lists-3-20201117/
2106+ *
2107+ * @param MatcherFactory $matcherFactory
2108+ * @return Matcher[]
2109+ */
2110+ protected function cssLists3 ( MatcherFactory $ matcherFactory ) {
2111+ // @codeCoverageIgnoreStart
2112+ if ( isset ( $ this ->cache [__METHOD__ ] ) ) {
2113+ return $ this ->cache [__METHOD__ ];
2114+ }
2115+ // @codeCoverageIgnoreEnd
2116+ $ none = new KeywordMatcher ( 'none ' );
2117+ $ props = [];
2118+
2119+ $ props ['counter-increment ' ] = $ props ['counter-reset ' ] = $ props ['counter-set ' ] =
2120+ new Alternative ( [
2121+ Quantifier::plus ( new Juxtaposition ( [
2122+ $ matcherFactory ->customIdent ( [ 'none ' ] ),
2123+ Quantifier::optional ( $ matcherFactory ->integer () )
2124+ ] ) ),
2125+ $ none
2126+ ] );
2127+
2128+ $ props ['list-style-image ' ] = new Alternative ( [
2129+ $ matcherFactory ->image (),
2130+ $ none
2131+ ] );
2132+
2133+ $ props ['list-style-position ' ] = new KeywordMatcher ( [ 'inside ' , 'outside ' ] );
2134+
2135+ $ props ['list-style-type ' ] = new Alternative ( [
2136+ $ matcherFactory ->counterStyle (),
2137+ $ matcherFactory ->string (),
2138+ $ none
2139+ ] );
2140+
2141+ $ props ['list-style ' ] = UnorderedGroup::someOf ( [
2142+ $ props ['list-style-position ' ], $ props ['list-style-image ' ], $ props ['list-style-type ' ]
2143+ ] );
2144+
2145+ $ props ['marker-side ' ] = new KeywordMatcher ( [ 'match-self ' , 'match-parent ' ] );
2146+
2147+ $ this ->cache [__METHOD__ ] = $ props ;
2148+ return $ props ;
2149+ }
21212150}
0 commit comments