Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Unified Diff: third_party/WebKit/LayoutTests/web-animations-api/delay-endDelay-phases.html

Issue 1933113002: Web Animations: Clip animation active intervals if endDelay is negative (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/web-animations-api/delay-endDelay-phases.html
diff --git a/third_party/WebKit/LayoutTests/web-animations-api/delay-endDelay-phases.html b/third_party/WebKit/LayoutTests/web-animations-api/delay-endDelay-phases.html
new file mode 100644
index 0000000000000000000000000000000000000000..a8288cbaa7e2b5056b9263abe3512634c53be697
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/web-animations-api/delay-endDelay-phases.html
@@ -0,0 +1,107 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<div id="container"></div>
+<script>
+function testTiming({timing, expectations}, description) {
+ test(() => {
+ for (let {at, expect} of expectations) {
+ let target = document.createElement('div');
+ container.appendChild(target);
+ let animation = target.animate({opacity: [0, 1]}, timing);
+ animation.currentTime = at;
+ assert_equals(Number(getComputedStyle(target).opacity), expect, 'at ' + at);
+ animation.cancel();
+ }
+ }, description);
+}
+
+testTiming({
+ timing: {
+ duration: 10,
+ delay: 1,
+ endDelay: 1,
+ fill: 'both',
+ },
+ expectations: [
+ { at: 0, expect: 0 },
+ { at: 1, expect: 0 },
+ { at: 2, expect: 0.1 },
+ { at: 10, expect: 0.9 },
+ { at: 11, expect: 1 },
+ { at: 12, expect: 1 },
+ ],
+}, 'delay and endDelay both positive');
+
+testTiming({
+ timing: {
+ duration: 10,
+ delay: 1,
+ endDelay: -1,
+ fill: 'both',
+ },
+ expectations: [
+ { at: 0, expect: 0 },
+ { at: 1, expect: 0 },
+ { at: 2, expect: 0.1 },
+ { at: 9, expect: 0.8 },
+ { at: 10, expect: 1 },
+ { at: 11, expect: 1 },
+ ],
+}, 'Positive delay and negative endDelay');
+
+testTiming({
+ timing: {
+ duration: 10,
+ delay: -1,
+ endDelay: 1,
+ fill: 'both',
+ },
+ expectations: [
+ { at: -2, expect: 0 },
+ { at: -1, expect: 0 },
+ { at: 0, expect: 0.1 },
+ { at: 1, expect: 0.2 },
+ { at: 8, expect: 0.9 },
+ { at: 9, expect: 1 },
+ { at: 10, expect: 1 },
+ ],
+}, 'Negative delay and positive endDelay');
+
+testTiming({
+ timing: {
+ duration: 10,
+ delay: -1,
+ endDelay: -1,
+ fill: 'both',
+ },
+ expectations: [
+ { at: -2, expect: 0 },
+ { at: -1, expect: 0 },
+ { at: 0, expect: 0.1 },
+ { at: 1, expect: 0.2 },
+ { at: 7, expect: 0.8 },
+ { at: 8, expect: 1 },
+ { at: 9, expect: 1 },
+ { at: 10, expect: 1 },
+ ],
+}, 'delay and endDelay both negative');
+
+testTiming({
+ timing: {
+ duration: 10,
+ delay: 1,
+ endDelay: -12,
+ fill: 'both',
+ },
+ expectations: [
+ { at: -2, expect: 0 },
+ { at: -1, expect: 1 },
+ { at: 0, expect: 1 },
+ { at: 5, expect: 1 },
+ { at: 10, expect: 1 },
+ { at: 11, expect: 1 },
+ { at: 12, expect: 1 },
+ ],
+}, 'Negative endDelay that eclipses delay and duration');
+</script>

Powered by Google App Engine
This is Rietveld 408576698