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

Side by Side Diff: LayoutTests/transitions/cancel-transition.html

Issue 110123005: Web Animations CSS: Record if style recalc is for animation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Ignore new interrupted immediately test when testing legacy animations engine Created 7 years 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/transitions/interrupted-immediately.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 2
3 <html> 3 <html>
4 <head> 4 <head>
5 <style> 5 <style>
6 #container { 6 #container {
7 width: 700px; 7 width: 700px;
8 background-color: #fcc; 8 background-color: #fcc;
9 } 9 }
10 10
11 #container div { 11 #container div {
12 position: relative; 12 position: relative;
13 background-color: #933; 13 background-color: #933;
14 width: 200px; 14 width: 200px;
15 height: 50px; 15 height: 50px;
16 left: 50px; 16 left: 50px;
17 margin-top: 10px; 17 margin-top: 10px;
18 } 18 }
19 #container.run #left { 19 #container.run #left {
20 left: 450px; 20 left: 450px;
21 -webkit-transition-property: left; 21 -webkit-transition-property: left;
22 -webkit-transition-duration: 0.5s; 22 -webkit-transition-duration: 1s;
23 -webkit-transition-timing-function: linear; 23 -webkit-transition-timing-function: linear;
24 } 24 }
25 #container.run #translate { 25 #container.run #translate {
26 -webkit-transform: translate(400px, 0px); 26 -webkit-transform: translate(400px, 0px);
27 -webkit-transition-property: -webkit-transform; 27 -webkit-transition-property: -webkit-transform;
28 -webkit-transition-duration: 0.5s; 28 -webkit-transition-duration: 1s;
29 -webkit-transition-timing-function: linear; 29 -webkit-transition-timing-function: linear;
30 } 30 }
31 </style> 31 </style>
32 <script> 32 <script>
33 if (window.testRunner) { 33 if (window.testRunner) {
34 testRunner.dumpAsText(); 34 testRunner.dumpAsText();
35 testRunner.waitUntilDone(); 35 testRunner.waitUntilDone();
36 } 36 }
37 37
38 function isEqual(actual, desired, tolerance) 38 function isEqual(actual, desired, tolerance)
39 { 39 {
40 var diff = Math.abs(actual - desired); 40 var diff = Math.abs(actual - desired);
41 return diff < tolerance; 41 return diff < tolerance;
42 } 42 }
43 43
44 function cancelTransition() 44 function cancelTransition()
45 { 45 {
46 document.getElementById("container").className = ""; 46 document.getElementById("container").className = "";
47 document.body.offsetHeight; 47 document.body.offsetHeight;
48 } 48 }
49 49
50 function restartTransition() 50 function restartTransition()
51 { 51 {
52 document.getElementById("container").className = "run"; 52 document.getElementById("container").className = "run";
53 document.body.offsetHeight; 53 document.body.offsetHeight;
54 // The transition should restart at the beginning here. After 250 it should be halfway done. 54 // The transition should restart at the beginning here. After 250 it should be halfway done.
55 setTimeout(check, 250); 55 setTimeout(check, 500);
56 } 56 }
57 57
58 function check() 58 function check()
59 { 59 {
60 var left = parseFloat(window.getComputedStyle(document.getElementByI d('left')).left); 60 var left = parseFloat(window.getComputedStyle(document.getElementByI d('left')).left);
61 result = "left: "; 61 result = "left: ";
62 if (!isEqual(left, 250, 50)) 62 if (!isEqual(left, 250, 50))
63 result += "<span style='color:red'>FAIL (was: " + left + ", expe cted: 150)</span>"; 63 result += "<span style='color:red'>FAIL (was: " + left + ", expe cted: 250)</span>";
64 else 64 else
65 result += "<span style='color:green'>PASS</span>"; 65 result += "<span style='color:green'>PASS</span>";
66 66
67 result += ", webkitTransform: "; 67 result += ", webkitTransform: ";
68 68
69 var transform = window.getComputedStyle(document.getElementById('tra nslate')).webkitTransform; 69 var transform = window.getComputedStyle(document.getElementById('tra nslate')).webkitTransform;
70 transform = transform.split("("); 70 transform = transform.split("(");
71 transform = transform[1].split(","); 71 transform = transform[1].split(",");
72 if (!isEqual(transform[4], 200, 50)) 72 if (!isEqual(transform[4], 200, 50))
73 result += "<span style='color:red'>FAIL (was: " + transform[4] + ", expected: 50)</span>"; 73 result += "<span style='color:red'>FAIL (was: " + transform[4] + ", expected: 200)</span>";
74 else 74 else
75 result += "<span style='color:green'>PASS</span>"; 75 result += "<span style='color:green'>PASS</span>";
76 76
77 document.getElementById('result').innerHTML = result; 77 document.getElementById('result').innerHTML = result;
78 if (window.testRunner) 78 if (window.testRunner)
79 testRunner.notifyDone(); 79 testRunner.notifyDone();
80 } 80 }
81 81
82 function start() 82 function start()
83 { 83 {
84 document.getElementById("container").className = "run"; 84 document.getElementById("container").className = "run";
85 document.body.offsetHeight; 85 document.body.offsetHeight;
86 setTimeout("cancelTransition()", 100); 86 setTimeout("cancelTransition()", 200);
87 setTimeout("restartTransition()", 200); 87 setTimeout("restartTransition()", 400);
88 } 88 }
89 </script> 89 </script>
90 </head> 90 </head>
91 <body onload="start()"> 91 <body onload="start()">
92 <p> 92 <p>
93 Test removes the transition properties while the transition is running, then adds them back in. 93 Test removes the transition properties while the transition is running, then adds them back in.
94 If working properly the transitions should start from the beginning. But the re was a bug that 94 If working properly the transitions should start from the beginning. But the re was a bug that
95 would cause the transition to continue to run (although with no visible effe ct). So when you 95 would cause the transition to continue to run (although with no visible effe ct). So when you
96 restarted, it would pick up where it left off. 96 restarted, it would pick up where it left off.
97 </p> 97 </p>
98 <div id="container"> 98 <div id="container">
99 <div id="left">left</div> 99 <div id="left">left</div>
100 <div id="translate">translate</div> 100 <div id="translate">translate</div>
101 </div> 101 </div>
102 <div id="result"></div> 102 <div id="result"></div>
103 </body> 103 </body>
104 </html> 104 </html>
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/transitions/interrupted-immediately.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698