WebKit Bugzilla
Attachment 373623 Details for
Bug 199571
: [Pointer Events] "touch-action: none" does not prevent double-tap-to-zoom
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199571-20190708133918.patch (text/plain), 10.74 KB, created by
Antoine Quint
on 2019-07-08 04:39:20 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Antoine Quint
Created:
2019-07-08 04:39:20 PDT
Size:
10.74 KB
patch
obsolete
>Subversion Revision: 247206 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 03ef68d1c17eda36b0d281685377e41ef4079f03..fa05867dd7b618e9ef6a91fbd64d0445595e6f33 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,22 @@ >+2019-07-08 Antoine Quint <graouts@apple.com> >+ >+ [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 NOBODY (OOPS!). >+ >+ 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-07 Antoine Quint <graouts@apple.com> > > [Pointer Events] touch-action should affect the behavior of pinch-to-zoom to show tabs in Safari >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 479371bb5d6b3044bef2a209506a5cee92c4d830..8326b98c6df36b8f5078c160780cbf211d713c28 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -1403,6 +1403,11 @@ - (BOOL)gestureRecognizerMayPinchToZoomWebView:(UIGestureRecognizer *)gestureRec > return NO; > } > >+- (BOOL)gestureRecognizerMayDoubleTapToZoomWebView:(UIGestureRecognizer *)gestureRecognizer >+{ >+ return gestureRecognizer == _doubleTapGestureRecognizer || gestureRecognizer == _twoFingerDoubleTapGestureRecognizer; >+} >+ > - (NSMapTable<NSNumber *, UITouch *> *)touchActionActiveTouches > { > return [_touchEventGestureRecognizer activeTouchesByIdentifier]; >diff --git a/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.h b/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.h >index 4afa34b5b9dd664d964f77cb27e06fea1c1016f6..2a3f51a5593c50328bc859c6575d008070d5dff2 100644 >--- a/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.h >+++ b/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.h >@@ -39,6 +39,7 @@ > > @protocol WKTouchActionGestureRecognizerDelegate <NSObject> > - (BOOL)gestureRecognizerMayPinchToZoomWebView:(UIGestureRecognizer *)gestureRecognizer; >+- (BOOL)gestureRecognizerMayDoubleTapToZoomWebView:(UIGestureRecognizer *)gestureRecognizer; > - (NSMapTable<NSNumber *, UITouch *> *)touchActionActiveTouches; > @end > >diff --git a/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.mm b/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.mm >index 835fc658e7c733d40799635c5ff33c068219b0d7..36fa845ccce772533a28666a275115413e579b49 100644 >--- a/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.mm >+++ b/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.mm >@@ -91,7 +91,10 @@ - (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecog > 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,7 +106,10 @@ - (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecog > 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; > } > } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index f2e527329a69f33640cc017ac5fea2529f3192ec..5aec8c6ad4c69877d33300ee3710970fc8a98f58 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,21 @@ >+2019-07-08 Antoine Quint <graouts@apple.com> >+ >+ [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 NOBODY (OOPS!). >+ >+ 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 Antoine Quint <graouts@apple.com> > > [Pointer Events] Enable only on the most recent version of the supported iOS family >diff --git a/LayoutTests/pointerevents/ios/touch-action-manipulation-double-tap-to-zoom-expected.txt b/LayoutTests/pointerevents/ios/touch-action-manipulation-double-tap-to-zoom-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..0489e34a9631b4f913b883afb5253765eb099737 >--- /dev/null >+++ b/LayoutTests/pointerevents/ios/touch-action-manipulation-double-tap-to-zoom-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Testing that setting touch-action: manipulation on an element allows double tap to zoom. >+ >diff --git a/LayoutTests/pointerevents/ios/touch-action-manipulation-double-tap-to-zoom.html b/LayoutTests/pointerevents/ios/touch-action-manipulation-double-tap-to-zoom.html >new file mode 100644 >index 0000000000000000000000000000000000000000..418cd3cd6b151e3cf1436560fe0f6bb0793174a9 >--- /dev/null >+++ b/LayoutTests/pointerevents/ios/touch-action-manipulation-double-tap-to-zoom.html >@@ -0,0 +1,33 @@ >+<!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] --> >+<html> >+<head> >+<meta charset=utf-8> >+<meta name="viewport"> >+</head> >+<body> >+<script src="../../resources/testharness.js"></script> >+<script src="../../resources/testharnessreport.js"></script> >+<script src="../utils.js"></script> >+<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 >diff --git a/LayoutTests/pointerevents/ios/touch-action-none-double-tap-to-zoom-expected.txt b/LayoutTests/pointerevents/ios/touch-action-none-double-tap-to-zoom-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..615738a33ba9d563eec5abb162b7018c9a28baae >--- /dev/null >+++ b/LayoutTests/pointerevents/ios/touch-action-none-double-tap-to-zoom-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Testing that setting touch-action: none on an element prevents double tap to zoom. >+ >diff --git a/LayoutTests/pointerevents/ios/touch-action-none-double-tap-to-zoom.html b/LayoutTests/pointerevents/ios/touch-action-none-double-tap-to-zoom.html >new file mode 100644 >index 0000000000000000000000000000000000000000..1efa00d5c6ed1dedcbbb621595f263f5e59295fd >--- /dev/null >+++ b/LayoutTests/pointerevents/ios/touch-action-none-double-tap-to-zoom.html >@@ -0,0 +1,33 @@ >+<!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] --> >+<html> >+<head> >+<meta charset=utf-8> >+<meta name="viewport"> >+</head> >+<body> >+<script src="../../resources/testharness.js"></script> >+<script src="../../resources/testharnessreport.js"></script> >+<script src="../utils.js"></script> >+<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 >diff --git a/LayoutTests/pointerevents/utils.js b/LayoutTests/pointerevents/utils.js >index 48921966ba945f8fa5f3b574b9bada81ac4777df..20878e8d7b48f42444f34cd02afbd8ebdfee192d 100644 >--- a/LayoutTests/pointerevents/utils.js >+++ b/LayoutTests/pointerevents/utils.js >@@ -123,6 +123,15 @@ const ui = new (class UIController { > 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;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
wenson_hsieh
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199571
: 373623