Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / PerformanceTests / ShadowDOM / ChangingSelect.html
blob76dfc2af9c273765032f59a8d1925bf4e52e107f
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 <div id="host"></div>
10 </div>
12 <script>
13 var numDivsInHost = 100;
14 var typeNames = ['A', 'B', 'C'];
15 var array = new Array(numDivsInHost);
17 function setup()
19 var nDivs = numDivsInHost;
21 window.shadowRoot = host.createShadowRoot();
22 shadowRoot.innerHTML = '<h2>Selected</h2><div id="selected"><content select=".selected"></content></div><h2>NonSelected</h2><div id="nonselected"><content></content></div>';
24 for (var i = 0; i < nDivs; ++i) {
25 var div = document.createElement('div');
26 div.appendChild(document.createTextNode('div' + i));
27 div.className = typeNames[i % typeNames.length];
28 host.appendChild(div);
29 array[i] = div;
33 function run()
35 var nDivs = numDivsInHost;
36 var array = window.array;
38 var selected = shadowRoot.getElementById('selected');
39 var nonSelected = shadowRoot.getElementById('nonselected');
40 var contentSelected = selected.querySelector('content');
42 for (var i = 0; i < 100; ++i) {
43 for (var j = 0; j < typeNames.length; ++j) {
44 contentSelected.select = '.' + typeNames[j];
45 PerfTestRunner.forceLayoutOrFullFrame();
50 function done()
52 wrapper.innerHTML = '';
56 setup();
58 PerfTestRunner.measureTime({
59 description: "Measure distribution and layout performance when select attribute is changed",
60 run: run,
61 done: done
62 });
63 </script>
64 </body>
65 </html>