| Index: tools/perf/page_sets/perf_week/css-transitions-staggered-chaining-by-inserting-style-element.html
|
| diff --git a/tools/perf/page_sets/perf_week/css-transitions-staggered-chaining-by-inserting-style-element.html b/tools/perf/page_sets/perf_week/css-transitions-staggered-chaining-by-inserting-style-element.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0229f5c2f66a33e99f416d8a721d9122c7f985f6
|
| --- /dev/null
|
| +++ b/tools/perf/page_sets/perf_week/css-transitions-staggered-chaining-by-inserting-style-element.html
|
| @@ -0,0 +1,65 @@
|
| +<!doctype html>
|
| +<meta name="viewport" content="width=device-width, user-scalable=no">
|
| +<container id="container"></container>
|
| +<script>
|
| +var N = 500;
|
| +var duration = 1000;
|
| +var keyframeValues = [0, 1];
|
| +var id = 0;
|
| +
|
| +for (var i = 0; i < N; i++) {
|
| + var target = document.createElement('target');
|
| + target._keyframe = 0;
|
| + target.style.transitionDelay = (-i / N * duration) + 'ms';
|
| + container.appendChild(target);
|
| + target.addEventListener('transitionend', restartTransition);
|
| +}
|
| +
|
| +function restartTransition(event) {
|
| + event.target._keyframe ^= 1;
|
| + addNewIDStyle(event.target);
|
| + event.target.style.removeProperty('transition-delay');
|
| +}
|
| +
|
| +function addNewIDStyle(target) {
|
| + id++;
|
| + if (target._currentIDStyle) {
|
| + target._currentIDStyle.remove();
|
| + }
|
| + var style = document.createElement('style');
|
| + style.textContent = '#id' + id + ' { opacity: ' + keyframeValues[target._keyframe] + ';}';
|
| + container.appendChild(style);
|
| + target.id = 'id' + id;
|
| + target._currentIDStyle = style;
|
| +}
|
| +
|
| +var measurementReady = false;
|
| +requestAnimationFrame(function() {
|
| + var styleRule = document.styleSheets[0].rules[2].style;
|
| + styleRule.opacity = keyframeValues[1];
|
| + requestAnimationFrame(function() {
|
| + styleRule.opacity = keyframeValues[0];
|
| + measurementReady = true;
|
| + });
|
| +});
|
| +</script>
|
| +
|
| +<style>
|
| +body {
|
| + margin: 0;
|
| + overflow: hidden;
|
| +}
|
| +container {
|
| + display: flex;
|
| + flex-flow: row wrap;
|
| + width: 550px;
|
| + height: 800px;
|
| + background: lightgoldenrodyellow;
|
| +}
|
| +target {
|
| + display: inline-block;
|
| + width: 9px; height: 9px;
|
| + background: magenta;
|
| + transition: opacity 1000ms linear;
|
| +}
|
| +</style>
|
|
|