| Index: tools/perf/page_sets/tough_animation_cases/css_animations_staggered_chaining_by_inserting_new_element.html
|
| diff --git a/tools/perf/page_sets/tough_animation_cases/web_animations_staggered_chaining.html b/tools/perf/page_sets/tough_animation_cases/css_animations_staggered_chaining_by_inserting_new_element.html
|
| similarity index 59%
|
| copy from tools/perf/page_sets/tough_animation_cases/web_animations_staggered_chaining.html
|
| copy to tools/perf/page_sets/tough_animation_cases/css_animations_staggered_chaining_by_inserting_new_element.html
|
| index ea725bf8b0fc4bf158cc3be4c61e08f2e34fc059..fe4f1428bf3b370785c0f1d66f445714eeca285a 100644
|
| --- a/tools/perf/page_sets/tough_animation_cases/web_animations_staggered_chaining.html
|
| +++ b/tools/perf/page_sets/tough_animation_cases/css_animations_staggered_chaining_by_inserting_new_element.html
|
| @@ -1,8 +1,8 @@
|
| <!DOCTYPE html>
|
| <meta name="viewport" content="width=device-width, user-scalable=no">
|
| +<link rel="stylesheet" type="text/css" href="resources/animation.css">
|
| <link rel="stylesheet" type="text/css" href="resources/tablet.css">
|
| <script src="resources/perftesthelper.js"></script>
|
| -<script src="resources/web_animations_api_check.js"></script>
|
|
|
| <container id="container"></container>
|
|
|
| @@ -10,36 +10,31 @@
|
| var N = PerfTestHelper.getN(1000);
|
| var duration = 1000;
|
|
|
| -function startAnimation(element) {
|
| - var player = element.animate([
|
| - {opacity: 0},
|
| - {opacity: 1},
|
| - ], duration);
|
| - player.onfinish = function() {
|
| - startAnimation(element);
|
| - }
|
| -}
|
| -
|
| -function addElement() {
|
| +function startAnimation() {
|
| var target = document.createElement('target');
|
| + target.i = 1;
|
| container.appendChild(target);
|
| - startAnimation(target);
|
| + target.addEventListener('webkitAnimationEnd', function(e) {
|
| + e.target.remove();
|
| + startAnimation();
|
| + });
|
| }
|
|
|
| requestAnimationFrame(function(t) {
|
| var base = t;
|
| var i = 0;
|
|
|
| - requestAnimationFrame(function staggeredStart(t) {
|
| + function staggeredStart(t) {
|
| elapsed = t - base;
|
| - for (; i < N * Math.min(1, elapsed / duration); i++) {
|
| - addElement();
|
| + for (; i < N * elapsed / duration; i++) {
|
| + startAnimation();
|
| }
|
| if (i < N) {
|
| requestAnimationFrame(staggeredStart);
|
| } else {
|
| PerfTestHelper.signalReady();
|
| }
|
| - });
|
| + }
|
| + requestAnimationFrame(staggeredStart);
|
| });
|
| </script>
|
|
|