From 7d41136b06aa706c86574426218072d516fb40e5 Mon Sep 17 00:00:00 2001 From: Jordan Taylor Date: Wed, 11 Nov 2020 12:58:49 -0800 Subject: [PATCH] Initial implementation of progress based ScrollTimelines This work is the first step in implementing upcoming spec change in: https://github.com/w3c/csswg-drafts/issues/4862 Converted AnimationTimeline::currentTime() to CSSNumberish Added AnimationTimeline::duration Bug: 1140602 Change-Id: I5c9b8b7130b91faae5f172493ba5f55d77b4bdd6 --- .../progress-based-current-time.tenative.html | 501 ++++++++++++++++++ scroll-animations/testcommon.js | 8 + 2 files changed, 509 insertions(+) create mode 100644 scroll-animations/progress-based-current-time.tenative.html diff --git a/scroll-animations/progress-based-current-time.tenative.html b/scroll-animations/progress-based-current-time.tenative.html new file mode 100644 index 000000000000000..8a8ccfcff8b2bae --- /dev/null +++ b/scroll-animations/progress-based-current-time.tenative.html @@ -0,0 +1,501 @@ + + +ScrollTimeline current time algorithm + + + + + + + + + + diff --git a/scroll-animations/testcommon.js b/scroll-animations/testcommon.js index d9fc153887c5fcb..9b3e82228fcdb3a 100644 --- a/scroll-animations/testcommon.js +++ b/scroll-animations/testcommon.js @@ -55,3 +55,11 @@ function assert_approx_equals_or_null(actual, expected, tolerance, name){ assert_approx_equals(actual, expected, tolerance, name); } } + +// actual should be a CSSUnitValue and expected should be a double value 0-100 +function assert_percent_css_unit_value_approx_equals(actual, expected, tolerance, name){ + assert_true(actual instanceof CSSUnitValue, "'actual' must be of type CSSUnitValue"); + assert_equals(typeof expected, "number", "'expected' should be a number (0-100)"); + assert_equals(actual.unit, "percent", "'actual' unit type must be 'percent'"); + assert_approx_equals(actual.value, expected, tolerance, name); +} \ No newline at end of file