Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / PerformanceTests / ShadowDOM / ChangingSelectWithoutShadow.html
blob01ffa60742aabf50676ff192aa36c76910454c31
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script type="text/javascript" src="../resources/runner.js"></script>
5 </head>
6 <body>
8 <div id="wrapper">
9 <h2>Selected</h2>
10 <div id="selected"></div>
11 <h2>NonSelected</h2>
12 <div id="nonselected"></div>
13 </div>
15 <script>
16 var numDivsInHost = 100;
17 var typeNames = ['A', 'B', 'C'];
18 var array = new Array(numDivsInHost);
20 function setup()
22 var nDivs = numDivsInHost;
23 var nonSelected = document.getElementById('nonselected');
25 for (var i = 0; i < nDivs; ++i) {
26 var div = document.createElement('div');
27 div.appendChild(document.createTextNode('div' + i));
28 div.className = typeNames[i % typeNames.length]
29 array[i] = div;
30 nonSelected.appendChild(div);
34 function run()
36 var nDivs = numDivsInHost;
37 var array = window.array;
39 var selected = document.getElementById('selected');
40 var nonSelected = document.getElementById('nonselected');
42 for (var i = 0; i < 100; ++i) {
43 for (var j = 0; j < typeNames.length; ++j) {
44 for (var k = 0; k < nDivs; ++k) {
45 if (array[k].className == typeNames[j])
46 selected.appendChild(array[k]);
47 else
48 nonSelected.appendChild(array[k]);
50 PerfTestRunner.forceLayoutOrFullFrame();
55 function done()
57 wrapper.innerHTML = '';
60 setup();
62 PerfTestRunner.measureTime({
63 description: "Measure distribution and layout performance when we do the almost same thing as select attribute of content element is changed using JavaScript",
64 run: run,
65 done: done
66 });
67 </script>
68 </body>
69 </html>