1 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runRepaintAndPixelTest()">
2 <script xlink:href="../../../fast/repaint/resources/text-based-repaint.js"></script>
3 <script type="text/javascript">
4 window.testIsAsync = true;
5 window.outputRepaintRects = false;
6 var start = new Date();
8 <text x="10" y="15" font-weight="900" font-size="5">SVG Performance test.</text>
9 <text x="10" y="95" font-weight="900" font-size="5">Test not started.</text>
10 <rect x="0" y="0" height="100" width="100" stroke="black" fill="none"/>
11 <linearGradient id="gradient">
12 <stop offset="0%" stop-color="#00F" />
13 <stop offset="10%" stop-color="#F60" />
14 <stop offset="90%" stop-color="#FF6" />
15 <stop offset="100%" stop-color="#00F" />
17 <script type="text/javascript"><![CDATA[
18 var svg = document.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'svg')[0];
19 var t = document.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'text')[1];
21 var Xs = new Array(9, 65, 92, 30, 92, 40, 65, 47, 79, 10, 77, 45,
22 27, 13, 43, 52, 55, 46, 1, 24, 42, 11, 15, 18, 42, 49, 50, 30, 69,
23 95, 36, 49, 46, 85, 54, 26, 15, 56, 18, 92, 40, 41, 66, 85, 7, 47,
24 66, 13, 72, 29, 48, 57, 61, 46, 70, 3, 62, 34, 74, 13, 32, 20, 8,
25 2, 60, 97, 58, 1, 0, 89, 85, 48, 52, 98, 12, 26, 5, 5, 48, 19, 22,
26 34, 83, 13, 65, 77, 23, 40, 56, 65, 13, 54, 81, 10, 53, 25, 93,
29 var Ys = new Array(42, 80, 93, 30, 54, 33, 76, 56, 2, 79, 37, 80,
30 80, 19, 99, 31, 89, 22, 23, 42, 27, 81, 26, 19, 80, 6, 62, 67, 73,
31 18, 69, 10, 42, 88, 100, 99, 47, 88, 26, 46, 49, 60, 7, 10, 48, 29,
32 25, 26, 33, 73, 84, 24, 42, 74, 5, 49, 69, 81, 19.5, 67, 10, 53, 79,
33 56, 32, 98, 78, 7, 3, 68, 12, 80, 42, 24, 82, 69, 9, 43, 47, 19,
34 69, 45, 41, 64, 1, 39, 25, 84, 35, 77, 26, 43, 32, 75, 89, 66, 48,
37 var Ss = new Array(5, 3, 1, 3, 1, 8, 8, 7, 8, 5, 1, 4, 4, 2, 1, 2,
38 2, 6, 4, 3, 1, 5, 1, 2, 6, 1, 5, 7, 3, 6, 6, 4, 7, 2, 5, 3, 5, 3,
39 5, 2, 8, 1, 2, 1, 6, 4, 3, 2, 4, 8, 3, 5, 8, 8, 2, 2, 2, 8, 5, 6,
40 4, 8, 5, 3, 6, 2, 3, 2, 3, 6, 3, 5, 8, 7, 2, 4, 8, 8, 6, 4, 6, 1,
41 8, 6, 7, 4, 7, 8, 3, 7, 7, 8, 4, 2, 2, 8, 2, 8, 7, 3);
43 var Rs = new Array(157, 142, 37, 13, 349, 83, 158, 214, 34, 353,
44 196, 29, 296, 225, 124, 355, 68, 305, 315, 190, 146, 274, 167,
45 132, 298, 272, 266, 265, 28, 213, 99, 260, 323, 233, 111, 270,
46 165, 177, 58, 350, 322, 137, 163, 80, 206, 138, 20, 355, 32, 310,
47 309, 260, 153, 309, 151, 189, 52, 170, 326, 157, 65, 41, 28, 92,
48 96, 196, 250, 313, 125, 226, 63, 245, 158, 196, 7, 169, 96, 224,
49 222, 273, 37, 26, 331, 302, 57, 55, 171, 347, 319, 54, 83, 189,
50 281, 79, 75, 138, 223, 138, 238, 69);
54 var maxPerBlock = Xs.length / (idealTime / delay);
55 var maxBlocks = Xs.length / maxPerBlock;
57 function repaintTest() {
58 for (var subcount = 0; subcount < maxPerBlock; subcount += 1) {
59 var index = count * maxPerBlock + subcount;
60 var newI = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
61 newI.setAttribute('x', Xs[index] - (99 / Ss[index]) / 2);
62 newI.setAttribute('y', Ys[index] - (195 / Ss[index]) / 2);
63 newI.setAttribute('height', 195 / Ss[index]);
64 newI.setAttribute('width', 99 / Ss[index]);
65 newI.setAttribute('fill', 'url(#gradient)');
66 newI.setAttribute('transform', 'translate(50, 50) rotate(' + Rs[index] + ') translate(-50, -50)');
67 newI.appendChild(document.createTextNode(index));
68 svg.insertBefore(newI, t);
71 if (count < maxBlocks) {
72 window.setTimeout(repaintTest, delay);
73 t.firstChild.data = 'Test in progress... ' + count + ' of ' + maxBlocks;
75 if (window.testRunner)
76 t.firstChild.data = 'Test completed';
79 var elapsed = (end - start) / 1000;
80 t.firstChild.data = 'Test completed in ' + elapsed.toFixed(2) + 's.';
81 if (parent.reportResults) parent.reportResults(end - start);