[CSS Regions] Add performance test for selection
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Nov 2013 09:28:38 +0000 (09:28 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Nov 2013 09:28:38 +0000 (09:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=119230

Reviewed by Ryosuke Niwa.

Add new performance test for selection in CSS Regions. It checks a
selection from the first region to the last one, passing through all the
regions.

Test is skipped for now while implementation of selection in CSS Regions
is still evolving.

* Layout/RegionsSelection.html: Added.
* Layout/resources/regions.js:
(.):
* Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159488 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/ChangeLog
PerformanceTests/Layout/RegionsSelection.html [new file with mode: 0644]
PerformanceTests/Layout/resources/regions.js
PerformanceTests/Skipped

index a5003e81bc703a376fe7c771a098e498d3e16ef3..f687a68db9da2802196a80152442ae06496045b8 100644 (file)
@@ -1,3 +1,22 @@
+2013-11-19  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        [CSS Regions] Add performance test for selection
+        https://bugs.webkit.org/show_bug.cgi?id=119230
+
+        Reviewed by Ryosuke Niwa.
+
+        Add new performance test for selection in CSS Regions. It checks a
+        selection from the first region to the last one, passing through all the
+        regions.
+
+        Test is skipped for now while implementation of selection in CSS Regions
+        is still evolving.
+
+        * Layout/RegionsSelection.html: Added.
+        * Layout/resources/regions.js:
+        (.):
+        * Skipped:
+
 2013-11-18  Ryosuke Niwa  <rniwa@webkit.org>
 
         Simplify and reformat the output of performance tests inside test runners
diff --git a/PerformanceTests/Layout/RegionsSelection.html b/PerformanceTests/Layout/RegionsSelection.html
new file mode 100644 (file)
index 0000000..f098fd9
--- /dev/null
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <link rel="stylesheet" href="resources/regions.css" TYPE="text/css"></link>
+        <script src="../resources/runner.js"></script>
+        <script src="resources/regions.js"></script>
+        <style type="text/css">
+        #log {
+            position: fixed;
+        }
+        </style>
+    </head>
+    <body>
+        <pre id="log"></pre>
+        <script>
+            PerfTestRunner.measureTime(createRegionsSelectionTest(100));
+        </script>
+    </body>
+</html>
index b89e2d77be8a1c1d12fc25d8f4d3aeecd0d52eda..0a1f26405647d68cf7825862b8c02ed74005aebf 100644 (file)
         };
     }
 
+    function mouseMoveToRegionCenter(region) {
+        var rect = region.getBoundingClientRect();
+        eventSender.mouseMoveTo(rect.left + (rect.width / 2), rect.top + (rect.height / 2));
+    }
+
+    function performSelection(regionCount) {
+        var regions = document.getElementsByClassName("region");
+
+        if (window.eventSender) {
+            mouseMoveToRegionCenter(regions[0]);
+            eventSender.mouseDown();
+
+            for (var i = 1; i < regionCount; i++)
+                mouseMoveToRegionCenter(regions[i]);
+
+            eventSender.mouseUp();
+        }
+    }
+
+    function createRegionsSelectionTest(regionCount) {
+        var article = createArticle(regionCount, 1);
+        article.className = "articleInFlow";
+        var regions = createRegions("600px", "auto", regionCount, "auto");
+        document.body.appendChild(article);
+        document.body.appendChild(regions);
+        return {
+            description: "Testing selection with " + regionCount + " regions. Select text from first region to last one passing through all the regions.",
+            run: function() {
+                performSelection(regionCount);
+            },
+            setup: function() {
+                window.getSelection().removeAllRanges();
+            },
+            done: function() {
+                document.body.removeChild(article);
+                document.body.removeChild(regions);
+                templateParagraph = null;
+                templateRegion = null;
+            }
+        };
+    }
+
     window.createRegionsTest = createRegionsTest;
+    window.createRegionsSelectionTest = createRegionsSelectionTest;
+
 })();
index eeccec3c8906f6eaabafc2b02588a0fab06b5533..64b75134362083298b33353e9fd16031644d414b 100644 (file)
@@ -80,6 +80,7 @@ Layout/RegionsAuto.html
 Layout/RegionsAutoMaxHeight.html
 Layout/RegionsFixed.html
 Layout/RegionsFixedShort.html
+Layout/RegionsSelection.html
 
 # https://bugs.webkit.org/show_bug.cgi?id=113811#c2
 Layout/LineLayoutJapanese.html