<!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>[198315] trunk/PerformanceTests</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/198315">198315</a></dd>
<dt>Author</dt> <dd>jonlee@apple.com</dd>
<dt>Date</dt> <dd>2016-03-16 19:49:16 -0700 (Wed, 16 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add a new benchmark test
https://bugs.webkit.org/show_bug.cgi?id=155570

Reviewed by Simon Fraser.

New Leaves test includes various image sizes and opacity.

* Animometer/resources/debug-runner/tests.js: Add it to the HTML test suite.
* Animometer/tests/dom/leaves.html: Added.
* Animometer/tests/dom/resources/leaves.js: Added. Override the
(Particle.call.reset): Uses a range of sizes, and opacity.
(Particle.call.animate): Opacity goes up then down. When it hits 0, reset the particle.
(Particle.call.move): Set transform and opacity.
* Animometer/tests/master/resources/leaves.js: Get rid of the closure so that it
can be used in this test. Update the relative path so that it works in both the master
and dom test suite.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkPerformanceTestsAnimometerresourcesdebugrunnertestsjs">trunk/PerformanceTests/Animometer/resources/debug-runner/tests.js</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsmasterresourcesleavesjs">trunk/PerformanceTests/Animometer/tests/master/resources/leaves.js</a></li>
<li><a href="#trunkPerformanceTestsChangeLog">trunk/PerformanceTests/ChangeLog</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/PerformanceTests/Animometer/tests/dom/</li>
<li><a href="#trunkPerformanceTestsAnimometertestsdomleaveshtml">trunk/PerformanceTests/Animometer/tests/dom/leaves.html</a></li>
<li>trunk/PerformanceTests/Animometer/tests/dom/resources/</li>
<li><a href="#trunkPerformanceTestsAnimometertestsdomresourcesleavesjs">trunk/PerformanceTests/Animometer/tests/dom/resources/leaves.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkPerformanceTestsAnimometerresourcesdebugrunnertestsjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/resources/debug-runner/tests.js (198314 => 198315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/resources/debug-runner/tests.js        2016-03-17 02:18:04 UTC (rev 198314)
+++ trunk/PerformanceTests/Animometer/resources/debug-runner/tests.js        2016-03-17 02:49:16 UTC (rev 198315)
</span><span class="lines">@@ -164,6 +164,10 @@
</span><span class="cx">         {
</span><span class="cx">             url: &quot;bouncing-particles/bouncing-tagged-images.html?particleWidth=100&amp;particleHeight=100&quot;,
</span><span class="cx">             name: &quot;CSS bouncing tagged images&quot;
</span><ins>+        },
+        {
+            url: &quot;dom/leaves.html&quot;,
+            name: &quot;Leaves 2.0&quot;
</ins><span class="cx">         }
</span><span class="cx">     ]
</span><span class="cx"> ));
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsdomleaveshtml"></a>
<div class="addfile"><h4>Added: trunk/PerformanceTests/Animometer/tests/dom/leaves.html (0 => 198315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/dom/leaves.html                                (rev 0)
+++ trunk/PerformanceTests/Animometer/tests/dom/leaves.html        2016-03-17 02:49:16 UTC (rev 198315)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;meta charset=&quot;utf-8&quot;&gt;
+    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;../resources/stage.css&quot;&gt;
+    &lt;style&gt;
+        #stage {
+            background-color: #23282B;
+        }
+        #stage img {
+            position: absolute;
+        }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div id=&quot;stage&quot;&gt;&lt;/div&gt;
+    &lt;script src=&quot;../../resources/strings.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;../../resources/extensions.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;../../resources/statistics.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;../resources/math.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;../resources/main.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;../master/resources/particles.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;../master/resources/leaves.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;resources/leaves.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsdomresourcesleavesjs"></a>
<div class="addfile"><h4>Added: trunk/PerformanceTests/Animometer/tests/dom/resources/leaves.js (0 => 198315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/dom/resources/leaves.js                                (rev 0)
+++ trunk/PerformanceTests/Animometer/tests/dom/resources/leaves.js        2016-03-17 02:49:16 UTC (rev 198315)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+Leaf = Utilities.createSubclass(Particle,
+    function(stage)
+    {
+        this.element = document.createElement(&quot;img&quot;);
+        this.element.setAttribute(&quot;src&quot;, stage.images[Stage.randomInt(0, stage.images.length - 1)].src);
+        stage.element.appendChild(this.element);
+
+        Particle.call(this, stage);
+    }, {
+
+    sizeMinimum: 20,
+    sizeRange: 40,
+
+    reset: function()
+    {
+        Particle.prototype.reset.call(this);
+        this.element.style.width = this.size.x + &quot;px&quot;;
+        this.element.style.height = this.size.y + &quot;px&quot;;
+        this._opacity = .01;
+        this._opacityRate = 0.02 * Stage.random(1, 6);
+        this._position = new Point(Stage.random(0, this.maxPosition.x), Stage.random(-this.size.height, this.maxPosition.y));
+        this._velocity = new Point(Stage.random(-6, -2), .1 * this.size.y + Stage.random(-1, 1));
+    },
+
+    animate: function(timeDelta)
+    {
+        this.rotater.next(timeDelta);
+
+        this._position.x += this._velocity.x + 8 * this.stage.focusX;
+        this._position.y += this._velocity.y;
+        this._opacity += this._opacityRate;
+        if (this._opacity &gt; 1) {
+            this._opacity = 1;
+            this._opacityRate *= -1;
+        } else if (this._opacity &lt; 0 || this._position.y &gt; this.stage.size.y)
+            this.reset();
+
+        if (this._position.x &lt; -this.size.width || this._position.x &gt; this.maxPosition.x)
+            this._position.x = (this._position.x + this.maxPosition.x) % this.maxPosition.x;
+        this.move();
+    },
+
+    move: function()
+    {
+        this.element.style.transform = &quot;translate(&quot; + this._position.x + &quot;px, &quot; + this._position.y + &quot;px)&quot; + this.rotater.rotateZ();
+        this.element.style.opacity = this._opacity;
+    }
+});
</ins></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsmasterresourcesleavesjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/tests/master/resources/leaves.js (198314 => 198315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/master/resources/leaves.js        2016-03-17 02:18:04 UTC (rev 198314)
+++ trunk/PerformanceTests/Animometer/tests/master/resources/leaves.js        2016-03-17 02:49:16 UTC (rev 198315)
</span><span class="lines">@@ -1,5 +1,3 @@
</span><del>-(function() {
-
</del><span class="cx"> Leaf = Utilities.createSubclass(Particle,
</span><span class="cx">     function(stage)
</span><span class="cx">     {
</span><span class="lines">@@ -20,7 +18,7 @@
</span><span class="cx">     {
</span><span class="cx">         Particle.prototype.reset.call(this);
</span><span class="cx">         this._life = Stage.randomInt(20, 100);
</span><del>-        this._position = new Point(Stage.random(-this.size.width, this.maxPosition.x), Stage.random(-this.size.height, this.maxPosition.y));
</del><ins>+        this._position = new Point(Stage.random(0, this.maxPosition.x), Stage.random(-this.size.height, this.maxPosition.y));
</ins><span class="cx">         this._velocity = new Point(Stage.random(-6, -2), .1 * this.size.y + Stage.random(-1, 1));
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="lines">@@ -72,7 +70,7 @@
</span><span class="cx">         var lastPromise;
</span><span class="cx">         var images = this.images;
</span><span class="cx">         this.imageSrcs.forEach(function(imageSrc) {
</span><del>-            var promise = this._loadImage(&quot;resources/&quot; + imageSrc + &quot;100.png&quot;);
</del><ins>+            var promise = this._loadImage(&quot;../master/resources/&quot; + imageSrc + &quot;100.png&quot;);
</ins><span class="cx">             if (!lastPromise)
</span><span class="cx">                 lastPromise = promise;
</span><span class="cx">             else {
</span><span class="lines">@@ -135,5 +133,3 @@
</span><span class="cx"> });
</span><span class="cx"> 
</span><span class="cx"> window.benchmarkClass = LeavesBenchmark;
</span><del>-
-})();
</del></span></pre></div>
<a id="trunkPerformanceTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/ChangeLog (198314 => 198315)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/ChangeLog        2016-03-17 02:18:04 UTC (rev 198314)
+++ trunk/PerformanceTests/ChangeLog        2016-03-17 02:49:16 UTC (rev 198315)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2016-03-16  Jon Lee  &lt;jonlee@apple.com&gt;
+
+        Add a new benchmark test
+        https://bugs.webkit.org/show_bug.cgi?id=155570
+
+        Reviewed by Simon Fraser.
+
+        New Leaves test includes various image sizes and opacity.
+
+        * Animometer/resources/debug-runner/tests.js: Add it to the HTML test suite.
+        * Animometer/tests/dom/leaves.html: Added.
+        * Animometer/tests/dom/resources/leaves.js: Added. Override the
+        (Particle.call.reset): Uses a range of sizes, and opacity.
+        (Particle.call.animate): Opacity goes up then down. When it hits 0, reset the particle.
+        (Particle.call.move): Set transform and opacity.
+        * Animometer/tests/master/resources/leaves.js: Get rid of the closure so that it
+        can be used in this test. Update the relative path so that it works in both the master
+        and dom test suite.
+
</ins><span class="cx"> 2016-03-15  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add developer Animometer test that bounces P3-tagged images
</span></span></pre>
</div>
</div>

</body>
</html>