Add coordinate space to event streams and streamline tests
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Dec 2016 01:14:40 +0000 (01:14 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Dec 2016 01:14:40 +0000 (01:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=165119

Patch by Megan Gardner <megan_gardner@apple.com> on 2016-12-15
Reviewed by Simon Fraser.

Tools:

Update event streams to allow for both content and global coordinate space.
Update example script to more accurately show all the available options.

* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* WebKitTestRunner/ios/HIDEventGenerator.h:
* WebKitTestRunner/ios/HIDEventGenerator.mm:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::convertCoordinates):
(WTR::UIScriptController::sendEventStream):

LayoutTests:

Streamline tests. Make them more readable and only use one function for drags.
Update for new content coordinate space.

* fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html:
* fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html:

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

LayoutTests/ChangeLog
LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html
LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html
Tools/ChangeLog
Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
Tools/WebKitTestRunner/ios/HIDEventGenerator.h
Tools/WebKitTestRunner/ios/HIDEventGenerator.mm
Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm

index c85b3bb..c3daf7f 100644 (file)
@@ -1,3 +1,16 @@
+2016-12-15  Megan Gardner  <megan_gardner@apple.com>
+
+        Add coordinate space to event streams and streamline tests
+        https://bugs.webkit.org/show_bug.cgi?id=165119
+
+        Reviewed by Simon Fraser.
+
+        Streamline tests. Make them more readable and only use one function for drags.
+        Update for new content coordinate space.
+
+        * fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html:
+        * fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html:
+
 2016-12-15  Ryan Haddad  <ryanhaddad@apple.com>
 
         Marking js/dom/global-constructors-attributes.html as failing on ElCapitan WK1.
index cdb9d32..b7b2546 100644 (file)
@@ -17,8 +17,8 @@
                 });
             })();`
         }
-    
-        function getDragDownOneScript()
+
+        function getDragScript(startX, startY, endX, endY)
         {
             return `
             (function() {
@@ -27,6 +27,7 @@
                 {
                 interpolate : "linear",
                 timestep: 0.1,
+                coordinateSpace : "global",
                 startEvent : {
                     inputType : "hand",
                     timeOffset : 0,
@@ -35,8 +36,8 @@
                         inputType : "finger",
                         phase : "began",
                         id : 1,
-                        x : 72,
-                        y : 140,
+                        x : ${startX},
+                        y : ${startY},
                         pressure : 0
                         }
                     ]
@@ -49,8 +50,8 @@
                         inputType : "finger",
                         phase : "moved",
                         id : 1,
-                        x : 72,
-                        y : 150,
+                        x : ${endX},
+                        y : ${endY},
                         pressure : 0
                         }
                     ]
                 uiController.uiScriptComplete();
             })();`
         }
-    
-        function getDragDownTwoScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : "linear",
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : "hand",
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "began",
-                         id : 1,
-                         x : 72,
-                         y : 150,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : "hand",
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "moved",
-                         id : 1,
-                         x : 72,
-                         y : 170,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
-        function getDragUpOneScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : "linear",
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : "hand",
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "began",
-                         id : 1,
-                         x : 72,
-                         y : 170,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : "hand",
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "moved",
-                         id : 1,
-                         x : 72,
-                         y : 150,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
-        function getDragUpTwoScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : "linear",
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : "hand",
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "began",
-                         id : 1,
-                         x : 72,
-                         y : 150,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : "hand",
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "moved",
-                         id : 1,
-                         x : 72,
-                         y : 135,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
-        function getDragUpPastScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : "linear",
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : "hand",
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "began",
-                         id : 1,
-                         x : 72,
-                         y : 140,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : "hand",
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "moved",
-                         id : 1,
-                         x : 72,
-                         y : 100,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
 
         function runTest()
         {
                         output += 'FAIL: failed to select a word as a result of a long press';
                     output += '<br>';
 
-                    testRunner.runUIScript(getDragDownOneScript(), function(result) {
+                    testRunner.runUIScript(getDragScript(72, 120, 72, 140), function(result) {
                         if (document.getSelection().toString() == "Ut enim ad minim veniam, q")
                             output += 'PASS: Correct Selection';
                         else
                             output += 'FAIL: failed to select additional line after a drag.'
                         output += '<br>';
                                           
-                        testRunner.runUIScript(getDragDownTwoScript(), function(result) {
+                        testRunner.runUIScript(getDragScript(72, 140, 72, 160), function(result) {
                             if (document.getSelection().toString() == "Ut enim ad minim veniam, quis nostrud exercitati")
                                 output += 'PASS: Correct Selection';
                             else
                                 output += 'FAIL: failed to select additional line after a drag.'
                             output += '<br>';
 
-                            testRunner.runUIScript(getDragUpOneScript(), function(result) {
+                            testRunner.runUIScript(getDragScript(72, 160, 72, 140), function(result) {
                                 if (document.getSelection().toString() == "Ut enim ad minim veniam, q")
                                     output += 'PASS: Correct Selection';
                                 else
                                     output += 'FAIL: failed to deselect line after a drag.'
                                 output += '<br>';
 
-                                testRunner.runUIScript(getDragUpTwoScript(), function(result) {
+                                testRunner.runUIScript(getDragScript(72, 140, 72, 115), function(result) {
                                     if (document.getSelection().toString() == "Ut")
                                         output += 'PASS: Correct Selection';
                                     else
                                         output += 'FAIL: failed to deselect line after a drag.'
                                     output += '<br>';
                             
-                                    testRunner.runUIScript(getDragUpPastScript(), function(result) {
+                                    testRunner.runUIScript(getDragScript(72, 115, 72, 80), function(result) {
                                         if (document.getSelection().toString() == "U")
                                             output += 'PASS: Correct Selection';
                                         else
index 7152adf..7335309 100644 (file)
@@ -18,7 +18,7 @@
             })();`
         }
     
-        function getDragUpOneScript()
+        function getDragScript(startX, startY, endX, endY)
         {
             return `
             (function() {
@@ -27,6 +27,7 @@
                 {
                 interpolate : "linear",
                 timestep: 0.1,
+                coordinateSpace : "content",
                 startEvent : {
                     inputType : "hand",
                     timeOffset : 0,
@@ -35,8 +36,8 @@
                         inputType : "finger",
                         phase : "began",
                         id : 1,
-                        x : 56,
-                        y : 109,
+                        x : ${startX},
+                        y : ${startY},
                         pressure : 0
                         }
                     ]
@@ -49,8 +50,8 @@
                         inputType : "finger",
                         phase : "moved",
                         id : 1,
-                        x : 56,
-                        y : 103,
+                        x : ${endX},
+                        y : ${endY},
                         pressure : 0
                         }
                     ]
             })();`
         }
     
-        function getDragUpTwoScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : "linear",
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : "hand",
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "began",
-                         id : 1,
-                         x : 56,
-                         y : 103,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : "hand",
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "moved",
-                         id : 1,
-                         x : 56,
-                         y : 84,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
-        function getDragDownOneScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : "linear",
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : "hand",
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "began",
-                         id : 1,
-                         x : 56,
-                         y : 84,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : "hand",
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "moved",
-                         id : 1,
-                         x : 56,
-                         y : 103,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
-        function getDragDownTwoScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : "linear",
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : "hand",
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "began",
-                         id : 1,
-                         x : 56,
-                         y : 103,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : "hand",
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "moved",
-                         id : 1,
-                         x : 56,
-                         y : 112,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
-        function getDragDownPastScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : "linear",
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : "hand",
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "began",
-                         id : 1,
-                         x : 56,
-                         y : 112,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : "hand",
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : "finger",
-                         phase : "moved",
-                         id : 1,
-                         x : 56,
-                         y : 140,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
-
         function runTest()
         {
             if (!testRunner.runUIScript)
                         output += 'FAIL: failed to select a word as a result of a long press';
                     output += '<br>';
 
-                    testRunner.runUIScript(getDragUpOneScript(), function(result) {
+                    testRunner.runUIScript(getDragScript(56, 89, 56, 74), function(result) {
                         if (document.getSelection().toString() == "e et dolore magna aliqua. Ut")
                             output += 'PASS: Correct Selection';
                         else
                             output += 'FAIL: failed to select additional line after a drag.' + document.getSelection().toString()
                         output += '<br>';
                                           
-                        testRunner.runUIScript(getDragUpTwoScript(), function(result) {
+                        testRunner.runUIScript(getDragScript(56, 74, 56, 55), function(result) {
                             if (document.getSelection().toString() == "mod tempor incididunt ut labore et dolore magna aliqua. Ut")
                                 output += 'PASS: Correct Selection';
                             else
                                 output += 'FAIL: failed to select additional line after a drag.' + document.getSelection().toString()
                             output += '<br>';
 
-                            testRunner.runUIScript(getDragDownOneScript(), function(result) {
+                            testRunner.runUIScript(getDragScript(56, 55, 56, 74), function(result) {
                                 if (document.getSelection().toString() == "e et dolore magna aliqua. Ut")
                                     output += 'PASS: Correct Selection';
                                 else
                                     output += 'FAIL: failed to deselect line after a drag.' + document.getSelection().toString()
                                 output += '<br>';
 
-                                testRunner.runUIScript(getDragDownTwoScript(), function(result) {
+                                testRunner.runUIScript(getDragScript(56, 74, 56, 92), function(result) {
                                     if (document.getSelection().toString() == "Ut")
                                         output += 'PASS: Correct Selection';
                                     else
                                         output += 'FAIL: failed to deselect line after a drag.' + document.getSelection().toString()
                                     output += '<br>';
                             
-                                    testRunner.runUIScript(getDragDownPastScript(), function(result) {
+                                    testRunner.runUIScript(getDragScript(56, 92, 56, 120), function(result) {
                                         if (document.getSelection().toString() == "t")
                                             output += 'PASS: Correct Selection';
                                         else
                                         output += '<br>';
                                         output += result;
                                         document.getElementById('target').innerHTML = output;
-                                        //testRunner.notifyDone();
+                                        testRunner.notifyDone();
                                     });
                                 });
                             });
index 56f5fce..895b8e0 100644 (file)
@@ -1,3 +1,20 @@
+2016-12-15  Megan Gardner  <megan_gardner@apple.com>
+
+        Add coordinate space to event streams and streamline tests
+        https://bugs.webkit.org/show_bug.cgi?id=165119
+
+        Reviewed by Simon Fraser.
+
+        Update event streams to allow for both content and global coordinate space.
+        Update example script to more accurately show all the available options.
+
+        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+        * WebKitTestRunner/ios/HIDEventGenerator.h:
+        * WebKitTestRunner/ios/HIDEventGenerator.mm:
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::convertCoordinates):
+        (WTR::UIScriptController::sendEventStream):
+
 2016-12-15  Claudio Saavedra  <csaavedra@igalia.com>
 
         [GTK] Ensure gst* docs are not built with update-webkitgtk-libs
index 26a25fa..a467c22 100644 (file)
@@ -59,6 +59,7 @@ interface UIScriptController {
     //          {
     //              "inputType" : "hand",
     //              "timeOffset" : 0,
+    //              "coordinateSpace" : "content",
     //              "touches" : [
     //                  {
     //                      "inputType" : "finger",
@@ -69,9 +70,11 @@ interface UIScriptController {
     //                  }
     //              ]
     //          },
+    //          // This is a basic force press
     //          {
     //              "interpolate" : "linear",
     //              "timestep" : 0.025,
+    //              "coordinateSpace" : "global",
     //              "startEvent" : {
     //                  "inputType" : "hand",
     //                  "timeOffset" : 0.025,
@@ -94,23 +97,59 @@ interface UIScriptController {
     //                          "inputType" : "finger",
     //                          "phase" : "stationary",
     //                          "id" : 1,
+    //                          "x" : 100,
+    //                          "y" : 120,
+    //                          "pressure" : 500
+    //                      }
+    //                  ]
+    //              }
+    //          },
+    //          //This is a basic drag
+    //          {
+    //              "interpolate" : "linear",
+    //              "timestep" : 0.025,
+    //              "coordinateSpace" : "content",
+    //              "startEvent" : {
+    //                  "inputType" : "hand",
+    //                  "timeOffset" : 3.025,
+    //                  "touches" : [
+    //                      {
+    //                          "inputType" : "finger",
+    //                          "phase" : "moved",
+    //                          "id" : 1,
+    //                          "x" : 100,
+    //                          "y" : 120,
+    //                          "pressure" : 0
+    //                      }
+    //                  ]
+    //              },
+    //              "endEvent" : {
+    //                  "inputType" : "hand",
+    //                  "timeOffset" : 4.0,
+    //                  "touches" : [
+    //                      {
+    //                          "inputType" : "finger",
+    //                          "phase" : "moved",
+    //                          "id" : 1,
     //                          "x" : 20,
     //                          "y" : 40,
-    //                          "pressure" : 500
+    //                          "pressure" : 0
     //                      }
     //                  ]
     //              }
     //          },
+    //          //ending lift
     //          {
     //              "inputType" : "hand",
-    //              "timeOffset" : 0.002, // seconds relative to the first event
+    //              "timeOffset" : 4.025, // seconds relative to the first event
+    //              "coordinateSpace" : "content",
     //              "touches" : [
     //                  {
     //                      "inputType" : "finger",
     //                      "phase" : "ended",
     //                      "id" : 1,
-    //                      "x" : 100,
-    //                      "y" : 120
+    //                      "x" : 20,
+    //                      "y" : 40
     //                  }
     //              ]
     //          },
index 747c867..f3fbd6c 100644 (file)
 extern NSString* const TopLevelEventInfoKey;
 extern NSString* const HIDEventInputType;
 extern NSString* const HIDEventTimeOffsetKey;
+extern NSString* const HIDEventTouchesKey;
 extern NSString* const HIDEventPhaseKey;
+extern NSString* const HIDEventInterpolateKey;
+extern NSString* const HIDEventTimestepKey;
+extern NSString* const HIDEventCoordinateSpaceKey;
+extern NSString* const HIDEventStartEventKey;
+extern NSString* const HIDEventEndEventKey;
 extern NSString* const HIDEventTouchIDKey;
 extern NSString* const HIDEventPressureKey;
 extern NSString* const HIDEventXKey;
@@ -39,13 +45,19 @@ extern NSString* const HIDEventYKey;
 extern NSString* const HIDEventTwistKey;
 extern NSString* const HIDEventMajorRadiusKey;
 extern NSString* const HIDEventMinorRadiusKey;
-extern NSString* const HIDEventTouchesKey;
 
 // Values for HIDEventInputType.
 extern NSString* const HIDEventInputTypeHand;
 extern NSString* const HIDEventInputTypeFinger;
 extern NSString* const HIDEventInputTypeStylus;
 
+// Values for HIDEventCoordinateSpaceKey.
+extern NSString* const HIDEventCoordinateSpaceTypeGlobal;
+extern NSString* const HIDEventCoordinateSpaceTypeContent;
+
+extern NSString* const HIDEventInterpolationTypeLinear;
+extern NSString* const HIDEventInterpolationTypeSimpleCurve;
+
 // Values for HIDEventPhaseKey.
 extern NSString* const HIDEventPhaseBegan;
 extern NSString* const HIDEventPhaseMoved;
index 30de4ed..1ddb780 100644 (file)
@@ -44,6 +44,7 @@ NSString* const HIDEventTouchesKey = @"touches";
 NSString* const HIDEventPhaseKey = @"phase";
 NSString* const HIDEventInterpolateKey = @"interpolate";
 NSString* const HIDEventTimestepKey = @"timestep";
+NSString* const HIDEventCoordinateSpaceKey = @"coordinateSpace";
 NSString* const HIDEventStartEventKey = @"startEvent";
 NSString* const HIDEventEndEventKey = @"endEvent";
 NSString* const HIDEventTouchIDKey = @"id";
@@ -58,6 +59,9 @@ NSString* const HIDEventInputTypeHand = @"hand";
 NSString* const HIDEventInputTypeFinger = @"finger";
 NSString* const HIDEventInputTypeStylus = @"stylus";
 
+NSString* const HIDEventCoordinateSpaceTypeGlobal = @"global";
+NSString* const HIDEventCoordinateSpaceTypeContent = @"content";
+
 NSString* const HIDEventInterpolationTypeLinear = @"linear";
 NSString* const HIDEventInterpolationTypeSimpleCurve = @"simpleCurve";
 
index cd687a3..794e91a 100644 (file)
@@ -203,13 +203,39 @@ void UIScriptController::stylusTapAtPoint(long x, long y, float azimuthAngle, fl
         m_context->asyncTaskComplete(callbackID);
     }];
 }
+    
+void convertCoordinates(NSMutableDictionary *event)
+{
+    if (event[HIDEventTouchesKey]) {
+        for (NSMutableDictionary *touch in event[HIDEventTouchesKey]) {
+            auto location = globalToContentCoordinates(TestController::singleton().mainWebView()->platformView(), (long)[touch[HIDEventXKey] doubleValue], (long)[touch[HIDEventYKey]doubleValue]);
+            touch[HIDEventXKey] = @(location.x);
+            touch[HIDEventYKey] = @(location.y);
+        }
+    }
+}
 
 void UIScriptController::sendEventStream(JSStringRef eventsJSON, JSValueRef callback)
 {
     unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
 
     String jsonString = eventsJSON->string();
-    auto eventInfo = dynamic_objc_cast<NSDictionary>([NSJSONSerialization JSONObjectWithData:[(NSString *)jsonString dataUsingEncoding:NSUTF8StringEncoding] options:0 error:nil]);
+    auto eventInfo = dynamic_objc_cast<NSDictionary>([NSJSONSerialization JSONObjectWithData:[(NSString *)jsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers | NSJSONReadingMutableLeaves error:nil]);
+    
+    for (NSMutableDictionary *event in eventInfo[TopLevelEventInfoKey]) {
+        if (![event[HIDEventCoordinateSpaceKey] isEqualToString:HIDEventCoordinateSpaceTypeContent])
+            continue;
+        
+        if (event[HIDEventStartEventKey])
+            convertCoordinates(event[HIDEventStartEventKey]);
+        
+        if (event[HIDEventEndEventKey])
+            convertCoordinates(event[HIDEventEndEventKey]);
+        
+        if (event[HIDEventTouchesKey])
+            convertCoordinates(event);
+    }
+    
     if (!eventInfo || ![eventInfo isKindOfClass:[NSDictionary class]]) {
         WTFLogAlways("JSON is not convertible to a dictionary");
         return;