Bug 1288761 part 2 - Add perf reftest for bidi resolution. r?rwood,jfkthame draft
authorXidorn Quan <me@upsuper.org>
Thu, 05 Oct 2017 21:14:43 +1100
changeset 676264 9ad1ca9ffc394de4a2f5e9a466468dc827f8fc43
parent 676262 f9eebbda371483667b7acf1c946b38926af44ccd
child 734902 e7d8bdfa1b51e2ab0549429536afdc5b6d1c1529
push id83455
push userxquan@mozilla.com
push dateSat, 07 Oct 2017 01:46:58 +0000
reviewersrwood, jfkthame
bugs1288761
milestone58.0a1
Bug 1288761 part 2 - Add perf reftest for bidi resolution. r?rwood,jfkthame MozReview-Commit-ID: 12GXuPuvDHa
testing/talos/talos/tests/perf-reftest-singletons/bidi-resolution-1.html
testing/talos/talos/tests/perf-reftest-singletons/perf_reftest_singletons.manifest
testing/talos/talos/tests/perf-reftest-singletons/util.js
testing/talos/talos/tests/perf-reftest/bidi-resolution-1-ref.html
testing/talos/talos/tests/perf-reftest/bidi-resolution-1.html
testing/talos/talos/tests/perf-reftest/perf_reftest.manifest
testing/talos/talos/tests/perf-reftest/util.js
new file mode 100644
--- /dev/null
+++ b/testing/talos/talos/tests/perf-reftest-singletons/bidi-resolution-1.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html style="overflow-y: scroll">
+<head>
+<meta charset="UTF-8">
+<script src="util.js"></script>
+<script>
+window.onload = function() {
+  const TEST_WORD = "iqwdzx zzaعظأkvcg rvde";
+  let div = document.getElementById("test");
+
+  div.textContent = TEST_WORD;
+  flush_layout();
+
+  perf_start();
+  div.textContent = build_text(TEST_WORD, 30, 800);
+  flush_layout(div);
+  perf_finish();
+}
+</script>
+</head>
+<body>
+  <div id="test" style="white-space: normal"></div>
+</body>
+</html>
--- a/testing/talos/talos/tests/perf-reftest-singletons/perf_reftest_singletons.manifest
+++ b/testing/talos/talos/tests/perf-reftest-singletons/perf_reftest_singletons.manifest
@@ -8,8 +8,10 @@
 % http://localhost/tests/perf-reftest-singletons/slow-selector-2.html
 % http://localhost/tests/perf-reftest-singletons/style-attr-1.html
 % http://localhost/tests/perf-reftest-singletons/coalesce-1.html
 % http://localhost/tests/perf-reftest-singletons/coalesce-2.html
 % http://localhost/tests/perf-reftest-singletons/parent-basic-singleton.html
 % http://localhost/tests/perf-reftest-singletons/tiny-traversal-singleton.html
 % http://localhost/tests/perf-reftest-singletons/nth-index-1.html
 % http://localhost/tests/perf-reftest-singletons/nth-index-2.html
+
+% http://localhost/tests/perf-reftest-singletons/bidi-resolution-1.html
--- a/testing/talos/talos/tests/perf-reftest-singletons/util.js
+++ b/testing/talos/talos/tests/perf-reftest-singletons/util.js
@@ -29,20 +29,31 @@ function build_dom(n, elemName, options)
 function build_rule(selector, selectorRepeat, declaration, ruleRepeat) {
   ruleRepeat = ruleRepeat || 1;
   var s = document.createElement("style");
   var rule = Array(selectorRepeat).fill(selector).join(", ") + declaration;
   s.textContent = Array(ruleRepeat).fill(rule).join("\n\n");
   return s;
 }
 
+function build_text(word, wordRepeat, paraRepeat) {
+  wordRepeat = wordRepeat || 1;
+  paraRepeat = paraRepeat || 1;
+  let para = Array(wordRepeat).fill(word).join(" ");
+  return Array(paraRepeat).fill(para).join("\n");
+}
+
 function flush_style(element) {
   getComputedStyle(element || document.documentElement).color;
 }
 
+function flush_layout(element) {
+  (element || document.documentElement).offsetHeight;
+}
+
 function perf_start() {
   if (perf_data.start !== null) {
     throw "already started timing!";
   }
 
   perf_data.start = performance.now();
 }
 
new file mode 100644
--- /dev/null
+++ b/testing/talos/talos/tests/perf-reftest/bidi-resolution-1-ref.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html style="overflow-y: scroll">
+<head>
+<meta charset="UTF-8">
+<script src="util.js"></script>
+<script>
+window.onload = function() {
+  const TEST_WORD = "iqwdzx zzaعظأkvcg rvde";
+  let div = document.getElementById("test");
+
+  div.textContent = TEST_WORD;
+  flush_layout();
+
+  perf_start();
+  div.textContent = build_text(TEST_WORD, 30, 800);
+  flush_layout(div);
+  perf_finish();
+}
+</script>
+</head>
+<body>
+  <div id="test" style="white-space: pre-line"></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/talos/talos/tests/perf-reftest/bidi-resolution-1.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html style="overflow-y: scroll">
+<head>
+<meta charset="UTF-8">
+<script src="util.js"></script>
+<script>
+window.onload = function() {
+  const TEST_WORD = "iqwdzx zzaعظأkvcg rvde";
+  let div = document.getElementById("test");
+
+  div.textContent = TEST_WORD;
+  flush_layout();
+
+  perf_start();
+  div.textContent = build_text(TEST_WORD, 30, 800);
+  flush_layout(div);
+  perf_finish();
+}
+</script>
+</head>
+<body>
+  <div id="test" style="white-space: normal"></div>
+</body>
+</html>
--- a/testing/talos/talos/tests/perf-reftest/perf_reftest.manifest
+++ b/testing/talos/talos/tests/perf-reftest/perf_reftest.manifest
@@ -13,8 +13,10 @@
 & http://localhost/tests/perf-reftest/some-descendants-1.html, http://localhost/tests/perf-reftest/some-descendants-1-ref.html
 & http://localhost/tests/perf-reftest/only-children-1.html, http://localhost/tests/perf-reftest/only-children-ref.html
 & http://localhost/tests/perf-reftest/dep-check-1.html, http://localhost/tests/perf-reftest/dep-check-1-ref.html
 & http://localhost/tests/perf-reftest/slow-selector-1.html, http://localhost/tests/perf-reftest/slow-selector-1-ref.html
 & http://localhost/tests/perf-reftest/slow-selector-2.html, http://localhost/tests/perf-reftest/slow-selector-2-ref.html
 & http://localhost/tests/perf-reftest/style-attr-1.html, http://localhost/tests/perf-reftest/style-attr-1-ref.html
 & http://localhost/tests/perf-reftest/stop-cascade-1.html, http://localhost/tests/perf-reftest/stop-cascade-ref.html
 & http://localhost/tests/perf-reftest/stop-cascade-2.html, http://localhost/tests/perf-reftest/stop-cascade-ref.html
+
+& http://localhost/tests/perf-reftest/bidi-resolution-1.html, http://localhost/tests/perf-reftest/bidi-resolution-1-ref.html
--- a/testing/talos/talos/tests/perf-reftest/util.js
+++ b/testing/talos/talos/tests/perf-reftest/util.js
@@ -29,20 +29,31 @@ function build_dom(n, elemName, options)
 function build_rule(selector, selectorRepeat, declaration, ruleRepeat) {
   ruleRepeat = ruleRepeat || 1;
   var s = document.createElement("style");
   var rule = Array(selectorRepeat).fill(selector).join(", ") + declaration;
   s.textContent = Array(ruleRepeat).fill(rule).join("\n\n");
   return s;
 }
 
+function build_text(word, wordRepeat, paraRepeat) {
+  wordRepeat = wordRepeat || 1;
+  paraRepeat = paraRepeat || 1;
+  let para = Array(wordRepeat).fill(word).join(" ");
+  return Array(paraRepeat).fill(para).join("\n");
+}
+
 function flush_style(element) {
   getComputedStyle(element || document.documentElement).color;
 }
 
+function flush_layout(element) {
+  (element || document.documentElement).offsetHeight;
+}
+
 function perf_start() {
   if (perf_data.start !== null) {
     throw "already started timing!";
   }
 
   perf_data.start = performance.now();
 }