Skip to content

Commit e95f326

Browse files
Calme1709AtkinsSJ
authored andcommitted
LibWeb: Parse the scroll-timeline-name CSS property
1 parent 826e947 commit e95f326

File tree

9 files changed

+133
-0
lines changed

9 files changed

+133
-0
lines changed

Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,8 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue const>> Parser::parse_css_value(Pr
745745
return parse_all_as(tokens, [this](auto& tokens) { return parse_translate_value(tokens); });
746746
case PropertyID::Scale:
747747
return parse_all_as(tokens, [this](auto& tokens) { return parse_scale_value(tokens); });
748+
case PropertyID::ScrollTimelineName:
749+
return parse_all_as(tokens, [this, property_id](auto& tokens) { return parse_simple_comma_separated_value_list(property_id, tokens); });
748750
case PropertyID::WhiteSpace:
749751
return parse_all_as(tokens, [this](auto& tokens) { return parse_white_space_shorthand(tokens); });
750752
case PropertyID::WhiteSpaceTrim:

Libraries/LibWeb/CSS/Properties.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3440,6 +3440,19 @@
34403440
"affects-layout": false,
34413441
"affects-stacking-context": true
34423442
},
3443+
"scroll-timeline-name": {
3444+
"affects-layout": false,
3445+
"animation-type": "none",
3446+
"inherited": false,
3447+
"initial": "none",
3448+
"valid-identifiers": [
3449+
"none"
3450+
],
3451+
"valid-types": [
3452+
"dashed-ident"
3453+
],
3454+
"multiplicity": "coordinating-list"
3455+
},
34433456
"scrollbar-color": {
34443457
"affects-layout": false,
34453458
"animation-type": "by-computed-value",

Tests/LibWeb/Text/expected/css/CSSStyleDeclaration-has-indexed-property-getter.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ All properties associated with getComputedStyle(document.body):
259259
"rx",
260260
"ry",
261261
"scale",
262+
"scroll-timeline-name",
262263
"scrollbar-color",
263264
"scrollbar-gutter",
264265
"scrollbar-width",

Tests/LibWeb/Text/expected/css/CSSStyleProperties-all-supported-properties-and-default-values.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,8 @@ All supported properties and their default values exposed from CSSStylePropertie
694694
'rx': 'auto'
695695
'ry': 'auto'
696696
'scale': 'none'
697+
'scrollTimelineName': 'none'
698+
'scroll-timeline-name': 'none'
697699
'scrollbarColor': 'auto'
698700
'scrollbar-color': 'auto'
699701
'scrollbarGutter': 'auto'

Tests/LibWeb/Text/expected/css/getComputedStyle-print-all.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ row-gap: normal
257257
rx: auto
258258
ry: auto
259259
scale: none
260+
scroll-timeline-name: none
260261
scrollbar-color: auto
261262
scrollbar-gutter: auto
262263
scrollbar-width: auto
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Harness status: OK
2+
3+
Found 13 tests
4+
5+
12 Pass
6+
1 Fail
7+
Pass Property scroll-timeline-name value 'initial'
8+
Pass Property scroll-timeline-name value 'inherit'
9+
Pass Property scroll-timeline-name value 'unset'
10+
Pass Property scroll-timeline-name value 'revert'
11+
Pass Property scroll-timeline-name value 'none'
12+
Pass Property scroll-timeline-name value '--foo'
13+
Pass Property scroll-timeline-name value '--foo, --bar'
14+
Pass Property scroll-timeline-name value '--bar, --foo'
15+
Pass Property scroll-timeline-name value '--a, --b, --c, --D, --e'
16+
Fail Property scroll-timeline-name value 'none, none'
17+
Pass Property scroll-timeline-name value '--a, --b, --c, none, --d, --e'
18+
Pass The scroll-timeline-name property shows up in CSSStyleDeclaration enumeration
19+
Pass The scroll-timeline-name property shows up in CSSStyleDeclaration.cssText
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Harness status: OK
2+
3+
Found 20 tests
4+
5+
19 Pass
6+
1 Fail
7+
Pass e.style['scroll-timeline-name'] = "initial" should set the property value
8+
Pass e.style['scroll-timeline-name'] = "inherit" should set the property value
9+
Pass e.style['scroll-timeline-name'] = "unset" should set the property value
10+
Pass e.style['scroll-timeline-name'] = "revert" should set the property value
11+
Pass e.style['scroll-timeline-name'] = "none" should set the property value
12+
Pass e.style['scroll-timeline-name'] = "--abc" should set the property value
13+
Pass e.style['scroll-timeline-name'] = " --abc" should set the property value
14+
Pass e.style['scroll-timeline-name'] = "--aBc" should set the property value
15+
Pass e.style['scroll-timeline-name'] = "--foo, --bar" should set the property value
16+
Pass e.style['scroll-timeline-name'] = "--bar, --foo" should set the property value
17+
Fail e.style['scroll-timeline-name'] = "none, none" should set the property value
18+
Pass e.style['scroll-timeline-name'] = "--a, none, --b" should set the property value
19+
Pass e.style['scroll-timeline-name'] = "auto" should not set the property value
20+
Pass e.style['scroll-timeline-name'] = "abc" should not set the property value
21+
Pass e.style['scroll-timeline-name'] = "default" should not set the property value
22+
Pass e.style['scroll-timeline-name'] = "10px" should not set the property value
23+
Pass e.style['scroll-timeline-name'] = "foo bar" should not set the property value
24+
Pass e.style['scroll-timeline-name'] = "\"foo\" \"bar\"" should not set the property value
25+
Pass e.style['scroll-timeline-name'] = "rgb(1, 2, 3)" should not set the property value
26+
Pass e.style['scroll-timeline-name'] = "#fefefe" should not set the property value
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<link rel="help" href="https://drafts.csswg.org/scroll-animations-1/#scroll-timeline-name">
3+
<script src="../../resources/testharness.js"></script>
4+
<script src="../../resources/testharnessreport.js"></script>
5+
<script src="../../css/support/computed-testcommon.js"></script>
6+
</head>
7+
<style>
8+
#outer { scroll-timeline-name: --foo; }
9+
#target { scroll-timeline-name: --bar; }
10+
</style>
11+
<div id="outer">
12+
<div id="target"></div>
13+
</div>
14+
<script>
15+
test_computed_value('scroll-timeline-name', 'initial', 'none');
16+
test_computed_value('scroll-timeline-name', 'inherit', '--foo');
17+
test_computed_value('scroll-timeline-name', 'unset', 'none');
18+
test_computed_value('scroll-timeline-name', 'revert', 'none');
19+
test_computed_value('scroll-timeline-name', 'none');
20+
test_computed_value('scroll-timeline-name', '--foo');
21+
test_computed_value('scroll-timeline-name', '--foo, --bar');
22+
test_computed_value('scroll-timeline-name', '--bar, --foo');
23+
test_computed_value('scroll-timeline-name', '--a, --b, --c, --D, --e');
24+
test_computed_value('scroll-timeline-name', 'none, none');
25+
test_computed_value('scroll-timeline-name', '--a, --b, --c, none, --d, --e');
26+
27+
test(() => {
28+
let style = getComputedStyle(document.getElementById('target'));
29+
assert_not_equals(Array.from(style).indexOf('scroll-timeline-name'), -1);
30+
}, 'The scroll-timeline-name property shows up in CSSStyleDeclaration enumeration');
31+
32+
test(() => {
33+
let style = document.getElementById('target').style;
34+
assert_not_equals(style.cssText.indexOf('scroll-timeline-name'), -1);
35+
}, 'The scroll-timeline-name property shows up in CSSStyleDeclaration.cssText');
36+
37+
</script>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<link rel="help" href="https://drafts.csswg.org/scroll-animations-1/#scroll-timeline-name">
3+
<script src="../../resources/testharness.js"></script>
4+
<script src="../../resources/testharnessreport.js"></script>
5+
<script src="../../css/support/parsing-testcommon.js"></script>
6+
<div id="target"></div>
7+
<script>
8+
9+
test_valid_value('scroll-timeline-name', 'initial');
10+
test_valid_value('scroll-timeline-name', 'inherit');
11+
test_valid_value('scroll-timeline-name', 'unset');
12+
test_valid_value('scroll-timeline-name', 'revert');
13+
14+
test_valid_value('scroll-timeline-name', 'none');
15+
test_valid_value('scroll-timeline-name', '--abc');
16+
test_valid_value('scroll-timeline-name', ' --abc', '--abc');
17+
test_valid_value('scroll-timeline-name', '--aBc');
18+
test_valid_value('scroll-timeline-name', '--foo, --bar');
19+
test_valid_value('scroll-timeline-name', '--bar, --foo');
20+
test_valid_value('scroll-timeline-name', 'none, none');
21+
test_valid_value('scroll-timeline-name', '--a, none, --b');
22+
23+
test_invalid_value('scroll-timeline-name', 'auto');
24+
test_invalid_value('scroll-timeline-name', 'abc');
25+
test_invalid_value('scroll-timeline-name', 'default');
26+
test_invalid_value('scroll-timeline-name', '10px');
27+
test_invalid_value('scroll-timeline-name', 'foo bar');
28+
test_invalid_value('scroll-timeline-name', '"foo" "bar"');
29+
test_invalid_value('scroll-timeline-name', 'rgb(1, 2, 3)');
30+
test_invalid_value('scroll-timeline-name', '#fefefe');
31+
32+
</script>

0 commit comments

Comments
 (0)