[iOS] Correctly handle overlapping regions for elements with a touch-action property
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 May 2019 08:34:23 +0000 (08:34 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 May 2019 08:34:23 +0000 (08:34 +0000)
commit35572e08f46730cef318fd714d0d7967f7799453
tree5f8f6aaceca7825513b4c73b4be0b59722a830ef
parent0c15611723bf0d95c91562e667001d8e4bc52c38
[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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245112 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/pointerevents/ios/touch-action-none-overlap-expected.txt [new file with mode: 0644]
LayoutTests/pointerevents/ios/touch-action-none-overlap.html [new file with mode: 0644]
LayoutTests/pointerevents/ios/touch-action-pan-x-overlap-expected.txt [new file with mode: 0644]
LayoutTests/pointerevents/ios/touch-action-pan-x-overlap.html [new file with mode: 0644]
LayoutTests/pointerevents/ios/touch-action-pan-y-overlap-expected.txt [new file with mode: 0644]
LayoutTests/pointerevents/ios/touch-action-pan-y-overlap.html [new file with mode: 0644]
LayoutTests/pointerevents/ios/touch-action-pinch-zoom-overlap-expected.txt [new file with mode: 0644]
LayoutTests/pointerevents/ios/touch-action-pinch-zoom-overlap.html [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/PageClient.h
Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp
Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm
Source/WebKit/UIProcess/ios/PageClientImplIOS.h
Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm