Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / PerformanceTests / Layout / RegionsSelection.html
1 <!DOCTYPE html>
2 <html>
3     <head>
4         <link rel="stylesheet" href="resources/regions.css" type="text/css"></link>
5         <script src="../resources/runner.js"></script>
6         <script src="resources/regions.js"></script>
7         <style type="text/css">
8         #log {
9             position: fixed;
10         }
11         </style>
12     </head>
13     <body>
14         <pre id="log"></pre>
15         <script>
16             function performSelection(paragraphCount) {
17                 var paragraphs = document.getElementsByClassName("contentParagraph");
18                 var selection = getSelection();
19
20                 selection.collapse(paragraphs[0], 0);
21
22                 for (var i = 1; i < paragraphCount; i++)
23                     selection.extend(paragraphs[i], 0);
24             }
25
26             function createRegionsSelectionTest(regionCount) {
27                 var article = createArticle(regionCount, 1);
28                 article.className = "articleInFlow";
29                 var regions = createRegions("600px", "auto", regionCount, "auto");
30                 document.body.appendChild(article);
31                 document.body.appendChild(regions);
32                 return {
33                     description: "Testing selection with " + regionCount + " regions. Select text from first region to last one passing through all the regions.",
34                     run: function() {
35                         performSelection(regionCount);
36                     },
37                     setup: function() {
38                         window.getSelection().removeAllRanges();
39                     },
40                     done: function() {
41                         document.body.removeChild(article);
42                         document.body.removeChild(regions);
43                         templateParagraph = null;
44                         templateRegion = null;
45                     }
46                 };
47             }
48
49             PerfTestRunner.measureTime(createRegionsSelectionTest(100));
50         </script>
51     </body>
52 </html>