From 4079a09bdf9eb75d3c7fc3430aa4455900dceefb Mon Sep 17 00:00:00 2001 From: "commit-queue@webkit.org" Date: Mon, 30 Nov 2015 22:15:27 +0000 Subject: [PATCH] Add an option to select the results form the graphics benchmark https://bugs.webkit.org/show_bug.cgi?id=151666 Patch by Said Abou-Hallawa on 2015-11-30 Reviewed by Ryosuke Niwa. We need an easy way to select the graphics benchmark results table such that when it is copied to the clipboard, rich text format is set to the clipboard. * Animometer/runner/animometer.html: Add a new button to select the results table or JSON. * Animometer/runner/resources/animometer.js: (window.sectionsManager._sectionDataElement): Selects the container element. (window.sectionsManager._sectionDataDivElement): Replace a literal string with a string table entry. (window.sectionsManager.showTestName): Replace a literal string with a string table entry. (window.sectionsManager.selectData): Selects the container element in a selection. (window.sectionsManager.selectDataContents): Select the contents of container element in a selection. (window.benchmarkController.selectResults): Selects the results table. (window.benchmarkController.showJSON): Function rename. (window.benchmarkController.selectJSON): Selects the contents of the results JSON. (window.benchmarkController.showJson): Deleted. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192828 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- PerformanceTests/Animometer/runner/animometer.html | 5 ++- .../Animometer/runner/resources/animometer.js | 43 +++++++++++++++++++--- PerformanceTests/ChangeLog | 24 ++++++++++++ 3 files changed, 66 insertions(+), 6 deletions(-) diff --git a/PerformanceTests/Animometer/runner/animometer.html b/PerformanceTests/Animometer/runner/animometer.html index 6cabb57..8e3924e 100644 --- a/PerformanceTests/Animometer/runner/animometer.html +++ b/PerformanceTests/Animometer/runner/animometer.html @@ -55,7 +55,8 @@
- + +
@@ -67,6 +68,7 @@
+
@@ -79,6 +81,7 @@
+
diff --git a/PerformanceTests/Animometer/runner/resources/animometer.js b/PerformanceTests/Animometer/runner/resources/animometer.js index d3ac8db..82b531f 100644 --- a/PerformanceTests/Animometer/runner/resources/animometer.js +++ b/PerformanceTests/Animometer/runner/resources/animometer.js @@ -58,6 +58,11 @@ window.sectionsManager = { return document.querySelector("#" + sectionIdentifier + " > header > h1"); }, + + _sectionDataElement: function(sectionIdentifier) + { + return document.querySelector("#" + sectionIdentifier + " > data"); + }, _sectionDataDivElement: function(sectionIdentifier) { @@ -70,7 +75,7 @@ window.sectionsManager = element.textContent = title + ":"; var score = benchmarkRunnerClient.score.toFixed(2); - element.textContent += " [Score = " + score + "]"; + element.textContent += " [" + Strings.text.score + " = " + score + "]"; }, showTestName: function(sectionIdentifier, title, testName) @@ -81,7 +86,7 @@ window.sectionsManager = if (!testName.length) return; - element.textContent += " [test = " + testName + "]"; + element.textContent += " [" + Strings.text.testName + " = " + testName + "]"; }, showJSON: function(sectionIdentifier, json) @@ -94,6 +99,24 @@ window.sectionsManager = }, 4); }, + selectData: function(sectionIdentifier) + { + window.getSelection().removeAllRanges(); + var element = this._sectionDataElement(sectionIdentifier); + var range = document.createRange(); + range.selectNode(element); + window.getSelection().addRange(range); + }, + + selectDataContents: function(sectionIdentifier) + { + window.getSelection().removeAllRanges(); + var element = this._sectionDataDivElement(sectionIdentifier); + var range = document.createRange(); + range.selectNodeContents(element); + window.getSelection().addRange(range); + }, + showSection: function(sectionIdentifier, pushState) { var currentSectionElement = document.querySelector("section.selected"); @@ -414,6 +437,11 @@ window.benchmarkController = this._runBenchmark(suites, options); sectionsManager.showSection("running"); }, + + selectResults: function() + { + sectionsManager.selectData("results"); + }, showResults: function() { @@ -421,12 +449,12 @@ window.benchmarkController = sectionsManager.showSection("results", true); }, - showJson: function() + showJSON: function() { sectionsManager.showScore("json", Strings.text.results.results); sectionsManager.showSection("json", true); }, - + showTestGraph: function(testName, axes, samples, samplingTimeOffset) { sectionsManager.showTestName("test-graph", Strings.text.results.graph, testName); @@ -439,7 +467,12 @@ window.benchmarkController = sectionsManager.showTestName("test-json", Strings.text.results.graph, testName); sectionsManager.showJSON("test-json", json); sectionsManager.showSection("test-json", true); - } + }, + + selectJSON: function(sectionIdentifier) + { + sectionsManager.selectDataContents(sectionIdentifier); + }, } window.addEventListener("load", benchmarkController.initialize); diff --git a/PerformanceTests/ChangeLog b/PerformanceTests/ChangeLog index dbc4231..5d13874 100644 --- a/PerformanceTests/ChangeLog +++ b/PerformanceTests/ChangeLog @@ -1,3 +1,27 @@ +2015-11-30 Said Abou-Hallawa + + Add an option to select the results form the graphics benchmark + https://bugs.webkit.org/show_bug.cgi?id=151666 + + Reviewed by Ryosuke Niwa. + + We need an easy way to select the graphics benchmark results table such + that when it is copied to the clipboard, rich text format is set to the + clipboard. + + * Animometer/runner/animometer.html: Add a new button to select the results table or JSON. + + * Animometer/runner/resources/animometer.js: + (window.sectionsManager._sectionDataElement): Selects the container element. + (window.sectionsManager._sectionDataDivElement): Replace a literal string with a string table entry. + (window.sectionsManager.showTestName): Replace a literal string with a string table entry. + (window.sectionsManager.selectData): Selects the container element in a selection. + (window.sectionsManager.selectDataContents): Select the contents of container element in a selection. + (window.benchmarkController.selectResults): Selects the results table. + (window.benchmarkController.showJSON): Function rename. + (window.benchmarkController.selectJSON): Selects the contents of the results JSON. + (window.benchmarkController.showJson): Deleted. + 2015-11-20 Simon Fraser Animometer: graphs should not do interpolation -- 1.8.3.1