<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[209892] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/209892">209892</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-12-15 17:14:40 -0800 (Thu, 15 Dec 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add coordinate space to event streams and streamline tests
https://bugs.webkit.org/show_bug.cgi?id=165119

Patch by Megan Gardner &lt;megan_gardner@apple.com&gt; 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:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfasteventstouchioslongpressthendragdowntochangeselectedtexthtml">trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html</a></li>
<li><a href="#trunkLayoutTestsfasteventstouchioslongpressthendraguptochangeselectedtexthtml">trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestRunnerSharedUIScriptContextBindingsUIScriptControlleridl">trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosHIDEventGeneratorh">trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.h</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosHIDEventGeneratormm">trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm">trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (209891 => 209892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-12-16 01:06:02 UTC (rev 209891)
+++ trunk/LayoutTests/ChangeLog        2016-12-16 01:14:40 UTC (rev 209892)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-12-15  Megan Gardner  &lt;megan_gardner@apple.com&gt;
+
+        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:
+
</ins><span class="cx"> 2016-12-15  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Marking js/dom/global-constructors-attributes.html as failing on ElCapitan WK1.
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventstouchioslongpressthendragdowntochangeselectedtexthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html (209891 => 209892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html        2016-12-16 01:06:02 UTC (rev 209891)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-down-to-change-selected-text.html        2016-12-16 01:14:40 UTC (rev 209892)
</span><span class="lines">@@ -17,8 +17,8 @@
</span><span class="cx">                 });
</span><span class="cx">             })();`
</span><span class="cx">         }
</span><del>-    
-        function getDragDownOneScript()
</del><ins>+
+        function getDragScript(startX, startY, endX, endY)
</ins><span class="cx">         {
</span><span class="cx">             return `
</span><span class="cx">             (function() {
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx">                 {
</span><span class="cx">                 interpolate : &quot;linear&quot;,
</span><span class="cx">                 timestep: 0.1,
</span><ins>+                coordinateSpace : &quot;global&quot;,
</ins><span class="cx">                 startEvent : {
</span><span class="cx">                     inputType : &quot;hand&quot;,
</span><span class="cx">                     timeOffset : 0,
</span><span class="lines">@@ -35,8 +36,8 @@
</span><span class="cx">                         inputType : &quot;finger&quot;,
</span><span class="cx">                         phase : &quot;began&quot;,
</span><span class="cx">                         id : 1,
</span><del>-                        x : 72,
-                        y : 140,
</del><ins>+                        x : ${startX},
+                        y : ${startY},
</ins><span class="cx">                         pressure : 0
</span><span class="cx">                         }
</span><span class="cx">                     ]
</span><span class="lines">@@ -49,8 +50,8 @@
</span><span class="cx">                         inputType : &quot;finger&quot;,
</span><span class="cx">                         phase : &quot;moved&quot;,
</span><span class="cx">                         id : 1,
</span><del>-                        x : 72,
-                        y : 150,
</del><ins>+                        x : ${endX},
+                        y : ${endY},
</ins><span class="cx">                         pressure : 0
</span><span class="cx">                         }
</span><span class="cx">                     ]
</span><span class="lines">@@ -61,179 +62,6 @@
</span><span class="cx">                 uiController.uiScriptComplete();
</span><span class="cx">             })();`
</span><span class="cx">         }
</span><del>-    
-        function getDragDownTwoScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : &quot;linear&quot;,
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;began&quot;,
-                         id : 1,
-                         x : 72,
-                         y : 150,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;moved&quot;,
-                         id : 1,
-                         x : 72,
-                         y : 170,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
-        function getDragUpOneScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : &quot;linear&quot;,
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;began&quot;,
-                         id : 1,
-                         x : 72,
-                         y : 170,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;moved&quot;,
-                         id : 1,
-                         x : 72,
-                         y : 150,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
-        function getDragUpTwoScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : &quot;linear&quot;,
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;began&quot;,
-                         id : 1,
-                         x : 72,
-                         y : 150,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;moved&quot;,
-                         id : 1,
-                         x : 72,
-                         y : 135,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
-        function getDragUpPastScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : &quot;linear&quot;,
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;began&quot;,
-                         id : 1,
-                         x : 72,
-                         y : 140,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;moved&quot;,
-                         id : 1,
-                         x : 72,
-                         y : 100,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
</del><span class="cx"> 
</span><span class="cx">         function runTest()
</span><span class="cx">         {
</span><span class="lines">@@ -251,7 +79,7 @@
</span><span class="cx">                         output += 'FAIL: failed to select a word as a result of a long press';
</span><span class="cx">                     output += '&lt;br&gt;';
</span><span class="cx"> 
</span><del>-                    testRunner.runUIScript(getDragDownOneScript(), function(result) {
</del><ins>+                    testRunner.runUIScript(getDragScript(72, 120, 72, 140), function(result) {
</ins><span class="cx">                         if (document.getSelection().toString() == &quot;Ut enim ad minim veniam, q&quot;)
</span><span class="cx">                             output += 'PASS: Correct Selection';
</span><span class="cx">                         else
</span><span class="lines">@@ -258,7 +86,7 @@
</span><span class="cx">                             output += 'FAIL: failed to select additional line after a drag.'
</span><span class="cx">                         output += '&lt;br&gt;';
</span><span class="cx">                                           
</span><del>-                        testRunner.runUIScript(getDragDownTwoScript(), function(result) {
</del><ins>+                        testRunner.runUIScript(getDragScript(72, 140, 72, 160), function(result) {
</ins><span class="cx">                             if (document.getSelection().toString() == &quot;Ut enim ad minim veniam, quis nostrud exercitati&quot;)
</span><span class="cx">                                 output += 'PASS: Correct Selection';
</span><span class="cx">                             else
</span><span class="lines">@@ -265,7 +93,7 @@
</span><span class="cx">                                 output += 'FAIL: failed to select additional line after a drag.'
</span><span class="cx">                             output += '&lt;br&gt;';
</span><span class="cx"> 
</span><del>-                            testRunner.runUIScript(getDragUpOneScript(), function(result) {
</del><ins>+                            testRunner.runUIScript(getDragScript(72, 160, 72, 140), function(result) {
</ins><span class="cx">                                 if (document.getSelection().toString() == &quot;Ut enim ad minim veniam, q&quot;)
</span><span class="cx">                                     output += 'PASS: Correct Selection';
</span><span class="cx">                                 else
</span><span class="lines">@@ -272,7 +100,7 @@
</span><span class="cx">                                     output += 'FAIL: failed to deselect line after a drag.'
</span><span class="cx">                                 output += '&lt;br&gt;';
</span><span class="cx"> 
</span><del>-                                testRunner.runUIScript(getDragUpTwoScript(), function(result) {
</del><ins>+                                testRunner.runUIScript(getDragScript(72, 140, 72, 115), function(result) {
</ins><span class="cx">                                     if (document.getSelection().toString() == &quot;Ut&quot;)
</span><span class="cx">                                         output += 'PASS: Correct Selection';
</span><span class="cx">                                     else
</span><span class="lines">@@ -279,7 +107,7 @@
</span><span class="cx">                                         output += 'FAIL: failed to deselect line after a drag.'
</span><span class="cx">                                     output += '&lt;br&gt;';
</span><span class="cx">                             
</span><del>-                                    testRunner.runUIScript(getDragUpPastScript(), function(result) {
</del><ins>+                                    testRunner.runUIScript(getDragScript(72, 115, 72, 80), function(result) {
</ins><span class="cx">                                         if (document.getSelection().toString() == &quot;U&quot;)
</span><span class="cx">                                             output += 'PASS: Correct Selection';
</span><span class="cx">                                         else
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventstouchioslongpressthendraguptochangeselectedtexthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html (209891 => 209892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html        2016-12-16 01:06:02 UTC (rev 209891)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-then-drag-up-to-change-selected-text.html        2016-12-16 01:14:40 UTC (rev 209892)
</span><span class="lines">@@ -18,7 +18,7 @@
</span><span class="cx">             })();`
</span><span class="cx">         }
</span><span class="cx">     
</span><del>-        function getDragUpOneScript()
</del><ins>+        function getDragScript(startX, startY, endX, endY)
</ins><span class="cx">         {
</span><span class="cx">             return `
</span><span class="cx">             (function() {
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx">                 {
</span><span class="cx">                 interpolate : &quot;linear&quot;,
</span><span class="cx">                 timestep: 0.1,
</span><ins>+                coordinateSpace : &quot;content&quot;,
</ins><span class="cx">                 startEvent : {
</span><span class="cx">                     inputType : &quot;hand&quot;,
</span><span class="cx">                     timeOffset : 0,
</span><span class="lines">@@ -35,8 +36,8 @@
</span><span class="cx">                         inputType : &quot;finger&quot;,
</span><span class="cx">                         phase : &quot;began&quot;,
</span><span class="cx">                         id : 1,
</span><del>-                        x : 56,
-                        y : 109,
</del><ins>+                        x : ${startX},
+                        y : ${startY},
</ins><span class="cx">                         pressure : 0
</span><span class="cx">                         }
</span><span class="cx">                     ]
</span><span class="lines">@@ -49,8 +50,8 @@
</span><span class="cx">                         inputType : &quot;finger&quot;,
</span><span class="cx">                         phase : &quot;moved&quot;,
</span><span class="cx">                         id : 1,
</span><del>-                        x : 56,
-                        y : 103,
</del><ins>+                        x : ${endX},
+                        y : ${endY},
</ins><span class="cx">                         pressure : 0
</span><span class="cx">                         }
</span><span class="cx">                     ]
</span><span class="lines">@@ -62,179 +63,6 @@
</span><span class="cx">             })();`
</span><span class="cx">         }
</span><span class="cx">     
</span><del>-        function getDragUpTwoScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : &quot;linear&quot;,
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;began&quot;,
-                         id : 1,
-                         x : 56,
-                         y : 103,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;moved&quot;,
-                         id : 1,
-                         x : 56,
-                         y : 84,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
-        function getDragDownOneScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : &quot;linear&quot;,
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;began&quot;,
-                         id : 1,
-                         x : 56,
-                         y : 84,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;moved&quot;,
-                         id : 1,
-                         x : 56,
-                         y : 103,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
-        function getDragDownTwoScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : &quot;linear&quot;,
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;began&quot;,
-                         id : 1,
-                         x : 56,
-                         y : 103,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;moved&quot;,
-                         id : 1,
-                         x : 56,
-                         y : 112,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
-        function getDragDownPastScript()
-        {
-            return `
-            (function() {
-             var eventStream = {
-             events : [
-                 {
-                 interpolate : &quot;linear&quot;,
-                 timestep: 0.1,
-                 startEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;began&quot;,
-                         id : 1,
-                         x : 56,
-                         y : 112,
-                         pressure : 0
-                         }
-                     ]
-                 },
-                 endEvent : {
-                     inputType : &quot;hand&quot;,
-                     timeOffset : 0.5,
-                     touches : [
-                         {
-                         inputType : &quot;finger&quot;,
-                         phase : &quot;moved&quot;,
-                         id : 1,
-                         x : 56,
-                         y : 140,
-                         pressure : 0
-                         }
-                     ]
-                 }
-             }]};
-             
-             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
-                 uiController.uiScriptComplete();
-             })();`
-        }
-
</del><span class="cx">         function runTest()
</span><span class="cx">         {
</span><span class="cx">             if (!testRunner.runUIScript)
</span><span class="lines">@@ -251,7 +79,7 @@
</span><span class="cx">                         output += 'FAIL: failed to select a word as a result of a long press';
</span><span class="cx">                     output += '&lt;br&gt;';
</span><span class="cx"> 
</span><del>-                    testRunner.runUIScript(getDragUpOneScript(), function(result) {
</del><ins>+                    testRunner.runUIScript(getDragScript(56, 89, 56, 74), function(result) {
</ins><span class="cx">                         if (document.getSelection().toString() == &quot;e et dolore magna aliqua. Ut&quot;)
</span><span class="cx">                             output += 'PASS: Correct Selection';
</span><span class="cx">                         else
</span><span class="lines">@@ -258,7 +86,7 @@
</span><span class="cx">                             output += 'FAIL: failed to select additional line after a drag.' + document.getSelection().toString()
</span><span class="cx">                         output += '&lt;br&gt;';
</span><span class="cx">                                           
</span><del>-                        testRunner.runUIScript(getDragUpTwoScript(), function(result) {
</del><ins>+                        testRunner.runUIScript(getDragScript(56, 74, 56, 55), function(result) {
</ins><span class="cx">                             if (document.getSelection().toString() == &quot;mod tempor incididunt ut labore et dolore magna aliqua. Ut&quot;)
</span><span class="cx">                                 output += 'PASS: Correct Selection';
</span><span class="cx">                             else
</span><span class="lines">@@ -265,7 +93,7 @@
</span><span class="cx">                                 output += 'FAIL: failed to select additional line after a drag.' + document.getSelection().toString()
</span><span class="cx">                             output += '&lt;br&gt;';
</span><span class="cx"> 
</span><del>-                            testRunner.runUIScript(getDragDownOneScript(), function(result) {
</del><ins>+                            testRunner.runUIScript(getDragScript(56, 55, 56, 74), function(result) {
</ins><span class="cx">                                 if (document.getSelection().toString() == &quot;e et dolore magna aliqua. Ut&quot;)
</span><span class="cx">                                     output += 'PASS: Correct Selection';
</span><span class="cx">                                 else
</span><span class="lines">@@ -272,7 +100,7 @@
</span><span class="cx">                                     output += 'FAIL: failed to deselect line after a drag.' + document.getSelection().toString()
</span><span class="cx">                                 output += '&lt;br&gt;';
</span><span class="cx"> 
</span><del>-                                testRunner.runUIScript(getDragDownTwoScript(), function(result) {
</del><ins>+                                testRunner.runUIScript(getDragScript(56, 74, 56, 92), function(result) {
</ins><span class="cx">                                     if (document.getSelection().toString() == &quot;Ut&quot;)
</span><span class="cx">                                         output += 'PASS: Correct Selection';
</span><span class="cx">                                     else
</span><span class="lines">@@ -279,7 +107,7 @@
</span><span class="cx">                                         output += 'FAIL: failed to deselect line after a drag.' + document.getSelection().toString()
</span><span class="cx">                                     output += '&lt;br&gt;';
</span><span class="cx">                             
</span><del>-                                    testRunner.runUIScript(getDragDownPastScript(), function(result) {
</del><ins>+                                    testRunner.runUIScript(getDragScript(56, 92, 56, 120), function(result) {
</ins><span class="cx">                                         if (document.getSelection().toString() == &quot;t&quot;)
</span><span class="cx">                                             output += 'PASS: Correct Selection';
</span><span class="cx">                                         else
</span><span class="lines">@@ -287,7 +115,7 @@
</span><span class="cx">                                         output += '&lt;br&gt;';
</span><span class="cx">                                         output += result;
</span><span class="cx">                                         document.getElementById('target').innerHTML = output;
</span><del>-                                        //testRunner.notifyDone();
</del><ins>+                                        testRunner.notifyDone();
</ins><span class="cx">                                     });
</span><span class="cx">                                 });
</span><span class="cx">                             });
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (209891 => 209892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-12-16 01:06:02 UTC (rev 209891)
+++ trunk/Tools/ChangeLog        2016-12-16 01:14:40 UTC (rev 209892)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-12-15  Megan Gardner  &lt;megan_gardner@apple.com&gt;
+
+        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):
+
</ins><span class="cx"> 2016-12-15  Claudio Saavedra  &lt;csaavedra@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Ensure gst* docs are not built with update-webkitgtk-libs
</span></span></pre></div>
<a id="trunkToolsTestRunnerSharedUIScriptContextBindingsUIScriptControlleridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (209891 => 209892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl        2016-12-16 01:06:02 UTC (rev 209891)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl        2016-12-16 01:14:40 UTC (rev 209892)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx">     //          {
</span><span class="cx">     //              &quot;inputType&quot; : &quot;hand&quot;,
</span><span class="cx">     //              &quot;timeOffset&quot; : 0,
</span><ins>+    //              &quot;coordinateSpace&quot; : &quot;content&quot;,
</ins><span class="cx">     //              &quot;touches&quot; : [
</span><span class="cx">     //                  {
</span><span class="cx">     //                      &quot;inputType&quot; : &quot;finger&quot;,
</span><span class="lines">@@ -69,9 +70,11 @@
</span><span class="cx">     //                  }
</span><span class="cx">     //              ]
</span><span class="cx">     //          },
</span><ins>+    //          // This is a basic force press
</ins><span class="cx">     //          {
</span><span class="cx">     //              &quot;interpolate&quot; : &quot;linear&quot;,
</span><span class="cx">     //              &quot;timestep&quot; : 0.025,
</span><ins>+    //              &quot;coordinateSpace&quot; : &quot;global&quot;,
</ins><span class="cx">     //              &quot;startEvent&quot; : {
</span><span class="cx">     //                  &quot;inputType&quot; : &quot;hand&quot;,
</span><span class="cx">     //                  &quot;timeOffset&quot; : 0.025,
</span><span class="lines">@@ -94,23 +97,59 @@
</span><span class="cx">     //                          &quot;inputType&quot; : &quot;finger&quot;,
</span><span class="cx">     //                          &quot;phase&quot; : &quot;stationary&quot;,
</span><span class="cx">     //                          &quot;id&quot; : 1,
</span><ins>+    //                          &quot;x&quot; : 100,
+    //                          &quot;y&quot; : 120,
+    //                          &quot;pressure&quot; : 500
+    //                      }
+    //                  ]
+    //              }
+    //          },
+    //          //This is a basic drag
+    //          {
+    //              &quot;interpolate&quot; : &quot;linear&quot;,
+    //              &quot;timestep&quot; : 0.025,
+    //              &quot;coordinateSpace&quot; : &quot;content&quot;,
+    //              &quot;startEvent&quot; : {
+    //                  &quot;inputType&quot; : &quot;hand&quot;,
+    //                  &quot;timeOffset&quot; : 3.025,
+    //                  &quot;touches&quot; : [
+    //                      {
+    //                          &quot;inputType&quot; : &quot;finger&quot;,
+    //                          &quot;phase&quot; : &quot;moved&quot;,
+    //                          &quot;id&quot; : 1,
+    //                          &quot;x&quot; : 100,
+    //                          &quot;y&quot; : 120,
+    //                          &quot;pressure&quot; : 0
+    //                      }
+    //                  ]
+    //              },
+    //              &quot;endEvent&quot; : {
+    //                  &quot;inputType&quot; : &quot;hand&quot;,
+    //                  &quot;timeOffset&quot; : 4.0,
+    //                  &quot;touches&quot; : [
+    //                      {
+    //                          &quot;inputType&quot; : &quot;finger&quot;,
+    //                          &quot;phase&quot; : &quot;moved&quot;,
+    //                          &quot;id&quot; : 1,
</ins><span class="cx">     //                          &quot;x&quot; : 20,
</span><span class="cx">     //                          &quot;y&quot; : 40,
</span><del>-    //                          &quot;pressure&quot; : 500
</del><ins>+    //                          &quot;pressure&quot; : 0
</ins><span class="cx">     //                      }
</span><span class="cx">     //                  ]
</span><span class="cx">     //              }
</span><span class="cx">     //          },
</span><ins>+    //          //ending lift
</ins><span class="cx">     //          {
</span><span class="cx">     //              &quot;inputType&quot; : &quot;hand&quot;,
</span><del>-    //              &quot;timeOffset&quot; : 0.002, // seconds relative to the first event
</del><ins>+    //              &quot;timeOffset&quot; : 4.025, // seconds relative to the first event
+    //              &quot;coordinateSpace&quot; : &quot;content&quot;,
</ins><span class="cx">     //              &quot;touches&quot; : [
</span><span class="cx">     //                  {
</span><span class="cx">     //                      &quot;inputType&quot; : &quot;finger&quot;,
</span><span class="cx">     //                      &quot;phase&quot; : &quot;ended&quot;,
</span><span class="cx">     //                      &quot;id&quot; : 1,
</span><del>-    //                      &quot;x&quot; : 100,
-    //                      &quot;y&quot; : 120
</del><ins>+    //                      &quot;x&quot; : 20,
+    //                      &quot;y&quot; : 40
</ins><span class="cx">     //                  }
</span><span class="cx">     //              ]
</span><span class="cx">     //          },
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosHIDEventGeneratorh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.h (209891 => 209892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.h        2016-12-16 01:06:02 UTC (rev 209891)
+++ trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.h        2016-12-16 01:14:40 UTC (rev 209892)
</span><span class="lines">@@ -31,7 +31,13 @@
</span><span class="cx"> extern NSString* const TopLevelEventInfoKey;
</span><span class="cx"> extern NSString* const HIDEventInputType;
</span><span class="cx"> extern NSString* const HIDEventTimeOffsetKey;
</span><ins>+extern NSString* const HIDEventTouchesKey;
</ins><span class="cx"> extern NSString* const HIDEventPhaseKey;
</span><ins>+extern NSString* const HIDEventInterpolateKey;
+extern NSString* const HIDEventTimestepKey;
+extern NSString* const HIDEventCoordinateSpaceKey;
+extern NSString* const HIDEventStartEventKey;
+extern NSString* const HIDEventEndEventKey;
</ins><span class="cx"> extern NSString* const HIDEventTouchIDKey;
</span><span class="cx"> extern NSString* const HIDEventPressureKey;
</span><span class="cx"> extern NSString* const HIDEventXKey;
</span><span class="lines">@@ -39,7 +45,6 @@
</span><span class="cx"> extern NSString* const HIDEventTwistKey;
</span><span class="cx"> extern NSString* const HIDEventMajorRadiusKey;
</span><span class="cx"> extern NSString* const HIDEventMinorRadiusKey;
</span><del>-extern NSString* const HIDEventTouchesKey;
</del><span class="cx"> 
</span><span class="cx"> // Values for HIDEventInputType.
</span><span class="cx"> extern NSString* const HIDEventInputTypeHand;
</span><span class="lines">@@ -46,6 +51,13 @@
</span><span class="cx"> extern NSString* const HIDEventInputTypeFinger;
</span><span class="cx"> extern NSString* const HIDEventInputTypeStylus;
</span><span class="cx"> 
</span><ins>+// Values for HIDEventCoordinateSpaceKey.
+extern NSString* const HIDEventCoordinateSpaceTypeGlobal;
+extern NSString* const HIDEventCoordinateSpaceTypeContent;
+
+extern NSString* const HIDEventInterpolationTypeLinear;
+extern NSString* const HIDEventInterpolationTypeSimpleCurve;
+
</ins><span class="cx"> // Values for HIDEventPhaseKey.
</span><span class="cx"> extern NSString* const HIDEventPhaseBegan;
</span><span class="cx"> extern NSString* const HIDEventPhaseMoved;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosHIDEventGeneratormm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm (209891 => 209892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm        2016-12-16 01:06:02 UTC (rev 209891)
+++ trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm        2016-12-16 01:14:40 UTC (rev 209892)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> NSString* const HIDEventPhaseKey = @&quot;phase&quot;;
</span><span class="cx"> NSString* const HIDEventInterpolateKey = @&quot;interpolate&quot;;
</span><span class="cx"> NSString* const HIDEventTimestepKey = @&quot;timestep&quot;;
</span><ins>+NSString* const HIDEventCoordinateSpaceKey = @&quot;coordinateSpace&quot;;
</ins><span class="cx"> NSString* const HIDEventStartEventKey = @&quot;startEvent&quot;;
</span><span class="cx"> NSString* const HIDEventEndEventKey = @&quot;endEvent&quot;;
</span><span class="cx"> NSString* const HIDEventTouchIDKey = @&quot;id&quot;;
</span><span class="lines">@@ -58,6 +59,9 @@
</span><span class="cx"> NSString* const HIDEventInputTypeFinger = @&quot;finger&quot;;
</span><span class="cx"> NSString* const HIDEventInputTypeStylus = @&quot;stylus&quot;;
</span><span class="cx"> 
</span><ins>+NSString* const HIDEventCoordinateSpaceTypeGlobal = @&quot;global&quot;;
+NSString* const HIDEventCoordinateSpaceTypeContent = @&quot;content&quot;;
+
</ins><span class="cx"> NSString* const HIDEventInterpolationTypeLinear = @&quot;linear&quot;;
</span><span class="cx"> NSString* const HIDEventInterpolationTypeSimpleCurve = @&quot;simpleCurve&quot;;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (209891 => 209892)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm        2016-12-16 01:06:02 UTC (rev 209891)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm        2016-12-16 01:14:40 UTC (rev 209892)
</span><span class="lines">@@ -203,6 +203,17 @@
</span><span class="cx">         m_context-&gt;asyncTaskComplete(callbackID);
</span><span class="cx">     }];
</span><span class="cx"> }
</span><ins>+    
+void convertCoordinates(NSMutableDictionary *event)
+{
+    if (event[HIDEventTouchesKey]) {
+        for (NSMutableDictionary *touch in event[HIDEventTouchesKey]) {
+            auto location = globalToContentCoordinates(TestController::singleton().mainWebView()-&gt;platformView(), (long)[touch[HIDEventXKey] doubleValue], (long)[touch[HIDEventYKey]doubleValue]);
+            touch[HIDEventXKey] = @(location.x);
+            touch[HIDEventYKey] = @(location.y);
+        }
+    }
+}
</ins><span class="cx"> 
</span><span class="cx"> void UIScriptController::sendEventStream(JSStringRef eventsJSON, JSValueRef callback)
</span><span class="cx"> {
</span><span class="lines">@@ -209,7 +220,22 @@
</span><span class="cx">     unsigned callbackID = m_context-&gt;prepareForAsyncTask(callback, CallbackTypeNonPersistent);
</span><span class="cx"> 
</span><span class="cx">     String jsonString = eventsJSON-&gt;string();
</span><del>-    auto eventInfo = dynamic_objc_cast&lt;NSDictionary&gt;([NSJSONSerialization JSONObjectWithData:[(NSString *)jsonString dataUsingEncoding:NSUTF8StringEncoding] options:0 error:nil]);
</del><ins>+    auto eventInfo = dynamic_objc_cast&lt;NSDictionary&gt;([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);
+    }
+    
</ins><span class="cx">     if (!eventInfo || ![eventInfo isKindOfClass:[NSDictionary class]]) {
</span><span class="cx">         WTFLogAlways(&quot;JSON is not convertible to a dictionary&quot;);
</span><span class="cx">         return;
</span></span></pre>
</div>
</div>

</body>
</html>