- Revision
- 247212
- Author
- [email protected]
- Date
- 2019-07-08 11:00:33 -0700 (Mon, 08 Jul 2019)
Log Message
[Pointer Events] "touch-action: none" does not prevent double-tap-to-zoom
https://bugs.webkit.org/show_bug.cgi?id=199571
<rdar://problem/51715002>
Reviewed by Wenson Hsieh.
Source/WebKit:
We add a new WKTouchActionGestureRecognizerDelegate method to check whether a gesture recognizer may lead to
zooming the page as a result of double-tapping, which can be caused by two different gesture recognizers
managed by WKContentViewInteraction. If that delegate method returns true and we have "touch-action: none"
set for this touch, we cause those gesture recognizers to fail and prevent double-tap-to-zoom behavior.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView gestureRecognizerMayDoubleTapToZoomWebView:]):
* UIProcess/ios/WKTouchActionGestureRecognizer.h:
* UIProcess/ios/WKTouchActionGestureRecognizer.mm:
(-[WKTouchActionGestureRecognizer canPreventGestureRecognizer:]):
LayoutTests:
Add two new tests that check that setting "touch-action: none" on an element does not allow double-tap-to-zoom
and that "touch-action: manipulation" allows it.
* pointerevents/ios/touch-action-manipulation-double-tap-to-zoom-expected.txt: Added.
* pointerevents/ios/touch-action-manipulation-double-tap-to-zoom.html: Added.
* pointerevents/ios/touch-action-none-double-tap-to-zoom-expected.txt: Added.
* pointerevents/ios/touch-action-none-double-tap-to-zoom.html: Added.
* pointerevents/utils.js:
(const.ui.new.UIController.prototype.doubleTapToZoom):
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (247211 => 247212)
--- trunk/LayoutTests/ChangeLog 2019-07-08 17:46:27 UTC (rev 247211)
+++ trunk/LayoutTests/ChangeLog 2019-07-08 18:00:33 UTC (rev 247212)
@@ -1,3 +1,21 @@
+2019-07-08 Antoine Quint <[email protected]>
+
+ [Pointer Events] "touch-action: none" does not prevent double-tap-to-zoom
+ https://bugs.webkit.org/show_bug.cgi?id=199571
+ <rdar://problem/51715002>
+
+ Reviewed by Wenson Hsieh.
+
+ Add two new tests that check that setting "touch-action: none" on an element does not allow double-tap-to-zoom
+ and that "touch-action: manipulation" allows it.
+
+ * pointerevents/ios/touch-action-manipulation-double-tap-to-zoom-expected.txt: Added.
+ * pointerevents/ios/touch-action-manipulation-double-tap-to-zoom.html: Added.
+ * pointerevents/ios/touch-action-none-double-tap-to-zoom-expected.txt: Added.
+ * pointerevents/ios/touch-action-none-double-tap-to-zoom.html: Added.
+ * pointerevents/utils.js:
+ (const.ui.new.UIController.prototype.doubleTapToZoom):
+
2019-07-08 Charlie Turner <[email protected]>
[GStreamer] media/video-volume.html broken after switching from cubic to linear scaling
Added: trunk/LayoutTests/pointerevents/ios/touch-action-manipulation-double-tap-to-zoom-expected.txt (0 => 247212)
--- trunk/LayoutTests/pointerevents/ios/touch-action-manipulation-double-tap-to-zoom-expected.txt (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-manipulation-double-tap-to-zoom-expected.txt 2019-07-08 18:00:33 UTC (rev 247212)
@@ -0,0 +1,3 @@
+
+PASS Testing that setting touch-action: manipulation on an element allows double tap to zoom.
+
Added: trunk/LayoutTests/pointerevents/ios/touch-action-manipulation-double-tap-to-zoom.html (0 => 247212)
--- trunk/LayoutTests/pointerevents/ios/touch-action-manipulation-double-tap-to-zoom.html (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-manipulation-double-tap-to-zoom.html 2019-07-08 18:00:33 UTC (rev 247212)
@@ -0,0 +1,33 @@
+<!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+<meta charset=utf-8>
+<meta name="viewport">
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+'use strict';
+
+target_test({ width: "200px", height: "200px" }, (target, test) => {
+ document.body.style.width = "2000px";
+ document.body.style.height = "2000px";
+
+ target.style.touchAction = "manipulation";
+
+ requestAnimationFrame(() => {
+ const initialPageScaleFactor = window.internals.pageScaleFactor();
+ ui.doubleTapToZoom({ x: 10, y: 10 }).then(() => {
+ assert_not_equals(window.internals.pageScaleFactor(), initialPageScaleFactor, "The page was scaled.");
+ test.done();
+ });
+ })
+
+}, "Testing that setting touch-action: manipulation on an element allows double tap to zoom.");
+
+</script>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/pointerevents/ios/touch-action-none-double-tap-to-zoom-expected.txt (0 => 247212)
--- trunk/LayoutTests/pointerevents/ios/touch-action-none-double-tap-to-zoom-expected.txt (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-none-double-tap-to-zoom-expected.txt 2019-07-08 18:00:33 UTC (rev 247212)
@@ -0,0 +1,3 @@
+
+PASS Testing that setting touch-action: none on an element prevents double tap to zoom.
+
Added: trunk/LayoutTests/pointerevents/ios/touch-action-none-double-tap-to-zoom.html (0 => 247212)
--- trunk/LayoutTests/pointerevents/ios/touch-action-none-double-tap-to-zoom.html (rev 0)
+++ trunk/LayoutTests/pointerevents/ios/touch-action-none-double-tap-to-zoom.html 2019-07-08 18:00:33 UTC (rev 247212)
@@ -0,0 +1,33 @@
+<!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+<meta charset=utf-8>
+<meta name="viewport">
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+'use strict';
+
+target_test({ width: "200px", height: "200px" }, (target, test) => {
+ document.body.style.width = "2000px";
+ document.body.style.height = "2000px";
+
+ target.style.touchAction = "none";
+
+ requestAnimationFrame(() => {
+ const initialPageScaleFactor = window.internals.pageScaleFactor();
+ ui.doubleTapToZoom({ x: 10, y: 10 }).then(() => {
+ assert_equals(window.internals.pageScaleFactor(), initialPageScaleFactor, "The page was not scaled.");
+ test.done();
+ });
+ })
+
+}, "Testing that setting touch-action: none on an element prevents double tap to zoom.");
+
+</script>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/LayoutTests/pointerevents/utils.js (247211 => 247212)
--- trunk/LayoutTests/pointerevents/utils.js 2019-07-08 17:46:27 UTC (rev 247211)
+++ trunk/LayoutTests/pointerevents/utils.js 2019-07-08 18:00:33 UTC (rev 247212)
@@ -123,6 +123,15 @@
return this._run(`uiController.singleTapAtPoint(${options.x}, ${options.y})`);
}
+ doubleTapToZoom(options)
+ {
+ const durationInSeconds = 0.35;
+ return new Promise(resolve => this._run(`uiController.doubleTapAtPoint(${options.x}, ${options.y})`).then(() =>
+ setTimeout(resolve, durationInSeconds * 1000)
+ ));
+ return this._run();
+ }
+
pinchOut(options)
{
options.x = options.x || 0;
Modified: trunk/Source/WebKit/ChangeLog (247211 => 247212)
--- trunk/Source/WebKit/ChangeLog 2019-07-08 17:46:27 UTC (rev 247211)
+++ trunk/Source/WebKit/ChangeLog 2019-07-08 18:00:33 UTC (rev 247212)
@@ -1,3 +1,22 @@
+2019-07-08 Antoine Quint <[email protected]>
+
+ [Pointer Events] "touch-action: none" does not prevent double-tap-to-zoom
+ https://bugs.webkit.org/show_bug.cgi?id=199571
+ <rdar://problem/51715002>
+
+ Reviewed by Wenson Hsieh.
+
+ We add a new WKTouchActionGestureRecognizerDelegate method to check whether a gesture recognizer may lead to
+ zooming the page as a result of double-tapping, which can be caused by two different gesture recognizers
+ managed by WKContentViewInteraction. If that delegate method returns true and we have "touch-action: none"
+ set for this touch, we cause those gesture recognizers to fail and prevent double-tap-to-zoom behavior.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView gestureRecognizerMayDoubleTapToZoomWebView:]):
+ * UIProcess/ios/WKTouchActionGestureRecognizer.h:
+ * UIProcess/ios/WKTouchActionGestureRecognizer.mm:
+ (-[WKTouchActionGestureRecognizer canPreventGestureRecognizer:]):
+
2019-07-08 Per Arne Vollan <[email protected]>
[iOS] WebContent processes should not globally allow mach lookup to the AX server.
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (247211 => 247212)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-07-08 17:46:27 UTC (rev 247211)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2019-07-08 18:00:33 UTC (rev 247212)
@@ -1403,6 +1403,11 @@
return NO;
}
+- (BOOL)gestureRecognizerMayDoubleTapToZoomWebView:(UIGestureRecognizer *)gestureRecognizer
+{
+ return gestureRecognizer == _doubleTapGestureRecognizer || gestureRecognizer == _twoFingerDoubleTapGestureRecognizer;
+}
+
- (NSMapTable<NSNumber *, UITouch *> *)touchActionActiveTouches
{
return [_touchEventGestureRecognizer activeTouchesByIdentifier];
Modified: trunk/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.h (247211 => 247212)
--- trunk/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.h 2019-07-08 17:46:27 UTC (rev 247211)
+++ trunk/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.h 2019-07-08 18:00:33 UTC (rev 247212)
@@ -39,6 +39,7 @@
@protocol WKTouchActionGestureRecognizerDelegate <NSObject>
- (BOOL)gestureRecognizerMayPinchToZoomWebView:(UIGestureRecognizer *)gestureRecognizer;
+- (BOOL)gestureRecognizerMayDoubleTapToZoomWebView:(UIGestureRecognizer *)gestureRecognizer;
- (NSMapTable<NSNumber *, UITouch *> *)touchActionActiveTouches;
@end
Modified: trunk/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.mm (247211 => 247212)
--- trunk/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.mm 2019-07-08 17:46:27 UTC (rev 247211)
+++ trunk/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.mm 2019-07-08 18:00:33 UTC (rev 247212)
@@ -91,7 +91,10 @@
if (_touchActionsByTouchIdentifier.isEmpty())
return NO;
- if (![_touchActionDelegate gestureRecognizerMayPinchToZoomWebView:preventedGestureRecognizer])
+ auto mayPinchToZoom = [_touchActionDelegate gestureRecognizerMayPinchToZoomWebView:preventedGestureRecognizer];
+ auto mayDoubleTapToZoom = [_touchActionDelegate gestureRecognizerMayDoubleTapToZoomWebView:preventedGestureRecognizer];
+
+ if (!mayPinchToZoom && !mayDoubleTapToZoom)
return NO;
// Now that we've established that this gesture recognizer may yield an interaction that is preventable by the "touch-action"
@@ -103,8 +106,11 @@
auto iterator = _touchActionsByTouchIdentifier.find([touchIdentifier unsignedIntegerValue]);
if (iterator != _touchActionsByTouchIdentifier.end() && [[activeTouches objectForKey:touchIdentifier].gestureRecognizers containsObject:preventedGestureRecognizer]) {
// Pinch-to-zoom is only allowed if "pinch-zoom" or "manipulation" is specified.
- if (!iterator->value.containsAny({ WebCore::TouchAction::PinchZoom, WebCore::TouchAction::Manipulation }))
+ if (mayPinchToZoom && !iterator->value.containsAny({ WebCore::TouchAction::PinchZoom, WebCore::TouchAction::Manipulation }))
return YES;
+ // Double-tap-to-zoom is only disallowed if "none" is specified.
+ if (mayDoubleTapToZoom && iterator->value.contains(WebCore::TouchAction::None))
+ return YES;
}
}