<!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>[245112] 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/245112">245112</a></dd>
<dt>Author</dt> <dd>graouts@webkit.org</dd>
<dt>Date</dt> <dd>2019-05-09 01:34:23 -0700 (Thu, 09 May 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS] Correctly handle overlapping regions for elements with a touch-action property
https://bugs.webkit.org/show_bug.cgi?id=194813
<rdar://problem/48194708>

Reviewed by Antti Koivisto.

Source/WebKit:

We now use WebKit::touchActionsForPoint() to determine the touch actions for a given touch using its location in -[WKContentViewInteraction
_handleTouchActionsForTouchEvent:]. We then record these touch actions for the touch's identifier on the RemoteScrollingCoordinatorProxy.

Then, as we interact with a UIScrollView, we get its gesture recognizer and get its active touch identifier through the new
-[WKContentViewInteraction activeTouchIdentifierForGestureRecognizer:] method, and query the RemoteScrollingCoordinatorProxy for the touch
actions matching that touch identifier.

Tests: pointerevents/ios/touch-action-none-overlap.html
       pointerevents/ios/touch-action-pan-x-overlap.html
       pointerevents/ios/touch-action-pan-y-overlap.html
       pointerevents/ios/touch-action-pinch-zoom-overlap.html

* UIProcess/PageClient.h:
(WebKit::PageClient::activeTouchIdentifierForGestureRecognizer):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: Maintain a touch identifier to touch actions map.
(WebKit::RemoteScrollingCoordinatorProxy::activeTouchActionsForTouchIdentifier const):
(WebKit::RemoteScrollingCoordinatorProxy::setTouchActionsForTouchIdentifier):
(WebKit::RemoteScrollingCoordinatorProxy::clearTouchActionsForTouchIdentifier):
(WebKit::RemoteScrollingCoordinatorProxy::touchActionDataAtPoint const): Deleted.
(WebKit::RemoteScrollingCoordinatorProxy::touchActionDataForScrollNodeID const): Deleted.
(WebKit::RemoteScrollingCoordinatorProxy::setTouchDataForTouchIdentifier): Deleted.
(WebKit::RemoteScrollingCoordinatorProxy::clearTouchDataForTouchIdentifier): Deleted.
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
(-[WKScrollingNodeScrollViewDelegate _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::activeTouchActionsForGestureRecognizer const):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::touchActionData const): Deleted.
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::activeTouchIdentifierForGestureRecognizer):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView activeTouchIdentifierForGestureRecognizer:]):
(-[WKContentView _handleTouchActionsForTouchEvent:]):

LayoutTests:

Add new tests that check that an element overlapping another element with a "touch-action" property is not affected
by the property set on that underlying element.

* pointerevents/ios/touch-action-none-overlap-expected.txt: Added.
* pointerevents/ios/touch-action-none-overlap.html: Added.
* pointerevents/ios/touch-action-pan-x-overlap-expected.txt: Added.
* pointerevents/ios/touch-action-pan-x-overlap.html: Added.
* pointerevents/ios/touch-action-pan-y-overlap-expected.txt: Added.
* pointerevents/ios/touch-action-pan-y-overlap.html: Added.
* pointerevents/ios/touch-action-pinch-zoom-overlap-expected.txt: Added.
* pointerevents/ios/touch-action-pinch-zoom-overlap.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitUIProcessPageClienth">trunk/Source/WebKit/UIProcess/PageClient.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessRemoteLayerTreeRemoteScrollingCoordinatorProxycpp">trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessRemoteLayerTreeRemoteScrollingCoordinatorProxyh">trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessRemoteLayerTreeiosScrollingTreeScrollingNodeDelegateIOSh">trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessRemoteLayerTreeiosScrollingTreeScrollingNodeDelegateIOSmm">trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosPageClientImplIOSh">trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosPageClientImplIOSmm">trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWKContentViewInteractionh">trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestspointereventsiostouchactionnoneoverlapexpectedtxt">trunk/LayoutTests/pointerevents/ios/touch-action-none-overlap-expected.txt</a></li>
<li><a href="#trunkLayoutTestspointereventsiostouchactionnoneoverlaphtml">trunk/LayoutTests/pointerevents/ios/touch-action-none-overlap.html</a></li>
<li><a href="#trunkLayoutTestspointereventsiostouchactionpanxoverlapexpectedtxt">trunk/LayoutTests/pointerevents/ios/touch-action-pan-x-overlap-expected.txt</a></li>
<li><a href="#trunkLayoutTestspointereventsiostouchactionpanxoverlaphtml">trunk/LayoutTests/pointerevents/ios/touch-action-pan-x-overlap.html</a></li>
<li><a href="#trunkLayoutTestspointereventsiostouchactionpanyoverlapexpectedtxt">trunk/LayoutTests/pointerevents/ios/touch-action-pan-y-overlap-expected.txt</a></li>
<li><a href="#trunkLayoutTestspointereventsiostouchactionpanyoverlaphtml">trunk/LayoutTests/pointerevents/ios/touch-action-pan-y-overlap.html</a></li>
<li><a href="#trunkLayoutTestspointereventsiostouchactionpinchzoomoverlapexpectedtxt">trunk/LayoutTests/pointerevents/ios/touch-action-pinch-zoom-overlap-expected.txt</a></li>
<li><a href="#trunkLayoutTestspointereventsiostouchactionpinchzoomoverlaphtml">trunk/LayoutTests/pointerevents/ios/touch-action-pinch-zoom-overlap.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (245111 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2019-05-09 08:30:19 UTC (rev 245111)
+++ trunk/LayoutTests/ChangeLog 2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2019-05-08  Antoine Quint  <graouts@apple.com>
+
+        [iOS] Correctly handle overlapping regions for elements with a touch-action property
+        https://bugs.webkit.org/show_bug.cgi?id=194813
+        <rdar://problem/48194708>
+
+        Reviewed by Antti Koivisto.
+
+        Add new tests that check that an element overlapping another element with a "touch-action" property is not affected
+        by the property set on that underlying element.
+
+        * pointerevents/ios/touch-action-none-overlap-expected.txt: Added.
+        * pointerevents/ios/touch-action-none-overlap.html: Added.
+        * pointerevents/ios/touch-action-pan-x-overlap-expected.txt: Added.
+        * pointerevents/ios/touch-action-pan-x-overlap.html: Added.
+        * pointerevents/ios/touch-action-pan-y-overlap-expected.txt: Added.
+        * pointerevents/ios/touch-action-pan-y-overlap.html: Added.
+        * pointerevents/ios/touch-action-pinch-zoom-overlap-expected.txt: Added.
+        * pointerevents/ios/touch-action-pinch-zoom-overlap.html: Added.
+
</ins><span class="cx"> 2019-05-08  Chris Dumez  <cdumez@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [iOS Debug] ASSERTION FAILED: !m_originalNode in WebCore::JSLazyEventListener::checkValidityForEventTarget(WebCore::EventTarget &)
</span></span></pre></div>
<a id="trunkLayoutTestspointereventsiostouchactionnoneoverlapexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/pointerevents/ios/touch-action-none-overlap-expected.txt (0 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/pointerevents/ios/touch-action-none-overlap-expected.txt                               (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-none-overlap-expected.txt  2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Testing that an element overlapping an element with touch-action: none allows for scrolling while the touch-action: none element correctly prevents scrolling. 
+
</ins></span></pre></div>
<a id="trunkLayoutTestspointereventsiostouchactionnoneoverlaphtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/pointerevents/ios/touch-action-none-overlap.html (0 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/pointerevents/ios/touch-action-none-overlap.html                               (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-none-overlap.html  2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<body>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../utils.js"></script>
+<script>
+
+'use strict';
+
+function assertNoScroll()
+{
+    assert_equals(window.pageXOffset, 0, "The page was not scrolled in the x-axis.");
+    assert_equals(window.pageYOffset, 0, "The page was not scrolled in the y-axis.");
+}
+
+target_test({ width: "200px", height: "200px" }, (target, test) => {
+    document.body.style.width = "2000px";
+    document.body.style.height = "2000px";
+
+    target.style.touchAction = "none";
+
+    const overlap = document.body.insertBefore(document.createElement("div"), target.nextElementSibling);
+    overlap.setAttribute("style", "position: absolute; left: 50px; top: 50px; width: 100px; height: 100px;");
+
+    // Swipe over the "touch-action: none" element and around the overlapping element.
+    ui.swipe({ x: 25, y: 175 }, { x: 25, y: 25 }).then(assertNoScroll)
+    .then(() => ui.swipe({ x: 175, y: 175 }, { x: 175, y: 25 })).then(assertNoScroll)
+    .then(() => ui.swipe({ x: 175, y: 25 }, { x: 25, y: 25 })).then(assertNoScroll)
+    .then(() => ui.swipe({ x: 175, y: 175 }, { x: 25, y: 175 })).then(assertNoScroll)
+    // Now swipe over the overlapping element, this should scroll.
+    .then(() => ui.swipe({ x: 125, y: 125 }, { x: 75, y: 75 })).then(() => {
+        assert_not_equals(window.pageXOffset, 0, "The page was scrolled in the x-axis.");
+        assert_not_equals(window.pageYOffset, 0, "The page was scrolled in the y-axis.");
+        test.done();
+    });
+}, "Testing that an element overlapping an element with touch-action: none allows for scrolling while the touch-action: none element correctly prevents scrolling.");
+
+</script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestspointereventsiostouchactionpanxoverlapexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/pointerevents/ios/touch-action-pan-x-overlap-expected.txt (0 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/pointerevents/ios/touch-action-pan-x-overlap-expected.txt                              (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-pan-x-overlap-expected.txt 2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Testing that an element overlapping an element with touch-action: pan-x allows for scrolling while the touch-action: pan-x element correctly prevents scrolling in the y-axis. 
+
</ins></span></pre></div>
<a id="trunkLayoutTestspointereventsiostouchactionpanxoverlaphtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/pointerevents/ios/touch-action-pan-x-overlap.html (0 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/pointerevents/ios/touch-action-pan-x-overlap.html                              (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-pan-x-overlap.html 2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<body>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../utils.js"></script>
+<script>
+
+'use strict';
+
+function assertNoScroll()
+{
+    assert_equals(window.pageXOffset, 0, "The page was not scrolled in the x-axis.");
+    assert_equals(window.pageYOffset, 0, "The page was not scrolled in the y-axis.");
+}
+
+target_test({ width: "200px", height: "200px" }, (target, test) => {
+    document.body.style.width = "2000px";
+    document.body.style.height = "2000px";
+
+    target.style.touchAction = "pan-x";
+
+    const overlap = document.body.insertBefore(document.createElement("div"), target.nextElementSibling);
+    overlap.setAttribute("style", "position: absolute; left: 50px; top: 50px; width: 100px; height: 100px;");
+
+    // Swipe in the y-axis over the "touch-action: pan-x" element and around the overlapping element.
+    ui.swipe({ x: 25, y: 175 }, { x: 25, y: 25 }).then(assertNoScroll)
+    .then(() => ui.swipe({ x: 175, y: 175 }, { x: 175, y: 25 })).then(assertNoScroll)
+    // Now swipe over the overlapping element, this should scroll in both directions.
+    .then(() => ui.swipe({ x: 125, y: 125 }, { x: 75, y: 75 })).then(() => {
+        assert_not_equals(window.pageXOffset, 0, "The page was scrolled in the x-axis.");
+        assert_not_equals(window.pageYOffset, 0, "The page was scrolled in the y-axis.");
+        test.done();
+    });
+}, "Testing that an element overlapping an element with touch-action: pan-x allows for scrolling while the touch-action: pan-x element correctly prevents scrolling in the y-axis.");
+
+</script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestspointereventsiostouchactionpanyoverlapexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/pointerevents/ios/touch-action-pan-y-overlap-expected.txt (0 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/pointerevents/ios/touch-action-pan-y-overlap-expected.txt                              (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-pan-y-overlap-expected.txt 2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Testing that an element overlapping an element with touch-action: pan-y allows for scrolling while the touch-action: pan-y element correctly prevents scrolling in the x-axis. 
+
</ins></span></pre></div>
<a id="trunkLayoutTestspointereventsiostouchactionpanyoverlaphtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/pointerevents/ios/touch-action-pan-y-overlap.html (0 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/pointerevents/ios/touch-action-pan-y-overlap.html                              (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-pan-y-overlap.html 2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<body>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../utils.js"></script>
+<script>
+
+'use strict';
+
+function assertNoScroll()
+{
+    assert_equals(window.pageXOffset, 0, "The page was not scrolled in the x-axis.");
+    assert_equals(window.pageYOffset, 0, "The page was not scrolled in the y-axis.");
+}
+
+target_test({ width: "200px", height: "200px" }, (target, test) => {
+    document.body.style.width = "2000px";
+    document.body.style.height = "2000px";
+
+    target.style.touchAction = "pan-y";
+
+    const overlap = document.body.insertBefore(document.createElement("div"), target.nextElementSibling);
+    overlap.setAttribute("style", "position: absolute; left: 50px; top: 50px; width: 100px; height: 100px;");
+
+    // Swipe in the x-axis over the "touch-action: pan-y" element and around the overlapping element.
+    ui.swipe({ x: 175, y: 25 }, { x: 25, y: 25 }).then(assertNoScroll)
+    .then(() => ui.swipe({ x: 175, y: 175 }, { x: 25, y: 175 })).then(assertNoScroll)
+    // Now swipe over the overlapping element, this should scroll in both directions.
+    .then(() => ui.swipe({ x: 125, y: 125 }, { x: 75, y: 75 })).then(() => {
+        assert_not_equals(window.pageXOffset, 0, "The page was scrolled in the x-axis.");
+        assert_not_equals(window.pageYOffset, 0, "The page was scrolled in the y-axis.");
+        test.done();
+    });
+}, "Testing that an element overlapping an element with touch-action: pan-y allows for scrolling while the touch-action: pan-y element correctly prevents scrolling in the x-axis.");
+
+</script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestspointereventsiostouchactionpinchzoomoverlapexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/pointerevents/ios/touch-action-pinch-zoom-overlap-expected.txt (0 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/pointerevents/ios/touch-action-pinch-zoom-overlap-expected.txt                         (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-pinch-zoom-overlap-expected.txt    2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS Testing that an element overlapping an element with touch-action: pinch-zoom allows for scrolling while the touch-action: pinch-zoom element correctly prevents scrolling. 
+
</ins></span></pre></div>
<a id="trunkLayoutTestspointereventsiostouchactionpinchzoomoverlaphtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/pointerevents/ios/touch-action-pinch-zoom-overlap.html (0 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/pointerevents/ios/touch-action-pinch-zoom-overlap.html                         (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-pinch-zoom-overlap.html    2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<body>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../utils.js"></script>
+<script>
+
+'use strict';
+
+function assertNoScroll()
+{
+    assert_equals(window.pageXOffset, 0, "The page was not scrolled in the x-axis.");
+    assert_equals(window.pageYOffset, 0, "The page was not scrolled in the y-axis.");
+}
+
+target_test({ width: "200px", height: "200px" }, (target, test) => {
+    document.body.style.width = "2000px";
+    document.body.style.height = "2000px";
+
+    target.style.touchAction = "pinch-zoom";
+
+    const overlap = document.body.insertBefore(document.createElement("div"), target.nextElementSibling);
+    overlap.setAttribute("style", "position: absolute; left: 50px; top: 50px; width: 100px; height: 100px;");
+
+    // Swipe over the "touch-action: pinch-zoom" element and around the overlapping element.
+    ui.swipe({ x: 25, y: 175 }, { x: 25, y: 25 }).then(assertNoScroll)
+    .then(() => ui.swipe({ x: 175, y: 175 }, { x: 175, y: 25 })).then(assertNoScroll)
+    .then(() => ui.swipe({ x: 175, y: 25 }, { x: 25, y: 25 })).then(assertNoScroll)
+    .then(() => ui.swipe({ x: 175, y: 175 }, { x: 25, y: 175 })).then(assertNoScroll)
+    // Now swipe over the overlapping element, this should scroll.
+    .then(() => ui.swipe({ x: 125, y: 125 }, { x: 75, y: 75 })).then(() => {
+        assert_not_equals(window.pageXOffset, 0, "The page was scrolled in the x-axis.");
+        assert_not_equals(window.pageYOffset, 0, "The page was scrolled in the y-axis.");
+        test.done();
+    });
+}, "Testing that an element overlapping an element with touch-action: pinch-zoom allows for scrolling while the touch-action: pinch-zoom element correctly prevents scrolling.");
+
+</script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (245111 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2019-05-09 08:30:19 UTC (rev 245111)
+++ trunk/Source/WebKit/ChangeLog       2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2019-05-08  Antoine Quint  <graouts@apple.com>
+
+        [iOS] Correctly handle overlapping regions for elements with a touch-action property
+        https://bugs.webkit.org/show_bug.cgi?id=194813
+        <rdar://problem/48194708>
+
+        Reviewed by Antti Koivisto.
+
+        We now use WebKit::touchActionsForPoint() to determine the touch actions for a given touch using its location in -[WKContentViewInteraction
+        _handleTouchActionsForTouchEvent:]. We then record these touch actions for the touch's identifier on the RemoteScrollingCoordinatorProxy.
+
+        Then, as we interact with a UIScrollView, we get its gesture recognizer and get its active touch identifier through the new
+        -[WKContentViewInteraction activeTouchIdentifierForGestureRecognizer:] method, and query the RemoteScrollingCoordinatorProxy for the touch
+        actions matching that touch identifier.
+
+        Tests: pointerevents/ios/touch-action-none-overlap.html
+               pointerevents/ios/touch-action-pan-x-overlap.html
+               pointerevents/ios/touch-action-pan-y-overlap.html
+               pointerevents/ios/touch-action-pinch-zoom-overlap.html
+
+        * UIProcess/PageClient.h:
+        (WebKit::PageClient::activeTouchIdentifierForGestureRecognizer):
+        * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: Maintain a touch identifier to touch actions map.
+        (WebKit::RemoteScrollingCoordinatorProxy::activeTouchActionsForTouchIdentifier const):
+        (WebKit::RemoteScrollingCoordinatorProxy::setTouchActionsForTouchIdentifier):
+        (WebKit::RemoteScrollingCoordinatorProxy::clearTouchActionsForTouchIdentifier):
+        (WebKit::RemoteScrollingCoordinatorProxy::touchActionDataAtPoint const): Deleted.
+        (WebKit::RemoteScrollingCoordinatorProxy::touchActionDataForScrollNodeID const): Deleted.
+        (WebKit::RemoteScrollingCoordinatorProxy::setTouchDataForTouchIdentifier): Deleted.
+        (WebKit::RemoteScrollingCoordinatorProxy::clearTouchDataForTouchIdentifier): Deleted.
+        * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
+        (-[WKScrollingNodeScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
+        (-[WKScrollingNodeScrollViewDelegate _scrollView:adjustedOffsetForOffset:translation:startPoint:locationInView:horizontalVelocity:verticalVelocity:]):
+        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::activeTouchActionsForGestureRecognizer const):
+        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::touchActionData const): Deleted.
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::activeTouchIdentifierForGestureRecognizer):
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView activeTouchIdentifierForGestureRecognizer:]):
+        (-[WKContentView _handleTouchActionsForTouchEvent:]):
+
</ins><span class="cx"> 2019-05-08  Megan Gardner  <megan_gardner@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Add quirks to emulate undo and redo in hidden editable areas on some websites
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/PageClient.h (245111 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/PageClient.h       2019-05-09 08:30:19 UTC (rev 245111)
+++ trunk/Source/WebKit/UIProcess/PageClient.h  2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -501,6 +501,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(POINTER_EVENTS)
</span><span class="cx">     virtual void cancelPointersForGestureRecognizer(UIGestureRecognizer*) { }
</span><ins>+    virtual WTF::Optional<unsigned> activeTouchIdentifierForGestureRecognizer(UIGestureRecognizer*) { return WTF::nullopt; }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(WPE)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessRemoteLayerTreeRemoteScrollingCoordinatorProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp (245111 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp        2019-05-09 08:30:19 UTC (rev 245111)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp   2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -247,30 +247,24 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(POINTER_EVENTS)
</span><del>-Optional<TouchActionData> RemoteScrollingCoordinatorProxy::touchActionDataAtPoint(const IntPoint p) const
</del><ins>+OptionSet<TouchAction> RemoteScrollingCoordinatorProxy::activeTouchActionsForTouchIdentifier(unsigned touchIdentifier) const
</ins><span class="cx"> {
</span><del>-    return m_scrollingTree->touchActionDataAtPoint(p);
</del><ins>+    auto iterator = m_touchActionsByTouchIdentifier.find(touchIdentifier);
+    if (iterator == m_touchActionsByTouchIdentifier.end())
+        return { };
+    return iterator->value;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Optional<TouchActionData> RemoteScrollingCoordinatorProxy::touchActionDataForScrollNodeID(ScrollingNodeID scrollingNodeID) const
</del><ins>+void RemoteScrollingCoordinatorProxy::setTouchActionsForTouchIdentifier(OptionSet<TouchAction> touchActions, unsigned touchIdentifier)
</ins><span class="cx"> {
</span><del>-    for (auto& touchActionData : m_touchActionDataByTouchIdentifier.values()) {
-        if (touchActionData.scrollingNodeID == scrollingNodeID)
-            return touchActionData;
-    }
-    return WTF::nullopt;
</del><ins>+    m_touchActionsByTouchIdentifier.set(touchIdentifier, touchActions);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteScrollingCoordinatorProxy::setTouchDataForTouchIdentifier(TouchActionData touchActionData, unsigned touchIdentifier)
</del><ins>+void RemoteScrollingCoordinatorProxy::clearTouchActionsForTouchIdentifier(unsigned touchIdentifier)
</ins><span class="cx"> {
</span><del>-    m_touchActionDataByTouchIdentifier.set(touchIdentifier, touchActionData);
</del><ins>+    m_touchActionsByTouchIdentifier.remove(touchIdentifier);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteScrollingCoordinatorProxy::clearTouchDataForTouchIdentifier(unsigned touchIdentifier)
-{
-    m_touchActionDataByTouchIdentifier.remove(touchIdentifier);
-}
-
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessRemoteLayerTreeRemoteScrollingCoordinatorProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h (245111 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h  2019-05-09 08:30:19 UTC (rev 245111)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h     2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -102,10 +102,9 @@
</span><span class="cx">     String scrollingTreeAsText() const;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(POINTER_EVENTS)
</span><del>-    Optional<WebCore::TouchActionData> touchActionDataAtPoint(const WebCore::IntPoint) const;
-    Optional<WebCore::TouchActionData> touchActionDataForScrollNodeID(WebCore::ScrollingNodeID) const;
-    void setTouchDataForTouchIdentifier(WebCore::TouchActionData, unsigned);
-    void clearTouchDataForTouchIdentifier(unsigned);
</del><ins>+    OptionSet<WebCore::TouchAction> activeTouchActionsForTouchIdentifier(unsigned touchIdentifier) const;
+    void setTouchActionsForTouchIdentifier(OptionSet<WebCore::TouchAction>, unsigned);
+    void clearTouchActionsForTouchIdentifier(unsigned);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -120,7 +119,7 @@
</span><span class="cx">     WebPageProxy& m_webPageProxy;
</span><span class="cx">     RefPtr<RemoteScrollingTree> m_scrollingTree;
</span><span class="cx"> #if ENABLE(POINTER_EVENTS)
</span><del>-    HashMap<unsigned, WebCore::TouchActionData> m_touchActionDataByTouchIdentifier;
</del><ins>+    HashMap<unsigned, OptionSet<WebCore::TouchAction>> m_touchActionsByTouchIdentifier;
</ins><span class="cx"> #endif
</span><span class="cx">     RequestedScrollInfo* m_requestedScrollInfo;
</span><span class="cx"> #if ENABLE(CSS_SCROLL_SNAP)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessRemoteLayerTreeiosScrollingTreeScrollingNodeDelegateIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h (245111 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h        2019-05-09 08:30:19 UTC (rev 245111)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h   2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">     void repositionScrollingLayers();
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(POINTER_EVENTS)
</span><del>-    Optional<WebCore::TouchActionData> touchActionData() const;
</del><ins>+    OptionSet<TouchAction> activeTouchActionsForGestureRecognizer(UIGestureRecognizer*) const;
</ins><span class="cx">     void cancelPointersForGestureRecognizer(UIGestureRecognizer*);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessRemoteLayerTreeiosScrollingTreeScrollingNodeDelegateIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm (245111 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm       2019-05-09 08:30:19 UTC (rev 245111)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm  2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -79,20 +79,18 @@
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(POINTER_EVENTS)
</span><span class="cx">     if (![scrollView isZooming]) {
</span><del>-        if (auto touchActionData = _scrollingTreeNodeDelegate->touchActionData()) {
-            auto touchActions = touchActionData->touchActions;
-            if (touchActions != WebCore::TouchAction::Auto && touchActions != WebCore::TouchAction::Manipulation) {
-                bool canPanX = true;
-                bool canPanY = true;
-                if (!touchActions.contains(WebCore::TouchAction::PanX)) {
-                    canPanX = false;
-                    targetContentOffset->x = scrollView.contentOffset.x;
-                }
-                if (!touchActions.contains(WebCore::TouchAction::PanY)) {
-                    canPanY = false;
-                    targetContentOffset->y = scrollView.contentOffset.y;
-                }
</del><ins>+        auto touchActions = _scrollingTreeNodeDelegate->activeTouchActionsForGestureRecognizer(scrollView.panGestureRecognizer);
+        if (touchActions && !touchActions.containsAny({ WebCore::TouchAction::Auto, WebCore::TouchAction::Manipulation })) {
+            bool canPanX = true;
+            bool canPanY = true;
+            if (!touchActions.contains(WebCore::TouchAction::PanX)) {
+                canPanX = false;
+                targetContentOffset->x = scrollView.contentOffset.x;
</ins><span class="cx">             }
</span><ins>+            if (!touchActions.contains(WebCore::TouchAction::PanY)) {
+                canPanY = false;
+                targetContentOffset->y = scrollView.contentOffset.y;
+            }
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="lines">@@ -148,14 +146,14 @@
</span><span class="cx"> #if ENABLE(POINTER_EVENTS)
</span><span class="cx"> - (CGPoint)_scrollView:(UIScrollView *)scrollView adjustedOffsetForOffset:(CGPoint)offset translation:(CGPoint)translation startPoint:(CGPoint)start locationInView:(CGPoint)locationInView horizontalVelocity:(inout double *)hv verticalVelocity:(inout double *)vv
</span><span class="cx"> {
</span><del>-    auto touchActionData = _scrollingTreeNodeDelegate->touchActionData();
-    if (!touchActionData) {
-        [self cancelPointersForGestureRecognizer:scrollView.panGestureRecognizer];
</del><ins>+    auto* panGestureRecognizer = scrollView.panGestureRecognizer;
+    auto touchActions = _scrollingTreeNodeDelegate->activeTouchActionsForGestureRecognizer(panGestureRecognizer);
+    if (!touchActions) {
+        [self cancelPointersForGestureRecognizer:panGestureRecognizer];
</ins><span class="cx">         return offset;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    auto touchActions = touchActionData->touchActions;
-    if (touchActions == WebCore::TouchAction::Auto || touchActions == WebCore::TouchAction::Manipulation)
</del><ins>+    if (touchActions.containsAny({ WebCore::TouchAction::Auto, WebCore::TouchAction::Manipulation }))
</ins><span class="cx">         return offset;
</span><span class="cx"> 
</span><span class="cx">     CGPoint adjustedContentOffset = CGPointMake(offset.x, offset.y);
</span><span class="lines">@@ -338,9 +336,12 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(POINTER_EVENTS)
</span><del>-Optional<TouchActionData> ScrollingTreeScrollingNodeDelegateIOS::touchActionData() const
</del><ins>+OptionSet<TouchAction> ScrollingTreeScrollingNodeDelegateIOS::activeTouchActionsForGestureRecognizer(UIGestureRecognizer* gestureRecognizer) const
</ins><span class="cx"> {
</span><del>-    return downcast<RemoteScrollingTree>(scrollingTree()).scrollingCoordinatorProxy().touchActionDataForScrollNodeID(scrollingNode().scrollingNodeID());
</del><ins>+    auto& scrollingCoordinatorProxy = downcast<RemoteScrollingTree>(scrollingTree()).scrollingCoordinatorProxy();
+    if (auto touchIdentifier = scrollingCoordinatorProxy.webPageProxy().pageClient().activeTouchIdentifierForGestureRecognizer(gestureRecognizer))
+        return scrollingCoordinatorProxy.activeTouchActionsForTouchIdentifier(*touchIdentifier);
+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ScrollingTreeScrollingNodeDelegateIOS::cancelPointersForGestureRecognizer(UIGestureRecognizer* gestureRecognizer)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosPageClientImplIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h (245111 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h    2019-05-09 08:30:19 UTC (rev 245111)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h       2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -251,6 +251,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(POINTER_EVENTS)
</span><span class="cx">     void cancelPointersForGestureRecognizer(UIGestureRecognizer*) override;
</span><ins>+    WTF::Optional<unsigned> activeTouchIdentifierForGestureRecognizer(UIGestureRecognizer*) override;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     WKContentView *m_contentView;
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (245111 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm   2019-05-09 08:30:19 UTC (rev 245111)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm      2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -866,6 +866,11 @@
</span><span class="cx"> {
</span><span class="cx">     [m_contentView cancelPointersForGestureRecognizer:gestureRecognizer];
</span><span class="cx"> }
</span><ins>+
+WTF::Optional<unsigned> PageClientImpl::activeTouchIdentifierForGestureRecognizer(UIGestureRecognizer* gestureRecognizer)
+{
+    return [m_contentView activeTouchIdentifierForGestureRecognizer:gestureRecognizer];
+}
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> void PageClientImpl::handleAutocorrectionContext(const WebAutocorrectionContext& context)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWKContentViewInteractionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (245111 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h     2019-05-09 08:30:19 UTC (rev 245111)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h        2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -409,6 +409,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(POINTER_EVENTS)
</span><span class="cx"> - (void)cancelPointersForGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer;
</span><ins>+- (WTF::Optional<unsigned>)activeTouchIdentifierForGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #define DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW(_action) \
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (245111 => 245112)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm    2019-05-09 08:30:19 UTC (rev 245111)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm       2019-05-09 08:34:23 UTC (rev 245112)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #import "NativeWebKeyboardEvent.h"
</span><span class="cx"> #import "NativeWebTouchEvent.h"
</span><span class="cx"> #import "RemoteLayerTreeDrawingAreaProxy.h"
</span><ins>+#import "RemoteLayerTreeViews.h"
</ins><span class="cx"> #import "SmartMagnificationController.h"
</span><span class="cx"> #import "TextInputSPI.h"
</span><span class="cx"> #import "UIKitSPI.h"
</span><span class="lines">@@ -1257,7 +1258,21 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><ins>+
+- (WTF::Optional<unsigned>)activeTouchIdentifierForGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
+{
+#if HAVE(UI_WEB_TOUCH_EVENTS_GESTURE_RECOGNIZER_WITH_ACTIVE_TOUCHES_BY_ID)
+    // FIXME: <rdar://problem/48035706>
+    NSMapTable<NSNumber *, UITouch *> *activeTouches = [_touchEventGestureRecognizer activeTouchesByIdentifier];
+    for (NSNumber *touchIdentifier in activeTouches) {
+        UITouch *touch = [activeTouches objectForKey:touchIdentifier];
+        if ([touch.gestureRecognizers containsObject:gestureRecognizer])
+            return [touchIdentifier unsignedIntValue];
+    }
</ins><span class="cx"> #endif
</span><ins>+    return WTF::nullopt;
+}
+#endif
</ins><span class="cx"> 
</span><span class="cx"> inline static UIKeyModifierFlags gestureRecognizerModifierFlags(UIGestureRecognizer *recognizer)
</span><span class="cx"> {
</span><span class="lines">@@ -1318,19 +1333,18 @@
</span><span class="cx">     for (const auto& touchPoint : touchEvent.touchPoints()) {
</span><span class="cx">         auto phase = touchPoint.phase();
</span><span class="cx">         if (phase == WebKit::WebPlatformTouchPoint::TouchPressed) {
</span><del>-            auto touchActionData = scrollingCoordinator->touchActionDataAtPoint(touchPoint.location());
-            if (!touchActionData || touchActionData->touchActions.contains(WebCore::TouchAction::Manipulation))
</del><ins>+            auto touchActions = WebKit::touchActionsForPoint(self, touchPoint.location());
+            if (!touchActions || touchActions.containsAny({ WebCore::TouchAction::Auto, WebCore::TouchAction::Manipulation }))
</ins><span class="cx">                 continue;
</span><del>-            if (auto scrollingNodeID = touchActionData->scrollingNodeID)
-                scrollingCoordinator->setTouchDataForTouchIdentifier(*touchActionData, touchPoint.identifier());
-            else {
-                if (!touchActionData->touchActions.contains(WebCore::TouchAction::PinchZoom))
-                    _webView.scrollView.pinchGestureRecognizer.enabled = NO;
-                _preventsPanningInXAxis = !touchActionData->touchActions.contains(WebCore::TouchAction::PanX);
-                _preventsPanningInYAxis = !touchActionData->touchActions.contains(WebCore::TouchAction::PanY);
-            }
</del><ins>+            scrollingCoordinator->setTouchActionsForTouchIdentifier(touchActions, touchPoint.identifier());
+
+            if (!touchActions.contains(WebCore::TouchAction::PinchZoom))
+                _webView.scrollView.pinchGestureRecognizer.enabled = NO;
+            _preventsPanningInXAxis = !touchActions.contains(WebCore::TouchAction::PanX);
+            _preventsPanningInYAxis = !touchActions.contains(WebCore::TouchAction::PanY);
+
</ins><span class="cx">         } else if (phase == WebKit::WebPlatformTouchPoint::TouchReleased || phase == WebKit::WebPlatformTouchPoint::TouchCancelled)
</span><del>-            scrollingCoordinator->clearTouchDataForTouchIdentifier(touchPoint.identifier());
</del><ins>+            scrollingCoordinator->clearTouchActionsForTouchIdentifier(touchPoint.identifier());
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>