StorageAccess API calls should be direct to the Network Process
[WebKit-https.git] / LayoutTests / transitions / cancel-transition.html
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5     <style>
6         #container {
7             height: 300px;
8             width: 700px;
9             background: #fcc;
10             font-family: ArialRoundedMTBold, sans-serif;
11             font-size: 200%;
12         }
13   
14         #container div {
15             position: absolute;
16             background-color: #933;
17             width: 200px;
18             height: 100px;
19             left: 50px;
20         }
21         #a {
22             top: 100px;
23         }
24         #container.run #a {
25             left: 450px;
26             -webkit-transition-property: left;
27             -webkit-transition-duration: 0.5s;
28             -webkit-transition-timing-function: linear;
29         }
30         #b {
31             top: 250px;
32         }
33         #container.run #b {
34             -webkit-transform: translate(400px, 0px);
35             -webkit-transition-property: -webkit-transform;
36             -webkit-transition-duration: 0.5s;
37             -webkit-transition-timing-function: linear;
38         }
39     </style>
40     <script>
41         if (window.testRunner) {
42             testRunner.dumpAsText();
43             testRunner.waitUntilDone();
44         }
45
46         result = "<span style='color:red'>CHECK NOT COMPLETED</span>";
47
48         function isEqual(actual, desired, tolerance)
49         {
50             var diff = Math.abs(actual - desired);
51             return diff < tolerance;
52         }
53
54         function cancelTransition()
55         {
56             document.getElementById("container").className = "";
57             document.body.offsetHeight;
58         }
59
60         function restartTransition()
61         {
62             document.getElementById("container").className = "run";
63             document.body.offsetHeight;
64             // The transition should restart at the beginning here. After 250 it should be halfway done.
65             setTimeout("check()", 250);
66         }
67
68         function check()
69         {
70             var left = parseFloat(window.getComputedStyle(document.getElementById('a')).left);
71             result = "left:";
72             if (!isEqual(left, 250, 50))
73                 result += "<span style='color:red'>FAIL(was:" + left + ", s/b:150)</span>";
74             else
75                 result += "<span style='color:green'>PASS</span>";
76             
77             result += ", webkitTransform:";
78             
79             var transform = window.getComputedStyle(document.getElementById('b')).webkitTransform;
80             transform = transform.split("(");
81             transform = transform[1].split(",");
82             if (!isEqual(transform[4], 200, 50))
83                 result += "<span style='color:red'>FAIL(was:" + transform[4] + ", s/b:50)</span>";
84             else
85                 result += "<span style='color:green'>PASS</span>";
86             
87             document.getElementById('result').innerHTML = result;
88             if (window.testRunner)
89                 testRunner.notifyDone();
90         }
91
92         function start()
93         {
94             document.getElementById("container").className = "run";
95             document.body.offsetHeight;
96             setTimeout("cancelTransition()", 100);
97             setTimeout("restartTransition()", 200);
98         }
99     </script>
100 </head>
101 <body onload="start()">
102 <p>
103     Test removes the transition properties while the transition is running, then adds them back in.
104     If working properly the transitions should start from the beginning. But there was a bug that
105     would cause the transition to continue to run (although with no visible effect). So when you
106     restarted, it would pick up where it left off.
107 </p>
108 <div id="container">
109     <div id="a" class="tester">left</div>
110     <div id="b" class="tester">translate</div>
111 </div>
112 <div id="result">
113 </div>
114 </body>
115 </html>