haikuwebkit/LayoutTests/pointerevents/ios/touch-action-pan-y-overlap....

43 lines
1.7 KiB
HTML
Raw Permalink Normal View History

[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. Canonical link: https://commits.webkit.org/211876@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245112 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-09 08:34:23 +00:00
<!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>