Title: [192549] trunk/PerformanceTests
Revision
192549
Author
commit-qu...@webkit.org
Date
2015-11-17 16:08:38 -0800 (Tue, 17 Nov 2015)

Log Message

Use the media queries to dynamically set the stage for the graphics benchmark
https://bugs.webkit.org/show_bug.cgi?id=151327

Patch by Said Abou-Hallawa <sabouhall...@apple.com> on 2015-11-17
Reviewed by Simon Fraser.

Clean setting the benchmark css rules by using the media queries. Accessing
document.stylesheets.cssRules seems to be unreliable. Fix the test harness
load event listener invocation. And also remove the options for normalizing
the stage resolution for retina display.

* Animometer/resources/extensions.js:
(window.DocumentExtension.insertCssRuleAfter): Deleted.
* Animometer/runner/animometer.html:
* Animometer/runner/resources/animometer.css:
(@media screen and (min-device-width: 1800px)):
* Animometer/runner/resources/animometer.js:
(window.sectionsManager.setupRunningSectionStyle):
(window.benchmarkController.initialize):
(window.sectionsManager.setupSectionStyle): Deleted.
* Animometer/tests/bouncing-particles/resources/bouncing-particles.js:
(BouncingParticlesStage):
* Animometer/tests/text/layering-text.html:
* Animometer/tests/text/resources/layering-text.js:
(LayeringTextStage):
(LayeringTextStage.prototype._setFontSize): Deleted.

Modified Paths

Diff

Modified: trunk/PerformanceTests/Animometer/resources/extensions.js (192548 => 192549)


--- trunk/PerformanceTests/Animometer/resources/extensions.js	2015-11-18 00:07:34 UTC (rev 192548)
+++ trunk/PerformanceTests/Animometer/resources/extensions.js	2015-11-18 00:08:38 UTC (rev 192549)
@@ -160,22 +160,6 @@
             
         parentElement.appendChild(element);
         return element;
-    },
-    
-    insertCssRuleAfter: function(newRule, referenceRule)
-    {
-        var styleSheets = document.styleSheets;
-
-        for (var i = 0; i < styleSheets.length; ++i) {       
-            for (var j = 0; j < styleSheets[i].cssRules.length; ++j) {
-                if (styleSheets[i].cssRules[j].selectorText == referenceRule) {
-                    styleSheets[i].insertRule(newRule, j + 1);
-                    return true;
-                }
-            }
-        }
-        
-        return false;
     }
 }
 

Modified: trunk/PerformanceTests/Animometer/runner/animometer.html (192548 => 192549)


--- trunk/PerformanceTests/Animometer/runner/animometer.html	2015-11-18 00:07:34 UTC (rev 192548)
+++ trunk/PerformanceTests/Animometer/runner/animometer.html	2015-11-18 00:08:38 UTC (rev 192549)
@@ -32,7 +32,6 @@
                 <label><input id="estimated-frame-rate" type="checkbox" checked> Estimated Frame Rate</label><br>
                 <label><input id="fix-test-complexity" type="checkbox"> Fix test complexity after warmup</label><br>
                 <label><input id="show-running-results" type="checkbox"> Show running results</label><br>
-                <label><input id="normalize-for-device-scale-factor" type="checkbox"> Normalize for device scale factor</label><br>
                 <label><input id="adaptive-test" type="checkbox" checked _onchange_="benchmarkController.onChangeAdaptiveTestCheckbox()"> Adaptive test</label>
             </options>
             <footer>

Modified: trunk/PerformanceTests/Animometer/runner/resources/animometer.css (192548 => 192549)


--- trunk/PerformanceTests/Animometer/runner/resources/animometer.css	2015-11-18 00:07:34 UTC (rev 192548)
+++ trunk/PerformanceTests/Animometer/runner/resources/animometer.css	2015-11-18 00:08:38 UTC (rev 192549)
@@ -240,6 +240,13 @@
     justify-content: center;
 }
 
+@media screen and (min-device-width: 1800px) {
+    section {
+        width: 1600px;
+        height: 800px;
+    }
+}
+
 /* -------------------------------------------------------------------------- */
 /*                                 Home Section                               */
 /* -------------------------------------------------------------------------- */

Modified: trunk/PerformanceTests/Animometer/runner/resources/animometer.js (192548 => 192549)


--- trunk/PerformanceTests/Animometer/runner/resources/animometer.js	2015-11-18 00:07:34 UTC (rev 192548)
+++ trunk/PerformanceTests/Animometer/runner/resources/animometer.js	2015-11-18 00:08:38 UTC (rev 192549)
@@ -109,30 +109,10 @@
             history.pushState({section: sectionIdentifier}, document.title);
     },
 
-    setupSectionStyle: function()
-    {
-        if (screen.width >= 1800 && screen.height >= 1000)
-            DocumentExtension.insertCssRuleAfter(" section { width: 1600px; height: 800px; }", "section");
-        else
-            DocumentExtension.insertCssRuleAfter(" section { width: 800px; height: 600px; }", "section");
-    },
-    
     setupRunningSectionStyle: function(options)
     {
         if (!options["show-running-results"])
             document.getElementById("record").style.display = "none";
-
-        if (options["normalize-for-device-scale-factor"] && window.devicePixelRatio != 1) {
-            var percentage = window.devicePixelRatio * 100;
-            var rule = "section#running > #running-test > iframe";
-            var newRule = rule;
-            newRule += " { ";
-            newRule += "width: " + percentage + "%; ";
-            newRule += "height: " + percentage + "%; ";
-            newRule += "transform: scale(" + 100 / percentage + ") translate(" + (100 - percentage) / 2 + "%," + (100 - percentage) / 2 + "%);";
-            newRule += " }";
-            DocumentExtension.insertCssRuleAfter(newRule, rule);
-        }
     }
 }
 
@@ -407,7 +387,6 @@
 {
     initialize: function()
     {
-        sectionsManager.setupSectionStyle();
         optionsManager.updateUIFromLocalStorage();
         suitesManager.createElements();
         suitesManager.updateUIFromLocalStorage();
@@ -463,4 +442,4 @@
     }
 }
 
-document.addEventListener("DOMContentLoaded", benchmarkController.initialize());
+window.addEventListener("load", benchmarkController.initialize);

Modified: trunk/PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-particles.js (192548 => 192549)


--- trunk/PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-particles.js	2015-11-18 00:07:34 UTC (rev 192548)
+++ trunk/PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-particles.js	2015-11-18 00:08:38 UTC (rev 192549)
@@ -67,7 +67,7 @@
 
 function BouncingParticlesStage(element, options)
 {
-    Stage.call(this, element);
+    Stage.call(this, element, options);
     
     this.particleSize = new Point(parseInt(options["particleWidth"]) || 10, parseInt(options["particleHeight"]) || 10);
     this._particles = [];

Modified: trunk/PerformanceTests/Animometer/tests/text/layering-text.html (192548 => 192549)


--- trunk/PerformanceTests/Animometer/tests/text/layering-text.html	2015-11-18 00:07:34 UTC (rev 192548)
+++ trunk/PerformanceTests/Animometer/tests/text/layering-text.html	2015-11-18 00:08:38 UTC (rev 192549)
@@ -6,10 +6,17 @@
             position: absolute;
             left: 0px;
             top: 0px;
-            padding: 3px;
+            padding: 0.72em;
             background-color: transparent;
-            line-height: 1.2;
+            line-height: 1.1;
+            font-size: 0.72em;
         }
+        @media screen and (min-device-width: 1800px) {
+            .text-layer {
+                line-height: 1.2;
+                font-size: 0.96em;
+            }
+        }
     </style>  
     <link rel="stylesheet" type="text/css" href=""
     <script src=""

Modified: trunk/PerformanceTests/Animometer/tests/text/resources/layering-text.js (192548 => 192549)


--- trunk/PerformanceTests/Animometer/tests/text/resources/layering-text.js	2015-11-18 00:07:34 UTC (rev 192548)
+++ trunk/PerformanceTests/Animometer/tests/text/resources/layering-text.js	2015-11-18 00:08:38 UTC (rev 192549)
@@ -6,7 +6,6 @@
     this._textItemIndex = 0;
     this._colorIndex = 0;
     this._animateCounts = 0;
-    this._setFontSize();
 }
 
 LayeringTextStage.textItems = [
@@ -61,7 +60,7 @@
         "</ul>",
         "<h3>Open source benchmarks</h3>",
         "<ul>",
-            "<li>AIM Multiuser Benchmark: composed of a list of tests that could be mixed to create a ‘load mix’ that would simulate a specific computer function on any UNIX-type OS.</li>",
+            "<li>AIM Multiuser Benchmark: composed of a list of tests that could be mixed to create a 'load mix' that would simulate a specific computer function on any UNIX-type OS.</li>",
             "<li>Bonnie++: filesystem and hard drive benchmark</li>",
             "<li>BRL-CAD: cross-platform architecture-agnostic benchmark suite based on multithreaded ray tracing performance; baselined against a VAX-11/780; and used since 1984 for evaluating relative CPU performance, compiler differences, optimization levels, coherency, architecture differences, and operating system differences.</li>",
         "</ul>",
@@ -138,14 +137,6 @@
 LayeringTextStage.prototype = Object.create(Stage.prototype);
 LayeringTextStage.prototype.constructor = LayeringTextStage;
 
-LayeringTextStage.prototype._setFontSize = function()
-{
-    var lineHeight = this.size.height / LayeringTextStage.colorableTextItems;
-    var fontHeight = lineHeight / 1.5;
-    var fontSize = fontHeight * 72.0 / 96.0;
-    DocumentExtension.insertCssRuleAfter(".text-layer", ".text-layer { font-size: " + fontSize.toFixed(2) + "px; }");
-}
-
 LayeringTextStage.prototype._nextTextItem = function(textItemFlags)
 {
     var textItem = LayeringTextStage.textItems[this._textItemIndex];

Modified: trunk/PerformanceTests/ChangeLog (192548 => 192549)


--- trunk/PerformanceTests/ChangeLog	2015-11-18 00:07:34 UTC (rev 192548)
+++ trunk/PerformanceTests/ChangeLog	2015-11-18 00:08:38 UTC (rev 192549)
@@ -1,3 +1,31 @@
+2015-11-17  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        Use the media queries to dynamically set the stage for the graphics benchmark
+        https://bugs.webkit.org/show_bug.cgi?id=151327
+
+        Reviewed by Simon Fraser.
+
+        Clean setting the benchmark css rules by using the media queries. Accessing
+        document.stylesheets.cssRules seems to be unreliable. Fix the test harness
+        load event listener invocation. And also remove the options for normalizing
+        the stage resolution for retina display.
+
+        * Animometer/resources/extensions.js:
+        (window.DocumentExtension.insertCssRuleAfter): Deleted.
+        * Animometer/runner/animometer.html:
+        * Animometer/runner/resources/animometer.css:
+        (@media screen and (min-device-width: 1800px)):
+        * Animometer/runner/resources/animometer.js:
+        (window.sectionsManager.setupRunningSectionStyle):
+        (window.benchmarkController.initialize):
+        (window.sectionsManager.setupSectionStyle): Deleted.
+        * Animometer/tests/bouncing-particles/resources/bouncing-particles.js:
+        (BouncingParticlesStage):
+        * Animometer/tests/text/layering-text.html:
+        * Animometer/tests/text/resources/layering-text.js:
+        (LayeringTextStage):
+        (LayeringTextStage.prototype._setFontSize): Deleted.
+
 2015-11-16  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         Remove the option for animating using setInterval from the graphics benchmark
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to