[CSS Regions] Fix Layout/RegionsSelection.html in Mac platform
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Dec 2013 22:35:19 +0000 (22:35 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Dec 2013 22:35:19 +0000 (22:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=124963

Reviewed by Ryosuke Niwa.

Layout/RegionsSelection.html introduced in r159488 was not working in
Mac platform because of it was trying to use mouse events out of the
window dimensions. Use collapse() and extend() methods from Selection
object to solve the issue.

* Layout/resources/regions.js: Use collapse() and extend() instead of
mouse events.

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

PerformanceTests/ChangeLog
PerformanceTests/Layout/resources/regions.js

index c975129..06780de 100644 (file)
@@ -1,3 +1,18 @@
+2013-12-03  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        [CSS Regions] Fix Layout/RegionsSelection.html in Mac platform
+        https://bugs.webkit.org/show_bug.cgi?id=124963
+
+        Reviewed by Ryosuke Niwa.
+
+        Layout/RegionsSelection.html introduced in r159488 was not working in
+        Mac platform because of it was trying to use mouse events out of the
+        window dimensions. Use collapse() and extend() methods from Selection
+        object to solve the issue.
+
+        * Layout/resources/regions.js: Use collapse() and extend() instead of
+        mouse events.
+
 2013-11-27  Ryosuke Niwa  <rniwa@webkit.org>
 
         Build fix after r159805.
index 0a1f264..14faaa8 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");
+    function performSelection(paragraphCount) {
+        var paragraphs = document.getElementsByClassName("contentParagraph");
+        var selection = getSelection();
 
-        if (window.eventSender) {
-            mouseMoveToRegionCenter(regions[0]);
-            eventSender.mouseDown();
+        selection.collapse(paragraphs[0], 0);
 
-            for (var i = 1; i < regionCount; i++)
-                mouseMoveToRegionCenter(regions[i]);
-
-            eventSender.mouseUp();
-        }
+        for (var i = 1; i < paragraphCount; i++)
+            selection.extend(paragraphs[i], 0);
     }
 
     function createRegionsSelectionTest(regionCount) {