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

Unified Diff: tools/perf/page_sets/perf_week/css-animations-staggered-chaining-by-inserting-style-element.html

Issue 402433004: Test adding perf week tests as smoothness benchmark (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: g cl issue Created 6 years, 5 months 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 side-by-side diff with in-line comments
Download patch
Index: tools/perf/page_sets/perf_week/css-animations-staggered-chaining-by-inserting-style-element.html
diff --git a/tools/perf/page_sets/perf_week/css-animations-staggered-chaining-by-inserting-style-element.html b/tools/perf/page_sets/perf_week/css-animations-staggered-chaining-by-inserting-style-element.html
new file mode 100644
index 0000000000000000000000000000000000000000..6b80f63abdbd8177f6ac6915d5be0f03c2a49df1
--- /dev/null
+++ b/tools/perf/page_sets/perf_week/css-animations-staggered-chaining-by-inserting-style-element.html
@@ -0,0 +1,75 @@
+<!doctype html>
+<meta name="viewport" content="width=device-width, user-scalable=no">
+<container id="container"></container>
+<script>
+var N = 500;
+var duration = 1000;
+
+function startAnimation() {
+ var target = document.createElement('target');
+ container.appendChild(target);
+ updateStyle(target);
+ target.addEventListener('webkitAnimationEnd', function(e) {
+ updateStyle(target);
+ });
+}
+
+var nextId = 0;
+var nextAnim = 0;
+function updateStyle(element) {
+ if (!element.id) {
+ element.id = 'e' + nextId++;
+ }
+ if (element.styleSheet) {
+ element.styleSheet.remove();
+ }
+ var id = element.id;
+ var anim = id + 'anim' + nextAnim++;
+ var style = document.createElement('style');
+ style.textContent = '\
+ #' + id + ' {\
+ display: inline-block;\
+ width: 9px; height: 9px;\
+ background: orange;\
+ -webkit-animation: ' + anim + ' 1s;\
+ }\n\
+ @-webkit-keyframes ' + anim + ' {\
+ 0% { opacity: 0; }\
+ 100% { opacity: 1; }\
+ }';
+ container.appendChild(style);
+ element.styleSheet = style;
+}
+
+requestAnimationFrame(function(t) {
+ var base = t;
+ var i = 0;
+
+ function staggeredStart(t) {
+ elapsed = t - base;
+ for (; i < N * elapsed / duration; i++) {
+ startAnimation();
+ }
+ if (i < N) {
+ requestAnimationFrame(staggeredStart);
+ } else {
+ window.measurementReady = true;
+ }
+ }
+ requestAnimationFrame(staggeredStart);
+});
+</script>
+
+<style>
+body {
+ margin: 0;
+ overflow: hidden;
+}
+container {
+ display: flex;
+ flex-flow: row wrap;
+ width: 550px;
+ height: 800px;
+ background: magenta;
+}
+</style>

Powered by Google App Engine
This is Rietveld 408576698