Title: [247206] trunk/Source/WebKit
Revision
247206
Author
[email protected]
Date
2019-07-08 04:26:24 -0700 (Mon, 08 Jul 2019)

Log Message

[Pointer Events] touch-action should affect the behavior of pinch-to-zoom to show tabs in Safari
https://bugs.webkit.org/show_bug.cgi?id=199560
<rdar://problem/52742265>

Reviewed by Dean Jackson.

There are other UIPinchGestureRecognizer objects that may lead to pinch-to-zoom behavior, for instance pinching
out to show open tabs in Safari on iOS. We add a new WKUIDelegatePrivate method that will allow Safari to indicate
that a UIPinchGestureRecognizer considered for prevention would lead to pinch-to-zoom behavior.

* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView gestureRecognizerMayPinchToZoomWebView:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (247205 => 247206)


--- trunk/Source/WebKit/ChangeLog	2019-07-08 11:22:06 UTC (rev 247205)
+++ trunk/Source/WebKit/ChangeLog	2019-07-08 11:26:24 UTC (rev 247206)
@@ -1,3 +1,19 @@
+2019-07-07  Antoine Quint  <[email protected]>
+
+        [Pointer Events] touch-action should affect the behavior of pinch-to-zoom to show tabs in Safari
+        https://bugs.webkit.org/show_bug.cgi?id=199560
+        <rdar://problem/52742265>
+
+        Reviewed by Dean Jackson.
+
+        There are other UIPinchGestureRecognizer objects that may lead to pinch-to-zoom behavior, for instance pinching
+        out to show open tabs in Safari on iOS. We add a new WKUIDelegatePrivate method that will allow Safari to indicate
+        that a UIPinchGestureRecognizer considered for prevention would lead to pinch-to-zoom behavior.
+
+        * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView gestureRecognizerMayPinchToZoomWebView:]):
+
 2019-07-08  Antoine Quint  <[email protected]>
 
         [Pointer Events] Enable only on the most recent version of the supported iOS family

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (247205 => 247206)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2019-07-08 11:22:06 UTC (rev 247205)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2019-07-08 11:26:24 UTC (rev 247206)
@@ -186,6 +186,7 @@
 - (void)_webView:(WKWebView *)webView didChangeSafeAreaShouldAffectObscuredInsets:(BOOL)safeAreaShouldAffectObscuredInsets WK_API_AVAILABLE(ios(11.0));
 - (void)_webView:(WKWebView *)webView didPresentFocusedElementViewController:(UIViewController *)controller WK_API_AVAILABLE(ios(12.0));
 - (void)_webView:(WKWebView *)webView didDismissFocusedElementViewController:(UIViewController *)controller WK_API_AVAILABLE(ios(12.0));
+- (BOOL)_webView:(WKWebView *)webView gestureRecognizerCouldPinch:(UIGestureRecognizer *)gestureRecognizer WK_API_AVAILABLE(ios(13.0));
 
 /*! @abstract Allows your app to determine whether or not the given security origin should have access to the device's orientation and motion.
  @param securityOrigin The security origin which requested access to the device's orientation and motion.

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (247205 => 247206)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-07-08 11:22:06 UTC (rev 247205)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-07-08 11:26:24 UTC (rev 247206)
@@ -1390,7 +1390,17 @@
 - (BOOL)gestureRecognizerMayPinchToZoomWebView:(UIGestureRecognizer *)gestureRecognizer
 {
     // The gesture recognizer is the main UIScrollView's UIPinchGestureRecognizer.
-    return gestureRecognizer == [_webView scrollView].pinchGestureRecognizer;
+    if (gestureRecognizer == [_webView scrollView].pinchGestureRecognizer)
+        return YES;
+
+    // The gesture recognizer is another UIPichGestureRecognizer known to lead to pinch-to-zoom.
+    if ([gestureRecognizer isKindOfClass:[UIPinchGestureRecognizer class]]) {
+        if (auto uiDelegate = static_cast<id<WKUIDelegatePrivate>>(_webView.UIDelegate)) {
+            if ([uiDelegate respondsToSelector:@selector(_webView:gestureRecognizerCouldPinch:)])
+                return [uiDelegate _webView:_webView gestureRecognizerCouldPinch:gestureRecognizer];
+        }
+    }
+    return NO;
 }
 
 - (NSMapTable<NSNumber *, UITouch *> *)touchActionActiveTouches
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to