[scroll-animations] Add parser support for the scroll() function
Wiring up the actual functionality behind scroll() will come later.
For now it behaves like 'none'.
Bug: 1317765
Change-Id: Icb9b6e0b2723c6887344b1f00faa022449a421d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3853979
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Reviewed-by: Robert Flack <flackr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1039809}
diff --git a/scroll-animations/css/animation-shorthand.html b/scroll-animations/css/animation-shorthand.html
index 7b30ec6..efb7d2c 100644
--- a/scroll-animations/css/animation-shorthand.html
+++ b/scroll-animations/css/animation-shorthand.html
@@ -19,11 +19,21 @@
test_valid_value('animation',
'1s linear 1s 2 reverse forwards paused anim auto',
'1s linear 1s 2 reverse forwards paused anim');
+test_valid_value('animation',
+ '1s linear 1s 2 reverse forwards paused anim scroll()');
test_invalid_value('animation',
'1s linear 1s 2 reverse forwards paused anim initial');
test_invalid_value('animation',
'1s linear 1s 2 reverse forwards paused anim 2000');
+test_invalid_value('animation',
+ '1s linear 1s 2 reverse forwards paused anim scroll(abc block)');
+test_invalid_value('animation',
+ '1s linear 1s 2 reverse forwards paused anim scroll(inline abc)');
+test_invalid_value('animation',
+ '1s linear 1s 2 reverse forwards paused anim scroll(abc)');
+test_invalid_value('animation',
+ '1s linear 1s 2 reverse forwards paused anim scroll("string")');
test_computed_value('animation',
'1s linear 1s 2 reverse forwards paused anim');
diff --git a/scroll-animations/css/animation-timeline-computed.html b/scroll-animations/css/animation-timeline-computed.html
index 55f6d88..68ba1f2 100644
--- a/scroll-animations/css/animation-timeline-computed.html
+++ b/scroll-animations/css/animation-timeline-computed.html
@@ -43,12 +43,11 @@
assert_not_equals(style.cssText.indexOf('animation-timeline'), -1);
}, 'The animation-timeline property shows up in CSSStyleDeclaration.cssText');
-// The tentative scroll() notation:
+// https://drafts.csswg.org/scroll-animations-1/#scroll-notation
+//
// animation-timeline: scroll(<axis>? <scroller>?);
// <axis> = block | inline | vertical | horizontal
-// <scroller> = root | nearest | <container-name>
-//
-// https://github.com/w3c/csswg-drafts/issues/6674
+// <scroller> = root | nearest
test_computed_value('animation-timeline', 'scroll()');
test_computed_value('animation-timeline', 'scroll(block)', 'scroll()');
test_computed_value('animation-timeline', 'scroll(inline)');
@@ -58,5 +57,4 @@
test_computed_value('animation-timeline', 'scroll(nearest)', 'scroll()');
test_computed_value('animation-timeline', 'scroll(inline nearest)', 'scroll(inline)');
test_computed_value('animation-timeline', 'scroll(vertical root)');
-// TODO: add <container-name> cases
</script>
diff --git a/scroll-animations/css/animation-timeline-parsing.html b/scroll-animations/css/animation-timeline-parsing.html
index a3d4dba..5691026 100644
--- a/scroll-animations/css/animation-timeline-parsing.html
+++ b/scroll-animations/css/animation-timeline-parsing.html
@@ -35,12 +35,11 @@
test_invalid_value('animation-timeline', 'rgb(1, 2, 3)');
test_invalid_value('animation-timeline', '#fefefe');
-// The tentative scroll() notation:
+// https://drafts.csswg.org/scroll-animations-1/#scroll-notation
+//
// animation-timeline: scroll(<axis>? <scroller>?);
// <axis> = block | inline | vertical | horizontal
-// <scroller> = root | nearest | <container-name>
-//
-// https://github.com/w3c/csswg-drafts/issues/6674
+// <scroller> = root | nearest
test_valid_value('animation-timeline', 'scroll()');
test_valid_value('animation-timeline', 'scroll(block)', 'scroll()');
test_valid_value('animation-timeline', 'scroll(inline)');
@@ -50,8 +49,10 @@
test_valid_value('animation-timeline', 'scroll(nearest)', 'scroll()');
test_valid_value('animation-timeline', 'scroll(inline nearest)', 'scroll(inline)');
test_valid_value('animation-timeline', 'scroll(vertical root)');
-// TODO: add <container-name> cases
test_invalid_value('animation-timeline', 'scroll(root block)');
test_invalid_value('animation-timeline', 'scroll(abc root)');
+test_invalid_value('animation-timeline', 'scroll(abc)');
+test_invalid_value('animation-timeline', 'scroll(vertical abc)');
+test_invalid_value('animation-timeline', 'scroll("string")');
</script>