Skip to content

Commit 8d866a0

Browse files
jenkins-botGerrit Code Review
authored andcommitted
Merge "Update the Display module to 2023-03-30"
2 parents f2cbae8 + 47f9f40 commit 8d866a0

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- properties: aspect-ratio, contain-intrinsic-* (size, width, height, block-size, inline-size), min-intrinsic-size;
77
* Update Color to Level 4 (2025-04-24)
88
* Update Values and Units to Level 4 (WD 2024-03-12)
9+
* Update Display Level 3 to CR 2023-03-30
910

1011
## css-sanitizer 5.5.0 (2025-01-27)
1112
* Ensure <-token and identifiers are always separated as a security

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The sanitizer recognizes the following CSS modules:
6969
* [Color Level 4, 2025-04-24](https://www.w3.org/TR/2025/CRD-css-color-4-20250424)
7070
* [Compositing Level 1, 2015-01-13](https://www.w3.org/TR/2015/CR-compositing-1-20150113/)
7171
* [CSS Level 2, 2011-06-07](https://www.w3.org/TR/2011/REC-CSS2-20110607/)
72-
* [Display Level 3, 2019-07-11](https://www.w3.org/TR/2019/CR-css-display-3-20190711)
72+
* [Display Level 3, 2023-03-30](https://www.w3.org/TR/2023/CR-css-display-3-20230330/)
7373
* [Filter Effects Level 1, 2018-12-18](https://www.w3.org/TR/2018/WD-filter-effects-1-20181218)
7474
* [Flexbox Level 1, 2018-11-19](https://www.w3.org/TR/2018/CR-css-flexbox-1-20181119)
7575
* [Fonts Level 3, 2018-09-20](https://www.w3.org/TR/2018/REC-css-fonts-3-20180920)

src/Sanitizer/StylePropertySanitizer.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ protected function css2( MatcherFactory $matcherFactory ) {
135135
$props['clip'] = new Alternative( [
136136
$auto, new FunctionMatcher( 'rect', Quantifier::hash( $autoLength, 4, 4 ) ),
137137
] );
138-
$props['visibility'] = new KeywordMatcher( [ 'visible', 'hidden', 'collapse' ] );
139138

140139
// https://www.w3.org/TR/2011/REC-CSS2-20110607/generate.html
141140
$props['list-style-type'] = new KeywordMatcher( [
@@ -197,7 +196,7 @@ protected function css2( MatcherFactory $matcherFactory ) {
197196

198197
/**
199198
* Properties for CSS Display Module Level 3
200-
* @see https://www.w3.org/TR/2019/CR-css-display-3-20190711/
199+
* @see https://www.w3.org/TR/2023/CR-css-display-3-20230330/
201200
* @param MatcherFactory $matcherFactory Factory for Matchers
202201
* @return Matcher[] Array mapping declaration names (lowercase) to Matchers for the values
203202
*/
@@ -236,6 +235,10 @@ protected function cssDisplay3( MatcherFactory $matcherFactory ) {
236235
] ),
237236
] );
238237

238+
$props['visibility'] = new KeywordMatcher( [ 'visible', 'hidden', 'collapse' ] );
239+
240+
$props['order'] = $matcherFactory->integer();
241+
239242
$this->cache[__METHOD__] = $props;
240243
return $props;
241244
}
@@ -945,7 +948,6 @@ protected function cssFlexbox3( MatcherFactory $matcherFactory ) {
945948
] );
946949
$props['flex-wrap'] = new KeywordMatcher( [ 'nowrap', 'wrap', 'wrap-reverse' ] );
947950
$props['flex-flow'] = UnorderedGroup::someOf( [ $props['flex-direction'], $props['flex-wrap'] ] );
948-
$props['order'] = $matcherFactory->integer();
949951
$props['flex-grow'] = $matcherFactory->number();
950952
$props['flex-shrink'] = $matcherFactory->number();
951953
$props['flex-basis'] = new Alternative( [
@@ -968,6 +970,11 @@ protected function cssFlexbox3( MatcherFactory $matcherFactory ) {
968970
$props['align-self'] = $align['align-self'];
969971
$props['align-content'] = $align['align-content'];
970972

973+
// 'order' was copied into display-3 in CR 2023-03-30
974+
// Removed from flexbox in the ED as of 2025-03-10, it can be removed
975+
// here once we update our flexbox version.
976+
$props['order'] = $this->cssDisplay3( $matcherFactory )['order'];
977+
971978
$this->cache[__METHOD__] = $props;
972979
return $props;
973980
}
@@ -1490,10 +1497,6 @@ protected function cssGrid1( MatcherFactory $matcherFactory ) {
14901497
$props['justify-content'] = $align['justify-content'];
14911498
$props['align-content'] = $align['align-content'];
14921499

1493-
// Grid uses Flexbox's order property too. Copying is ok as long as
1494-
// it's the identical object.
1495-
$props['order'] = $this->cssFlexbox3( $matcherFactory )['order'];
1496-
14971500
$this->cache[__METHOD__] = $props;
14981501
return $props;
14991502
}

tests/Sanitizer/StylePropertySanitizerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ public static function provideDeclarations() {
9393
[ 'line-height: 3' ],
9494
[ 'vertical-align: middle' ],
9595
[ 'clip: rect(1px, auto, 1em, auto)' ],
96-
[ 'visibility: hidden' ],
9796
[ 'list-style-type: circle' ],
9897
[ 'content: "foo" url("image.jpg") counter(foobar) counter(foobaz, disc) attr(data-foo-baz)' ],
9998
[ 'content: "nope" url("bad.jpg")', 'bad-value-for-property' ],
@@ -117,6 +116,8 @@ public static function provideDeclarations() {
117116
[ 'display: grid' ],
118117
[ 'display: inline table' ],
119118
[ 'display: list-item' ],
119+
[ 'visibility: hidden' ],
120+
[ 'order: 6' ],
120121

121122
// cssPosition3
122123
[ 'position: absolute' ],

0 commit comments

Comments
 (0)