OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../resources/runner.js"></script> | 4 <script src="../resources/runner.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <div id="wrapper"> | 7 <div id="wrapper"> |
8 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/199
9/xlink"> | 8 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/199
9/xlink"> |
9 <defs> | 9 <defs> |
10 <g id="unit"> | 10 <g id="unit"> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 }; | 57 }; |
58 | 58 |
59 function newFrame() { | 59 function newFrame() { |
60 times.push(PerfTestRunner.now()); | 60 times.push(PerfTestRunner.now()); |
61 var avg = (times[times.length - 1] - times[0]) / (times.length - 1); | 61 var avg = (times[times.length - 1] - times[0]) / (times.length - 1); |
62 while (times.length > 10) | 62 while (times.length > 10) |
63 times.shift(); | 63 times.shift(); |
64 | 64 |
65 document.getElementById("FPS").textContent = (1000 / avg).toFixed(2)
; | 65 document.getElementById("FPS").textContent = (1000 / avg).toFixed(2)
; |
66 unit.setAttribute('transform', 'scale(' + (Math.abs(frame++ % 20 - 1
0) / 10) + ')'); | 66 unit.setAttribute('transform', 'scale(' + (Math.abs(frame++ % 20 - 1
0) / 10) + ')'); |
67 PerfTestRunner.forceLayoutOrFullFrame(); | 67 PerfTestRunner.forceLayout(); |
68 }; | 68 }; |
69 | 69 |
70 function animate() { | 70 function animate() { |
71 newFrame(); | 71 newFrame(); |
72 requestAnimationFrame(animate); | 72 requestAnimationFrame(animate); |
73 } | 73 } |
74 | 74 |
75 if (window.testRunner) { | 75 if (window.testRunner) { |
76 PerfTestRunner.measureRunsPerSecond({ run: newFrame, done: function(
) { | 76 PerfTestRunner.measureRunsPerSecond({ run: newFrame, done: function(
) { |
77 document.getElementById('wrapper').style.display = 'none'; | 77 document.getElementById('wrapper').style.display = 'none'; |
78 }}); | 78 }}); |
79 } else | 79 } else |
80 requestAnimationFrame(animate); | 80 requestAnimationFrame(animate); |
81 </script> | 81 </script> |
82 </body> | 82 </body> |
83 </html> | 83 </html> |
OLD | NEW |