- Revision
- 241760
- Author
- [email protected]
- Date
- 2019-02-19 02:45:48 -0800 (Tue, 19 Feb 2019)
Log Message
[iOS] "touch-action: none" should not prevent text selection or tapping on a link
https://bugs.webkit.org/show_bug.cgi?id=194812
<rdar://problem/47901131>
Reviewed by Dean Jackson.
Source/WebKit:
We shouldn't prevent all gestures to be disabled when "touch-action: none" is set and instead follow the same code path we would use should
"pan-x", "pan-y" or "pinch-zoom" be used.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _handleTouchActionsForTouchEvent:]):
LayoutTests:
Add a new test which checks that tapping on a link with "touch-action: none" does not prevent navigation.
* pointerevents/ios/over-enter-out-leave.html:
* pointerevents/ios/touch-action-none-link-traversal-expected.txt: Added.
* pointerevents/ios/touch-action-none-link-traversal.html: Added.
* pointerevents/utils.js: Since we now have two tests performing a tap, we add a ui.tap() method which is a wrapper for uiController.singleTapAtPoint().
(const.ui.new.UIController.prototype.tap):
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (241759 => 241760)
--- trunk/LayoutTests/ChangeLog 2019-02-19 10:22:14 UTC (rev 241759)
+++ trunk/LayoutTests/ChangeLog 2019-02-19 10:45:48 UTC (rev 241760)
@@ -1,3 +1,19 @@
+2019-02-19 Antoine Quint <[email protected]>
+
+ [iOS] "touch-action: none" should not prevent text selection or tapping on a link
+ https://bugs.webkit.org/show_bug.cgi?id=194812
+ <rdar://problem/47901131>
+
+ Reviewed by Dean Jackson.
+
+ Add a new test which checks that tapping on a link with "touch-action: none" does not prevent navigation.
+
+ * pointerevents/ios/over-enter-out-leave.html:
+ * pointerevents/ios/touch-action-none-link-traversal-expected.txt: Added.
+ * pointerevents/ios/touch-action-none-link-traversal.html: Added.
+ * pointerevents/utils.js: Since we now have two tests performing a tap, we add a ui.tap() method which is a wrapper for uiController.singleTapAtPoint().
+ (const.ui.new.UIController.prototype.tap):
+
2019-02-18 Alex Christensen <[email protected]>
Adjust test expectations after r241754
Modified: trunk/LayoutTests/pointerevents/ios/over-enter-out-leave.html (241759 => 241760)
--- trunk/LayoutTests/pointerevents/ios/over-enter-out-leave.html 2019-02-19 10:22:14 UTC (rev 241759)
+++ trunk/LayoutTests/pointerevents/ios/over-enter-out-leave.html 2019-02-19 10:45:48 UTC (rev 241760)
@@ -18,11 +18,7 @@
const eventTracker = new EventTracker(target, ["pointerover", "pointerenter", "pointerdown", "pointerup", "pointerout", "pointerleave"]);
- const touch = ui.finger();
- ui.sequence([
- touch.begin({ x: 100, y: 100 }),
- touch.end()
- ]).then(() => {
+ ui.tap({ x: 100, y: 100 }).then(() => {
eventTracker.assertMatchesEvents([
{ type: "pointerover", x: 100, y: 100, isPrimary: true },
{ type: "pointerenter", x: 100, y: 100, isPrimary: true },
Added: trunk/LayoutTests/pointerevents/ios/touch-action-none-link-traversal-expected.txt (0 => 241760)
--- trunk/LayoutTests/pointerevents/ios/touch-action-none-link-traversal-expected.txt (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-none-link-traversal-expected.txt 2019-02-19 10:45:48 UTC (rev 241760)
@@ -0,0 +1,4 @@
+
+
+PASS Testing that setting touch-action: none allows link traversal.
+
Added: trunk/LayoutTests/pointerevents/ios/touch-action-none-link-traversal.html (0 => 241760)
--- trunk/LayoutTests/pointerevents/ios/touch-action-none-link-traversal.html (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-none-link-traversal.html 2019-02-19 10:45:48 UTC (rev 241760)
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<style>
+
+iframe {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 400px;
+ height: 400px;
+ touch-action: none;
+}
+
+</style>
+</head>
+<body>
+<iframe></iframe>
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+'use strict';
+
+async_test(test => {
+ const iframe = document.body.firstElementChild;
+ const link = iframe.contentDocument.body.appendChild(document.createElement("a"));
+ link.href = ""
+ link.setAttribute("style", `
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ `);
+
+ assert_equals(iframe.contentWindow.location.href, "about:blank", "The iframe initially has no URL.");
+
+ iframe.addEventListener("load", () => {
+ assert_true(iframe.contentWindow.location.href.includes("disabled.html"), "Upon navigation the URL has a location.");
+ test.done();
+ });
+
+ ui.tap({ x: 100, y: 100 });
+}, "Testing that setting touch-action: none allows link traversal.");
+
+</script>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/LayoutTests/pointerevents/utils.js (241759 => 241760)
--- trunk/LayoutTests/pointerevents/utils.js 2019-02-19 10:22:14 UTC (rev 241759)
+++ trunk/LayoutTests/pointerevents/utils.js 2019-02-19 10:45:48 UTC (rev 241760)
@@ -112,6 +112,11 @@
return this._run(`uiController.dragFromPointToPoint(${from.x}, ${from.y}, ${to.x}, ${to.y}, ${durationInSeconds})`);
}
+ tap(options)
+ {
+ return this._run(`uiController.singleTapAtPoint(${options.x}, ${options.y})`);
+ }
+
pinchOut(options)
{
options.x = options.x || 0;
Modified: trunk/Source/WebKit/ChangeLog (241759 => 241760)
--- trunk/Source/WebKit/ChangeLog 2019-02-19 10:22:14 UTC (rev 241759)
+++ trunk/Source/WebKit/ChangeLog 2019-02-19 10:45:48 UTC (rev 241760)
@@ -1,3 +1,17 @@
+2019-02-19 Antoine Quint <[email protected]>
+
+ [iOS] "touch-action: none" should not prevent text selection or tapping on a link
+ https://bugs.webkit.org/show_bug.cgi?id=194812
+ <rdar://problem/47901131>
+
+ Reviewed by Dean Jackson.
+
+ We shouldn't prevent all gestures to be disabled when "touch-action: none" is set and instead follow the same code path we would use should
+ "pan-x", "pan-y" or "pinch-zoom" be used.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _handleTouchActionsForTouchEvent:]):
+
2019-02-18 Alex Christensen <[email protected]>
Revert functional part of r241451
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (241759 => 241760)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-02-19 10:22:14 UTC (rev 241759)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-02-19 10:45:48 UTC (rev 241760)
@@ -1226,19 +1226,15 @@
auto phase = touchPoint.phase();
if (phase == WebKit::WebPlatformTouchPoint::TouchPressed) {
auto touchActionData = scrollingCoordinator->touchActionDataAtPoint(touchPoint.location());
- if (!touchActionData)
+ if (!touchActionData || touchActionData->touchActions.contains(WebCore::TouchAction::Manipulation))
continue;
- if (touchActionData->touchActions == WebCore::TouchAction::None)
- [_touchEventGestureRecognizer setDefaultPrevented:YES];
- else if (!touchActionData->touchActions.contains(WebCore::TouchAction::Manipulation)) {
- 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);
- }
+ 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);
}
} else if (phase == WebKit::WebPlatformTouchPoint::TouchReleased || phase == WebKit::WebPlatformTouchPoint::TouchCancelled)
scrollingCoordinator->clearTouchDataForTouchIdentifier(touchPoint.identifier());