@@ -80,6 +80,7 @@ public function __construct( MatcherFactory $matcherFactory ) {
8080 $ this ->addKnownProperties ( $ this ->cssLogical1 ( $ matcherFactory ) );
8181 $ this ->addKnownProperties ( $ this ->cssRuby1 ( $ matcherFactory ) );
8282 $ this ->addKnownProperties ( $ this ->cssLists3 ( $ matcherFactory ) );
83+ $ this ->addKnownProperties ( $ this ->cssScrollSnap1 ( $ matcherFactory ) );
8384 }
8485
8586 /**
@@ -2196,4 +2197,73 @@ protected function cssLists3( MatcherFactory $matcherFactory ) {
21962197 $ this ->cache [__METHOD__ ] = $ props ;
21972198 return $ props ;
21982199 }
2200+
2201+ /**
2202+ * Properties for CSS Scroll Snap Module Level 1
2203+ * @see https://www.w3.org/TR/2021/CR-css-scroll-snap-1-20210311/
2204+ * @param MatcherFactory $matcherFactory
2205+ * @return Matcher[] Array mapping declaration names (lowercase) to Matchers for the values
2206+ */
2207+ protected function cssScrollSnap1 ( MatcherFactory $ matcherFactory ) {
2208+ // @codeCoverageIgnoreStart
2209+ if ( isset ( $ this ->cache [__METHOD__ ] ) ) {
2210+ return $ this ->cache [__METHOD__ ];
2211+ }
2212+ // @codeCoverageIgnoreEnd
2213+
2214+ $ props = [];
2215+ $ none = new KeywordMatcher ( 'none ' );
2216+ $ auto = new KeywordMatcher ( 'auto ' );
2217+ $ length = $ matcherFactory ->length ();
2218+ $ lp = $ matcherFactory ->lengthPercentage ();
2219+
2220+ // https://www.w3.org/TR/2021/CR-css-scroll-snap-1-20210311/#scroll-snap-type
2221+ $ props ['scroll-snap-type ' ] = new Alternative ( [
2222+ $ none ,
2223+ new Juxtaposition ( [
2224+ new KeywordMatcher ( [ 'x ' , 'y ' , 'block ' , 'inline ' , 'both ' ] ),
2225+ Quantifier::optional ( new KeywordMatcher ( [ 'mandatory ' , 'proximity ' ] ) ),
2226+ ] ),
2227+ ] );
2228+
2229+ // https://www.w3.org/TR/2021/CR-css-scroll-snap-1-20210311/#scroll-padding
2230+ $ props ['scroll-padding ' ] = Quantifier::count ( new Alternative ( [ $ auto , $ lp ] ), 1 , 4 );
2231+
2232+ $ props ['scroll-padding-top ' ] = new Alternative ( [ $ auto , $ lp ] );
2233+ $ props ['scroll-padding-right ' ] = new Alternative ( [ $ auto , $ lp ] );
2234+ $ props ['scroll-padding-bottom ' ] = new Alternative ( [ $ auto , $ lp ] );
2235+ $ props ['scroll-padding-left ' ] = new Alternative ( [ $ auto , $ lp ] );
2236+
2237+ $ props ['scroll-padding-inline ' ] = Quantifier::count ( new Alternative ( [ $ auto , $ lp ] ), 1 , 2 );
2238+ $ props ['scroll-padding-inline-start ' ] = new Alternative ( [ $ auto , $ lp ] );
2239+ $ props ['scroll-padding-inline-end ' ] = new Alternative ( [ $ auto , $ lp ] );
2240+ $ props ['scroll-padding-block ' ] = Quantifier::count ( new Alternative ( [ $ auto , $ lp ] ), 1 , 2 );
2241+ $ props ['scroll-padding-block-start ' ] = new Alternative ( [ $ auto , $ lp ] );
2242+ $ props ['scroll-padding-block-end ' ] = new Alternative ( [ $ auto , $ lp ] );
2243+
2244+ // https://www.w3.org/TR/2021/CR-css-scroll-snap-1-20210311/#scroll-margin
2245+ $ props ['scroll-margin ' ] = Quantifier::count ( $ length , 1 , 4 );
2246+
2247+ $ props ['scroll-margin-top ' ] = $ length ;
2248+ $ props ['scroll-margin-right ' ] = $ length ;
2249+ $ props ['scroll-margin-bottom ' ] = $ length ;
2250+ $ props ['scroll-margin-left ' ] = $ length ;
2251+
2252+ $ props ['scroll-margin-inline ' ] = Quantifier::count ( $ length , 1 , 2 );
2253+ $ props ['scroll-margin-inline-start ' ] = $ length ;
2254+ $ props ['scroll-margin-inline-end ' ] = $ length ;
2255+ $ props ['scroll-margin-block ' ] = Quantifier::count ( $ length , 1 , 2 );
2256+ $ props ['scroll-margin-block-start ' ] = $ length ;
2257+ $ props ['scroll-margin-block-end ' ] = $ length ;
2258+
2259+ // https://www.w3.org/TR/2021/CR-css-scroll-snap-1-20210311/#scroll-snap-align
2260+ $ props ['scroll-snap-align ' ] = Quantifier::count ( new KeywordMatcher ( [ 'none ' , 'start ' , 'end ' , 'center ' ] ),
2261+ 1 , 2 );
2262+
2263+ // https://www.w3.org/TR/2021/CR-css-scroll-snap-1-20210311/#scroll-snap-stop
2264+ $ props ['scroll-snap-stop ' ] = new KeywordMatcher ( [ 'normal ' , 'always ' ] );
2265+
2266+ $ this ->cache [__METHOD__ ] = $ props ;
2267+ return $ props ;
2268+ }
21992269}
0 commit comments