<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[205680] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/205680">205680</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2016-09-08 17:51:06 -0700 (Thu, 08 Sep 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add a content-animation test with accelerated CSS animations
https://bugs.webkit.org/show_bug.cgi?id=161776

Reviewed by Dean Jackson.

PerformanceTests:

Add a test that measures the frame rate of accelerated CSS animations.

This is like css-animation.html (which animates 'left' and 'top') but animates
transforms instead. In order to get animation in X and Y we make two nested elements
and set transformX() on one, and transformY() on the other.

* Animation/css-accelerated-animation.html: Added.

Tools:

* Scripts/webkitpy/benchmark_runner/data/patches/ContentAnimation.patch:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkPerformanceTestsChangeLog">trunk/PerformanceTests/ChangeLog</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpybenchmark_runnerdatapatchesContentAnimationpatch">trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/ContentAnimation.patch</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkPerformanceTestsAnimationcssacceleratedanimationhtml">trunk/PerformanceTests/Animation/css-accelerated-animation.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkPerformanceTestsAnimationcssacceleratedanimationhtml"></a>
<div class="addfile"><h4>Added: trunk/PerformanceTests/Animation/css-accelerated-animation.html (0 => 205680)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animation/css-accelerated-animation.html                                (rev 0)
+++ trunk/PerformanceTests/Animation/css-accelerated-animation.html        2016-09-09 00:51:06 UTC (rev 205680)
</span><span class="lines">@@ -0,0 +1,199 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;meta name=&quot;viewport&quot; content=&quot;initial-scale=1.0&quot;&gt;
+    &lt;style&gt;
+        body {
+            margin: 0;
+        }
+        #stage {
+            position: relative;
+            width: 320px;
+            height: 320px;
+            border: 1px solid black;
+            overflow: hidden;
+            z-index: 0;
+        }
+        
+        .particle-h {
+            position: absolute;
+            animation: horizontal infinite 2s alternate ease-in-out;
+        }
+
+        .particle-v {
+            position: absolute;
+            height: 20px;
+            width: 20px;
+            background-color: blue;
+            border-radius: 50%;
+            animation: vertical infinite 2s alternate ease-in-out;
+        }
+        
+        @keyframes horizontal {
+            from {
+                transform: translateX(0);
+            }
+            50% {
+                transform: translateX(300px);
+            }
+            to {
+                transform: translateX(0);
+            }
+        }
+
+        @keyframes vertical {
+            from {
+                transform: translateY(0);
+            }
+            50% {
+                transform: translateY(300px);
+            }
+            to {
+                transform: translateY(0);
+            }
+        }
+    &lt;/style&gt;
+    &lt;script&gt;
+
+        var animationDuration = 2;
+
+        function randomInt(min, max)
+        {
+            return Math.round(this.random(min, max));
+        }
+
+        function random(min, max)
+        {
+            return (Math.random() * (max - min)) + min;
+        }
+
+        function randomColor()
+        {
+            var min = 32;
+            var max = 256 - 32;
+            return &quot;#&quot;
+                + this.randomInt(min, max).toString(16)
+                + this.randomInt(min, max).toString(16)
+                + this.randomInt(min, max).toString(16);
+        }
+        
+        function Point(x, y)
+        {
+            this.x = x;
+            this.y = y;
+        }
+
+        Point.pointOnCircle = function(angle, radius)
+        {
+            return new Point(radius * Math.cos(angle), radius * Math.sin(angle));
+        }
+
+        Point.prototype =
+        {
+            add: function(other)
+            {
+                if(isNaN(other.x))
+                    return new Point(this.x + other, this.y + other);
+                return new Point(this.x + other.x, this.y + other.y);
+            },
+
+            subtract: function(other)
+            {
+                if(isNaN(other.x))
+                    return new Point(this.x - other, this.y - other);
+                return new Point(this.x - other.x, this.y - other.y);
+            },
+
+            move: function(angle, velocity, timeDelta)
+            {
+                return this.add(Point.pointOnCircle(angle, velocity * (timeDelta / 1000)));
+            },
+
+            multiply: function(other)
+            {
+                if(isNaN(other.x))
+                    return new Point(this.x * other, this.y * other);
+                return new Point(this.x * other.x, this.y * other.y);
+            },
+
+            length: function() {
+                return Math.sqrt( this.x * this.x + this.y * this.y );
+            },
+
+            normalize: function() {
+                var l = Math.sqrt( this.x * this.x + this.y * this.y );
+                this.x /= l;
+                this.y /= l;
+                return this;
+            }
+        }
+
+        function Particle(maxPosition)
+        {
+            this.horizontalContainer = document.createElement('div');
+            this.horizontalContainer.className = 'particle-h';
+
+            var delay = random(0, animationDuration);
+            this.horizontalContainer.style.animationDuration = random(animationDuration - slop, animationDuration + slop) + 's';
+            this.horizontalContainer.style.animationDelay = '-' + delay + 's';
+
+            this.element = document.createElement('div');
+            this.element.className = 'particle-v';
+            this.element.style.backgroundColor = randomColor();
+            
+            this.horizontalContainer.appendChild(this.element);
+
+            var slop = 0.2;
+            this.element.style.animationDuration = random(animationDuration - slop, animationDuration + slop) + 's';
+            this.element.style.animationDelay = '-' + delay + 's';
+
+            this.maxPosition = maxPosition;
+            this.reset();
+            this.move();
+        }
+
+        Particle.prototype =
+        {
+            reset: function()
+            {
+                this.size = new Point(20, 20);
+                this.maxLocation = this.maxPosition.subtract(this.size);
+                this.position = new Point(0, 0);
+            },
+
+            move: function()
+            {
+                this.horizontalContainer.style.transform = &quot;translateX(&quot; + this.position.x + &quot;px)&quot;;
+                this.element.style.transform = &quot;translateY(&quot; + this.position.y + &quot;px) &quot;;
+            }
+        }
+
+        var numParticles = 20;
+        var particles = [];
+
+        function makeParticles()
+        {
+            var stage = document.getElementById('stage');
+            var maxPosition = new Point(320, 320);
+            for (var i = 0; i &lt; numParticles; ++i) {
+                particles.push(new Particle(maxPosition));
+                stage.appendChild(particles[i].horizontalContainer);
+            }
+        }
+
+        function setupAnimation()
+        {
+            makeParticles();
+        }
+
+        window.addEventListener('load', setupAnimation, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;div id=&quot;stage&quot;&gt;
+&lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkPerformanceTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/ChangeLog (205679 => 205680)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/ChangeLog        2016-09-09 00:46:17 UTC (rev 205679)
+++ trunk/PerformanceTests/ChangeLog        2016-09-09 00:51:06 UTC (rev 205680)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-09-08  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Add a content-animation test with accelerated CSS animations
+        https://bugs.webkit.org/show_bug.cgi?id=161776
+
+        Reviewed by Dean Jackson.
+
+        Add a test that measures the frame rate of accelerated CSS animations.
+
+        This is like css-animation.html (which animates 'left' and 'top') but animates
+        transforms instead. In order to get animation in X and Y we make two nested elements
+        and set transformX() on one, and transformY() on the other.
+
+        * Animation/css-accelerated-animation.html: Added.
+
</ins><span class="cx"> 2016-08-23  Saam Barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         It should be easy to run ES6SampleBench from the jsc shell
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (205679 => 205680)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-09-09 00:46:17 UTC (rev 205679)
+++ trunk/Tools/ChangeLog        2016-09-09 00:51:06 UTC (rev 205680)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2016-09-08  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Add a content-animation test with accelerated CSS animations
+        https://bugs.webkit.org/show_bug.cgi?id=161776
+
+        Reviewed by Dean Jackson.
+
+        * Scripts/webkitpy/benchmark_runner/data/patches/ContentAnimation.patch:
+
</ins><span class="cx"> 2016-09-08  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         URLParser: Parsing empty URLs with a base URL should return the base URL
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpybenchmark_runnerdatapatchesContentAnimationpatch"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/ContentAnimation.patch (205679 => 205680)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/ContentAnimation.patch        2016-09-09 00:46:17 UTC (rev 205679)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/data/patches/ContentAnimation.patch        2016-09-09 00:51:06 UTC (rev 205680)
</span><span class="lines">@@ -1,3 +1,62 @@
</span><ins>+diff --git a/css-accelerated-animation.html b/css-accelerated-animation.html
+index 51ab3178addd49b3d9a19b03479d59be6aabf00b..fd637bc420c751b695afa84cc05ec9b25800f1ad 100644
+--- a/css-accelerated-animation.html
++++ b/css-accelerated-animation.html
+@@ -185,9 +185,54 @@
+         function setupAnimation()
+         {
+             makeParticles();
++
++            window.setTimeout(function() {
++                location.hash = 'done';
++            }, 10000)
++        }
++
++        function hashChanged()
++        {
++            if (location.hash === '#submit')
++                submitResults();
++        }
++
++        function submitResults()
++        {
++            var results = {
++                'content-animation' : {
++                    'metrics' : {
++                        'FrameRate' : ['Arithmetic']
++                    },
++                    'tests' : {
++                        'css-accelerated-animation' : {
++                            'metrics' : {
++                                'FrameRate' : {
++                                    'current' : ['&lt;native_framerate&gt;'] // &lt;native_framerate&gt; is replaced by a framerate computed in native code
++                                }
++                            }
++                        }
++                    }
++                }
++            };
++            var resultsString = JSON.stringify(results);
++            var xhr = new XMLHttpRequest();
++            xhr.open(&quot;POST&quot;, &quot;/report&quot;);
++            xhr.setRequestHeader(&quot;Content-type&quot;, &quot;application/json&quot;);
++            xhr.setRequestHeader(&quot;Content-length&quot;, resultsString.length);
++            xhr.setRequestHeader(&quot;Connection&quot;, &quot;close&quot;);
++            xhr.onreadystatechange = function() {
++                if (xhr.readyState == XMLHttpRequest.DONE &amp;&amp; xhr.status == 200) {
++                    closeRequest = new XMLHttpRequest();
++                    closeRequest.open(&quot;GET&quot;, &quot;/shutdown&quot;);
++                    closeRequest.send()
++                }
++            }
++            xhr.send(resultsString);
+         }

+         window.addEventListener('load', setupAnimation, false);
++        window.addEventListener(&quot;hashchange&quot;, hashChanged, false);
+     &lt;/script&gt;
+ &lt;/head&gt;
+ &lt;body&gt;
</ins><span class="cx"> diff --git a/css-animation.html b/css-animation.html
</span><span class="cx"> index adae19cb018ed1ca93fd6b4cda80002348482fc3..8f1e29933faa13586dbf97b7874024854fbf2147 100644
</span><span class="cx"> --- a/css-animation.html
</span></span></pre>
</div>
</div>

</body>
</html>