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

Unified Diff: LayoutTests/animations/timing-functions-update-animation.html

Issue 814083003: Update animation when changes in animation keyframes are detected. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase + Address comments Created 5 years, 11 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: LayoutTests/animations/timing-functions-update-animation.html
diff --git a/LayoutTests/animations/timing-functions-update-animation.html b/LayoutTests/animations/timing-functions-update-animation.html
new file mode 100644
index 0000000000000000000000000000000000000000..ca045caef3156b13698fa60c256bcec4a72bb224
--- /dev/null
+++ b/LayoutTests/animations/timing-functions-update-animation.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<style>
+ @keyframes anim {
+ from { left: 0px; }
+ 50% { left: 400px; animation-timing-function: ease-in; }
+ to { left: 500px; }
+ }
+
+ #target {
+ animation: anim 10s paused;
+ position: absolute;
+ }
+</style>
+<div id="target"></div>
+<script>
+ test(function() {
+ target.offsetTop;
+ assert_equals(parseInt(getComputedStyle(target).left), 0, 'left offset');
+ target.style.animationTimingFunction = 'ease-out'; // Should not change anything as we're on the first frame
+ assert_equals(parseInt(getComputedStyle(target).left), 0, 'left offset');
+
+ target.style.animationDelay = '-1s';
+ assert_equals(parseInt(getComputedStyle(target).left), 123, 'left offset');
+ target.style.animationTimingFunction = 'linear';
+ assert_equals(parseInt(getComputedStyle(target).left), 80, 'left offset');
+ target.style.animationTimingFunction = 'cubic-bezier(0, 0.5, 0.2, 1)';
+ assert_equals(parseInt(getComputedStyle(target).left), 275, 'left offset');
+ target.style.animationTimingFunction = 'ease-out';
+ assert_equals(parseInt(getComputedStyle(target).left), 123, 'left offset');
+
+ target.style.animationDelay = '-4s';
+ assert_equals(parseInt(getComputedStyle(target).left), 375, 'left offset');
+ target.style.animationTimingFunction = 'linear';
+ assert_equals(parseInt(getComputedStyle(target).left), 320, 'left offset');
+ target.style.animationTimingFunction = 'cubic-bezier(0, 0.5, 0.2, 1)';
+ assert_equals(parseInt(getComputedStyle(target).left), 395, 'left offset');
+ target.style.animationTimingFunction = 'ease-out';
+ assert_equals(parseInt(getComputedStyle(target).left), 375, 'left offset');
+
+ target.style.animationDelay = '-6s'; // Transitioning between 50% and 100%, but timing functions on 100% are ignored
+ assert_equals(parseInt(getComputedStyle(target).left), 406, 'left offset');
+ target.style.animationTimingFunction = 'linear';
+ assert_equals(parseInt(getComputedStyle(target).left), 406, 'left offset');
+ target.style.animationTimingFunction = 'cubic-bezier(0, 0.5, 0.2, 1)';
+ assert_equals(parseInt(getComputedStyle(target).left), 406, 'left offset');
+
+ }, "Check that changes in the animation timing function are reflected immediately");
+</script>
« no previous file with comments | « LayoutTests/animations/keyframes-style-declaration-updates-animation.html ('k') | Source/core/animation/Animation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698