[WK2] selection does not disappear after coping the text
[framework/web/webkit-efl.git] / LayoutTests / animations / change-keyframes.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2    "http://www.w3.org/TR/html4/loose.dtd">
3
4 <html lang="en">
5 <head>
6   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7   <title>Test Changing Keyframes Using CSSOM</title>
8   <style type="text/css" media="screen">
9     #box {
10         position: relative;
11         left: 0;
12         top: 0;
13         height: 100px;
14         width: 100px;
15         background-color: blue;
16         -webkit-animation-duration: 1s;
17         -webkit-animation-timing-function: linear;
18         -webkit-animation-name: "anim";
19     }
20     @-webkit-keyframes "anim" {
21         from { left: 100px; }
22         10%  { left: 200px; }
23         90%  { left: 200px; }
24         to   { left: 300px; }
25     }
26     </style>
27     <script src="resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
28     <script type="text/javascript" charset="utf-8">
29     
30     const expectedValues = [
31       // [animation-name, time, element-id, property, expected-value, tolerance]
32       [null, 0.5, "box", "left", 200, 10],
33       [null, 1, "box", "top", 100, 10],
34     ];
35
36     function findKeyframesRule(rule)
37     {
38         var ss = document.styleSheets;
39         for (var i = 0; i < ss.length; ++i) {
40             for (var j = 0; j < ss[i].cssRules.length; ++j) {
41                 if (ss[i].cssRules[j].type == window.CSSRule.WEBKIT_KEYFRAMES_RULE && ss[i].cssRules[j].name == rule)
42                     return ss[i].cssRules[j];
43             }
44         }
45         
46         return null;
47     }
48         
49     function change()
50     {
51         // change keyframes
52         var keyframes = findKeyframesRule("anim");
53         keyframes.deleteRule("0%");
54         keyframes.deleteRule("40%");
55         keyframes.deleteRule("60%");
56         keyframes.deleteRule("100%");
57         keyframes.insertRule("0% { top: 50px; }");
58         keyframes.insertRule("10% { top: 100px; }");
59         keyframes.insertRule("90% { top: 100px; }");
60         keyframes.insertRule("100% { top: 150px; }");
61         document.getElementById('box').style.webkitAnimationName = "anim";
62     }
63     
64     function startChange()
65     {
66         document.getElementById('box').style.webkitAnimationName = "none";
67         setTimeout("change()", 0);
68     }
69     
70     function setup()
71     {
72         setTimeout("startChange()", 600);
73     }
74     
75     runAnimationTest(expectedValues, setup);
76     
77   </script>
78 </head>
79 <body>
80 This test performs an animation of the left property and makes sure it is animating. Then it stops
81 the animation, changes the keyframes to an animation of the top property, restarts the animation
82 and makes sure top is animating.
83 <div id="box">
84 </div>
85 <div id="result">
86 </div>
87 </body>
88 </html>