<!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>[197908] 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/197908">197908</a></dd>
<dt>Author</dt> <dd>jonlee@apple.com</dd>
<dt>Date</dt> <dd>2016-03-09 17:37:35 -0800 (Wed, 09 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add text tests
https://bugs.webkit.org/show_bug.cgi?id=155257

Reviewed by Simon Fraser.

* Animometer/resources/extensions.js:
(UnitBezier.Utilities.createClass): Add a class that computes Bezier points
assuming that two of the control points are at (0,0) and (1,1). Taken from
WebCore/platform/graphics/UnitBezier.h
* Animometer/resources/runner/tests.js: Add a test for English text and one
for international text.
* Animometer/tests/master/international.html: Added.
* Animometer/tests/master/resources/text.js: Added. The test assumes there is
#template div which it will copy. The copies are placed behind the template, and
are set with different colors each frame. They are moved around with CSS transform.
* Animometer/tests/master/text.html: Added.

Remove the other text tests, since these ones cover the same techniques.
* Animometer/tests/text/layering-text.html: Removed.
* Animometer/tests/text/resources/layering-text.js: Removed.
* Animometer/tests/text/resources/text-boxes.js: Removed.
* Animometer/tests/text/text-boxes.html: Removed.
* Animometer/resources/debug-runner/tests.js:</pre>

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

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkPerformanceTestsAnimometertestsmasterinternationalhtml">trunk/PerformanceTests/Animometer/tests/master/international.html</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsmasterresourcestextjs">trunk/PerformanceTests/Animometer/tests/master/resources/text.js</a></li>
<li><a href="#trunkPerformanceTestsAnimometertestsmastertexthtml">trunk/PerformanceTests/Animometer/tests/master/text.html</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li>trunk/PerformanceTests/Animometer/tests/text/</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 (197907 => 197908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/resources/debug-runner/tests.js        2016-03-10 01:35:18 UTC (rev 197907)
+++ trunk/PerformanceTests/Animometer/resources/debug-runner/tests.js        2016-03-10 01:37:35 UTC (rev 197908)
</span><span class="lines">@@ -160,15 +160,7 @@
</span><span class="cx">         {
</span><span class="cx">             url: &quot;bouncing-particles/bouncing-css-images.html?particleWidth=80&amp;particleHeight=80&amp;imageSrc=../resources/yin-yang.svg&quot;,
</span><span class="cx">             name: &quot;CSS bouncing SVG images&quot;
</span><del>-        },
-        {
-            url: &quot;text/layering-text.html&quot;,
-            name: &quot;CSS layering text&quot;
-        },
-        {
-            url: &quot;text/text-boxes.html?particleWidth=280&amp;particleHeight=180&quot;,
-            name: &quot;CSS text boxes&quot;
-        },
</del><ins>+        }
</ins><span class="cx">     ]
</span><span class="cx"> ));
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometerresourcesextensionsjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/resources/extensions.js (197907 => 197908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/resources/extensions.js        2016-03-10 01:35:18 UTC (rev 197907)
+++ trunk/PerformanceTests/Animometer/resources/extensions.js        2016-03-10 01:37:35 UTC (rev 197908)
</span><span class="lines">@@ -314,6 +314,76 @@
</span><span class="cx">         parseFloat(styles.paddingTop));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+UnitBezier = Utilities.createClass(
+    function(point1, point2)
+    {
+        // First and last points in the Bézier curve are assumed to be (0,0) and (!,1)
+        this._c = point1.multiply(3);
+        this._b = point2.subtract(point1).multiply(3).subtract(this._c);
+        this._a = new Point(1, 1).subtract(this._c).subtract(this._b);
+    }, {
+
+    epsilon: 1e-5,
+    derivativeEpsilon: 1e-6,
+
+    solve: function(x)
+    {
+        return this.sampleY(this.solveForT(x));
+    },
+
+    sampleX: function(t)
+    {
+        return ((this._a.x * t + this._b.x) * t + this._c.x) * t;
+    },
+
+    sampleY: function(t)
+    {
+        return ((this._a.y * t + this._b.y) * t + this._c.y) * t;kkkj
+    },
+
+    sampleDerivativeX: function(t)
+    {
+        return(3 * this._a.x * t + 2 * this._b.x) * t + this._c.x;
+    },
+
+    solveForT: function(x)
+    {
+        var t0, t1, t2, x2, d2, i;
+
+        for (t2 = x, i = 0; i &lt; 8; ++i) {
+            x2 = this.sampleX(t2) - x;
+            if (Math.abs(x2) &lt; this.epsilon)
+                return t2;
+            d2 = this.sampleDerivativeX(t2);
+            if (Math.abs(d2) &lt; this.derivativeEpsilon)
+                break;
+            t2 = t2 - x2 / d2;
+        }
+
+        t0 = 0;
+        t1 = 1;
+        t2 = x;
+
+        if (t2 &lt; t0)
+            return t0;
+        if (t2 &gt; t1)
+            return t1;
+
+        while (t0 &lt; t1) {
+            x2 = this.sampleX(t2);
+            if (Math.abs(x2 - x) &lt; this.epsilon)
+                return t2;
+            if (x &gt; x2)
+                t0 = t2;
+            else
+                t1 = t2;
+            t2 = (t1 - t0) * .5 + t0;
+        }
+
+        return t2;
+    }
+});
+
</ins><span class="cx"> SimplePromise = Utilities.createClass(
</span><span class="cx">     function()
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometerresourcesrunnertestsjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/Animometer/resources/runner/tests.js (197907 => 197908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/resources/runner/tests.js        2016-03-10 01:35:18 UTC (rev 197907)
+++ trunk/PerformanceTests/Animometer/resources/runner/tests.js        2016-03-10 01:37:35 UTC (rev 197908)
</span><span class="lines">@@ -33,6 +33,10 @@
</span><span class="cx">             name: &quot;Canvas line segments&quot;
</span><span class="cx">         },
</span><span class="cx">         {
</span><ins>+            url: &quot;master/text.html&quot;,
+            name: &quot;A to Z&quot;
+        },
+        {
</ins><span class="cx">             url: &quot;master/focus.html&quot;,
</span><span class="cx">             name: &quot;Focus&quot;
</span><span class="cx">         },
</span><span class="lines">@@ -41,6 +45,10 @@
</span><span class="cx">             name: &quot;Images&quot;
</span><span class="cx">         },
</span><span class="cx">         {
</span><ins>+            url: &quot;master/international.html&quot;,
+            name: &quot;Design&quot;
+        },
+        {
</ins><span class="cx">             url: &quot;master/particles.html&quot;,
</span><span class="cx">             name: &quot;DOM particles, SVG masks&quot;
</span><span class="cx">         },
</span></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsmasterinternationalhtml"></a>
<div class="addfile"><h4>Added: trunk/PerformanceTests/Animometer/tests/master/international.html (0 => 197908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/master/international.html                                (rev 0)
+++ trunk/PerformanceTests/Animometer/tests/master/international.html        2016-03-10 01:37:35 UTC (rev 197908)
</span><span class="lines">@@ -0,0 +1,40 @@
</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 type=&quot;text/css&quot;&gt;
+
+        #stage {
+            font-family: Helvetica;
+            font-size: 48px;
+        }
+        #stage div {
+            width: 60%;
+            position: absolute;
+            text-align: center;
+        }
+        #template {
+            color: #111;
+        }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div id=&quot;stage&quot;&gt;
+        &lt;div id=&quot;template&quot;&gt;
+            &lt;p&gt;设计&lt;/p&gt;
+            &lt;p class=&quot;rtl&quot;&gt;تصميم&lt;/p&gt;
+            &lt;p&gt;дизайн&lt;/p&gt;
+            &lt;p&gt;デザイン&lt;/p&gt;
+            &lt;p class=&quot;rtl&quot;&gt;עיצוב&lt;/p&gt;
+            &lt;p&gt;디자인&lt;/p&gt;
+        &lt;/div&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;resources/text.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsmasterresourcestextjs"></a>
<div class="addfile"><h4>Added: trunk/PerformanceTests/Animometer/tests/master/resources/text.js (0 => 197908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/master/resources/text.js                                (rev 0)
+++ trunk/PerformanceTests/Animometer/tests/master/resources/text.js        2016-03-10 01:37:35 UTC (rev 197908)
</span><span class="lines">@@ -0,0 +1,104 @@
</span><ins>+(function() {
+
+var TextStage = Utilities.createSubclass(Stage,
+    function()
+    {
+        Stage.call(this);
+
+        this.testElements = [];
+        this._offsetIndex = 0;
+    }, {
+
+    shadowFalloff: new UnitBezier(new Point(0.015, 0.750), new Point(0.755, 0.235)),
+    shimmerAverage: 0.4,
+    shimmerMax: 0.5,
+    millisecondsPerRotation: 1000 / (.26 * Math.PI * 2),
+    particleDistance: 1,
+    lightnessMin: 13,
+    lightnessMax: 94,
+
+    initialize: function(benchmark)
+    {
+        Stage.prototype.initialize.call(this, benchmark);
+
+        this._template = document.getElementById(&quot;template&quot;);
+        this._offset = this.size.subtract(Point.elementClientSize(this._template)).multiply(.5);
+        this._template.style.left = this._offset.width + &quot;px&quot;;
+        this._template.style.top = this._offset.height + &quot;px&quot;;
+
+        this._stepProgress = 0;
+    },
+
+    tune: function(count)
+    {
+        if (count == 0)
+            return;
+
+        if (count &lt; 0) {
+            this._offsetIndex = Math.max(this._offsetIndex + count, 0);
+            for (var i = this._offsetIndex; i &lt; this.testElements.length; ++i)
+                this.testElements[i].style.visibility = &quot;hidden&quot;;
+
+            this._stepProgress = 1 / this._offsetIndex;
+            return;
+        }
+
+        this._offsetIndex = this._offsetIndex + count;
+        this._stepProgress = 1 / this._offsetIndex;
+
+        var index = Math.min(this._offsetIndex, this.testElements.length);
+        for (var i = 0; i &lt; index; ++i)
+            this.testElements[i].style.visibility = &quot;visible&quot;;
+
+        if (this._offsetIndex &lt;= this.testElements.length)
+            return;
+
+        for (var i = this.testElements.length; i &lt; this._offsetIndex; ++i) {
+            var clone = this._template.cloneNode(true);
+            this.testElements.push(clone);
+            this.element.insertBefore(clone, this.element.firstChild);
+        }
+    },
+
+    animate: function(timeDelta) {
+        var angle = Stage.dateCounterValue(this.millisecondsPerRotation);
+
+        var x = 0;
+        var y = 0;
+        var progress = 0;
+        var stepX = Math.sin(angle) * this.particleDistance;
+        var stepY = Math.cos(angle) * this.particleDistance;
+        for (var i = 0; i &lt; this._offsetIndex; ++i) {
+            x += stepX;
+            y += stepY;
+
+            var element = this.testElements[i];
+
+            var colorProgress = this.shadowFalloff.solve(progress);
+            var shimmer = Math.sin(Stage.dateCounterValue(100) - colorProgress);
+            colorProgress += Utilities.lerp(shimmer, this.shimmerAverage, this.shimmerMax);
+            var interpolatedLightness = Math.round(Utilities.lerp(Math.max(Math.min(colorProgress, 1), 0), this.lightnessMin, this.lightnessMax));
+
+            element.style.color = &quot;hsl(0,0%,&quot; + interpolatedLightness + &quot;%)&quot;;
+            element.style.transform = &quot;translateX(&quot; + Math.floor(y) + &quot;px) translateY(&quot; + Math.floor(x) + &quot;px)&quot;;
+
+            progress += this._stepProgress;
+        }
+    },
+
+    complexity: function()
+    {
+        return 1 + this._offsetIndex;
+    }
+});
+
+var TextBenchmark = Utilities.createSubclass(Benchmark,
+    function(options)
+    {
+        Benchmark.call(this, new TextStage(), options);
+    }
+);
+
+window.benchmarkClass = TextBenchmark;
+
+}());
</ins></span></pre></div>
<a id="trunkPerformanceTestsAnimometertestsmastertexthtml"></a>
<div class="addfile"><h4>Added: trunk/PerformanceTests/Animometer/tests/master/text.html (0 => 197908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/Animometer/tests/master/text.html                                (rev 0)
+++ trunk/PerformanceTests/Animometer/tests/master/text.html        2016-03-10 01:37:35 UTC (rev 197908)
</span><span class="lines">@@ -0,0 +1,34 @@
</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 type=&quot;text/css&quot;&gt;
+
+        #stage {
+            font-family: Helvetica;
+            font-size: 48px;
+        }
+        #stage div {
+            width: 21em;
+            position: absolute;
+        }
+        #template {
+            color: #111;
+        }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div id=&quot;stage&quot;&gt;
+        &lt;div id=&quot;template&quot;&gt;
+            Whenever the black fox jumped the squirrel gazed suspiciously. Amazingly few discotheques provide jukeboxes.
+        &lt;/div&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;resources/text.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkPerformanceTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/ChangeLog (197907 => 197908)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/ChangeLog        2016-03-10 01:35:18 UTC (rev 197907)
+++ trunk/PerformanceTests/ChangeLog        2016-03-10 01:37:35 UTC (rev 197908)
</span><span class="lines">@@ -1,5 +1,31 @@
</span><span class="cx"> 2016-03-09  Jon Lee  &lt;jonlee@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Add text tests
+        https://bugs.webkit.org/show_bug.cgi?id=155257
+
+        Reviewed by Simon Fraser.
+
+        * Animometer/resources/extensions.js:
+        (UnitBezier.Utilities.createClass): Add a class that computes Bezier points
+        assuming that two of the control points are at (0,0) and (1,1). Taken from
+        WebCore/platform/graphics/UnitBezier.h
+        * Animometer/resources/runner/tests.js: Add a test for English text and one
+        for international text.
+        * Animometer/tests/master/international.html: Added.
+        * Animometer/tests/master/resources/text.js: Added. The test assumes there is
+        #template div which it will copy. The copies are placed behind the template, and
+        are set with different colors each frame. They are moved around with CSS transform.
+        * Animometer/tests/master/text.html: Added.
+
+        Remove the other text tests, since these ones cover the same techniques.
+        * Animometer/tests/text/layering-text.html: Removed.
+        * Animometer/tests/text/resources/layering-text.js: Removed.
+        * Animometer/tests/text/resources/text-boxes.js: Removed.
+        * Animometer/tests/text/text-boxes.html: Removed.
+        * Animometer/resources/debug-runner/tests.js:
+
+2016-03-09  Jon Lee  &lt;jonlee@apple.com&gt;
+
</ins><span class="cx">         Add a new image test
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=155232
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>