Use the media queries to dynamically set the stage for the graphics benchmark
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Nov 2015 00:08:38 +0000 (00:08 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Nov 2015 00:08:38 +0000 (00:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151327

Patch by Said Abou-Hallawa <sabouhallawa@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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192549 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/Animometer/resources/extensions.js
PerformanceTests/Animometer/runner/animometer.html
PerformanceTests/Animometer/runner/resources/animometer.css
PerformanceTests/Animometer/runner/resources/animometer.js
PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-particles.js
PerformanceTests/Animometer/tests/text/layering-text.html
PerformanceTests/Animometer/tests/text/resources/layering-text.js
PerformanceTests/ChangeLog

index 999ec92..a62f931 100644 (file)
@@ -160,22 +160,6 @@ window.DocumentExtension =
             
         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;
     }
 }
 
index fe4fc6b..6cabb57 100644 (file)
@@ -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>
index 3c6c91d..789ccd9 100644 (file)
@@ -240,6 +240,13 @@ section > footer {
     justify-content: center;
 }
 
+@media screen and (min-device-width: 1800px) {
+    section {
+        width: 1600px;
+        height: 800px;
+    }
+}
+
 /* -------------------------------------------------------------------------- */
 /*                                 Home Section                               */
 /* -------------------------------------------------------------------------- */
index b875b6b..c6dc658 100644 (file)
@@ -109,30 +109,10 @@ window.sectionsManager =
             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 @@ window.benchmarkController =
 {
     initialize: function()
     {
-        sectionsManager.setupSectionStyle();
         optionsManager.updateUIFromLocalStorage();
         suitesManager.createElements();
         suitesManager.updateUIFromLocalStorage();
@@ -463,4 +442,4 @@ window.benchmarkController =
     }
 }
 
-document.addEventListener("DOMContentLoaded", benchmarkController.initialize());
+window.addEventListener("load", benchmarkController.initialize);
index e8500f3..a271e6a 100644 (file)
@@ -67,7 +67,7 @@ BouncingParticlesAnimator.prototype.constructor = BouncingParticlesAnimator;
 
 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 = [];
index 1f2a33e..d51f303 100644 (file)
@@ -6,9 +6,16 @@
             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="../resources/stage.css">
index 1d64654..f5f2af4 100644 (file)
@@ -6,7 +6,6 @@ function LayeringTextStage(element, options)
     this._textItemIndex = 0;
     this._colorIndex = 0;
     this._animateCounts = 0;
-    this._setFontSize();
 }
 
 LayeringTextStage.textItems = [
@@ -61,7 +60,7 @@ LayeringTextStage.textItems = [
         "</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.colorIndexToTextElementIndex = function(colorIndex)
 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];
index e0eb7f6..413d2f7 100644 (file)
@@ -1,3 +1,31 @@
+2015-11-17  Said Abou-Hallawa  <sabouhallawa@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  <sabouhallawa@apple.com>
 
         Remove the option for animating using setInterval from the graphics benchmark