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
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;
}
}
<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>
justify-content: center;
}
+@media screen and (min-device-width: 1800px) {
+ section {
+ width: 1600px;
+ height: 800px;
+ }
+}
+
/* -------------------------------------------------------------------------- */
/* Home Section */
/* -------------------------------------------------------------------------- */
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);
- }
}
}
{
initialize: function()
{
- sectionsManager.setupSectionStyle();
optionsManager.updateUIFromLocalStorage();
suitesManager.createElements();
suitesManager.updateUIFromLocalStorage();
}
}
-document.addEventListener("DOMContentLoaded", benchmarkController.initialize());
+window.addEventListener("load", benchmarkController.initialize);
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 = [];
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">
this._textItemIndex = 0;
this._colorIndex = 0;
this._animateCounts = 0;
- this._setFontSize();
}
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>",
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];
+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