blob: b55ed81e3e86666fa5c242b65e3b548dd351749d [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test Changing Name of A Keyframes Rule Using CSSOM</title>
<style type="text/css" media="screen">
#box {
position: relative;
left: 0;
top: 0;
height: 100px;
width: 100px;
background-color: blue;
-webkit-animation-duration: 0.5s;
-webkit-animation-timing-function: linear;
-webkit-animation-name: "bar";
}
@-webkit-keyframes "foo" {
from { left: 100px; }
40% { left: 200px; }
60% { left: 200px; }
to { left: 300px; }
}
</style>
<script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
const expectedValues = [
// [time, element-id, property, expected-value, tolerance]
[0.25, "box", "left", 200, 20],
];
function findKeyframesRule(rule)
{
var ss = document.styleSheets;
for (var i = 0; i < ss.length; ++i) {
for (var j = 0; j < ss[i].cssRules.length; ++j) {
if (ss[i].cssRules[j].type == window.CSSRule.WEBKIT_KEYFRAMES_RULE && ss[i].cssRules[j].name == rule)
return ss[i].cssRules[j];
}
}
return null;
}
function change()
{
// change keyframes name
var keyframes = findKeyframesRule("foo");
keyframes.name = "anim";
document.getElementById('box').style.webkitAnimationName = "anim";
runAnimationTest(expectedValues, null, null, 'do-not-use-pause-api');
}
function setup()
{
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
setTimeout(change, 200);
}
</script>
</head>
<body onload="setup()">
This test changes the name of the @keyframes rule so that it matches
and makes sure the animation starts running.
<div id="box">
</div>
<div id="pre-result">
</div>
<div id="result">
</div>
</body>
</html>