summaryrefslogtreecommitdiffstats
path: root/testing/talos/talos/tests/perf-reftest-singletons/svg-text-textLength-1.html
blob: b5e933a0addabe4e710c7c9f4e1f2ca52112b162 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html>
<meta charset="utf-8">
<script src="util.js"></script>
<body>
<svg width="144130" height="20" style="visibility:hidden">
<rect width="144130" height="20" fill="#555"/>
<g fill="#fff" font-family="sans-serif" font-size="110">
<!-- The use of textLength here forces adjusted positioning of all the glyphs,
     which may put the SVG layout engine under some strain -->
<text id="test" x="500" y="140" transform="scale(.1)" textLength="2440730"></text>
</g>
</svg>
<script>
window.onload = function() {
  // "word0 word1 word2 ... word99 " -> 690 chars
  text = "";
  for (i = 0; i < 100; i++) {
    text = text + "word" + i + " ";
  }
  // 6 doublings -> approx 44k chars
  for (i = 0; i < 6; i++) {
    text = text + text;
  }
  // set the text and time how long a reflow takes
  testElem = document.getElementById("test");
  testElem.textContent = text;
  perf_start();
  flush_layout();
  perf_finish();
}
</script>