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

Unified Diff: LayoutTests/animations/keyframes-style-declaration-updates-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/keyframes-style-declaration-updates-animation.html
diff --git a/LayoutTests/animations/keyframes-style-declaration-updates-animation.html b/LayoutTests/animations/keyframes-style-declaration-updates-animation.html
new file mode 100644
index 0000000000000000000000000000000000000000..88df153a8a61ab45036bf6431e01bd1d83586f06
--- /dev/null
+++ b/LayoutTests/animations/keyframes-style-declaration-updates-animation.html
@@ -0,0 +1,55 @@
+<!doctype html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<style>
+ @keyframes anim {
+ 0% { left: 0px; }
+ 50% { left: 500px; }
+ 100% { left: 100px; }
+ }
+
+ #target1 {
+ animation: anim 10s -3s linear paused;
+ background-color: rgb(0, 0, 0);
+ left: 0px;
+ }
+
+ #target2 {
+ animation: anim 10s -6s linear paused;
+ background-color: rgb(0, 0, 0);
+ left: 100px;
+ }
+</style>
+<div id="target1"></div>
+<div id="target2"></div>
+<script>
+ test(function() {
+ assert_equals(parseInt(getComputedStyle(target1).left), 300, 'left offset');
+ assert_equals(parseInt(getComputedStyle(target2).left), 420, 'left offset');
+
+ var sheet = document.styleSheets[0];
+ var rules = sheet.rules;
+ var keyframes = rules[0];
+
+ assert_equals(keyframes.cssRules.length, 3);
+ var keyframe = keyframes[1];
+ assert_equals(keyframe.keyText, '50%');
+ keyframe.style.setProperty('background-color', 'rgb(200, 100, 50)');
+ assert_equals(getComputedStyle(target1).backgroundColor, 'rgb(120, 60, 30)');
+ assert_equals(getComputedStyle(target2).backgroundColor, 'rgb(160, 80, 40)');
+
+ keyframe.style.removeProperty('background-color');
+ assert_equals(getComputedStyle(target1).backgroundColor, 'rgb(0, 0, 0)');
+ assert_equals(getComputedStyle(target2).backgroundColor, 'rgb(0, 0, 0)');
+
+ keyframe.style.left = '200px';
+ assert_equals(parseInt(getComputedStyle(target1).left), 120, 'left offset');
+ assert_equals(parseInt(getComputedStyle(target2).left), 180, 'left offset');
+
+ keyframe.style.left = '500px';
+ keyframe.keyText = '20%';
+ assert_equals(parseInt(getComputedStyle(target1).left), 450, 'left offset');
+ assert_equals(parseInt(getComputedStyle(target2).left), 300, 'left offset');
+
+ }, "Check that changes to keyframe style declarations update the animation accordingly");
+</script>

Powered by Google App Engine
This is Rietveld 408576698