WebKit Bugzilla
Attachment 373714 Details for
Bug 199618
: [Pointer Events] Scroll indicators should not show for scrollable content with touch-action: none
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199618-20190709162516.patch (text/plain), 8.81 KB, created by
Antoine Quint
on 2019-07-09 07:25:18 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Antoine Quint
Created:
2019-07-09 07:25:18 PDT
Size:
8.81 KB
patch
obsolete
>Subversion Revision: 247212 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 86ae6f5d27adcca1980f3d2de0e6293e89d14b35..290147ab28cff83f54b23eb447fb6b44c7559104 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,26 @@ >+2019-07-09 Antoine Quint <graouts@apple.com> >+ >+ [Pointer Events] Scroll indicators should not show for scrollable content with touch-action: none >+ https://bugs.webkit.org/show_bug.cgi?id=199618 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Even though we correctly didn't scroll when "touch-action: none" was specified on an element, we would only apply >+ scrolling constraints after the panning gesture was recognized and the backing UIScrollView would show its scroll >+ indicators. While this is correct when only "pan-x" or "pan-y" is specified, we should not show the scroll indicators >+ at all for "touch-action: none" since no scrolling should happen. >+ >+ To do this, we add a new method to the WKTouchActionGestureRecognizerDelegate protocol to indicate whether a given >+ gesture recognizer may pan content in the WKWebView. If the gesture recognizer is the top-level scroll view or one >+ created within the page to back "overflow: scroll" content or an iframe, we correctly make that gesture recognizer >+ fail to recognize if neither "pan-x" nor "pan-y" is specified for this touch identifier. >+ >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView gestureRecognizerMayPanWebView:]): >+ * UIProcess/ios/WKTouchActionGestureRecognizer.h: >+ * UIProcess/ios/WKTouchActionGestureRecognizer.mm: >+ (-[WKTouchActionGestureRecognizer canPreventGestureRecognizer:]): >+ > 2019-07-08 Antoine Quint <graouts@apple.com> > > [Pointer Events] "touch-action: none" does not prevent double-tap-to-zoom >diff --git a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >index 8326b98c6df36b8f5078c160780cbf211d713c28..be0110ae0faa4fb6b4061b0cad17817d57adaff5 100644 >--- a/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >+++ b/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >@@ -143,6 +143,7 @@ > > #if ENABLE(POINTER_EVENTS) > #import "RemoteScrollingCoordinatorProxy.h" >+#import "ScrollingTreeScrollingNodeDelegateIOS.h" > #import <WebCore/TouchAction.h> > #endif > >@@ -1387,6 +1388,23 @@ - (void)_handleTouchActionsForTouchEvent:(const WebKit::NativeWebTouchEvent&)tou > > #pragma mark - WKTouchActionGestureRecognizerDelegate implementation > >+- (BOOL)gestureRecognizerMayPanWebView:(UIGestureRecognizer *)gestureRecognizer >+{ >+ // The gesture recognizer is the main UIScrollView's UIPanGestureRecognizer. >+ if (gestureRecognizer == [_webView scrollView].panGestureRecognizer) >+ return YES; >+ >+ // The gesture recognizer is a child UIScrollView's UIPanGestureRecognizer created by WebKit. >+ if (auto* view = gestureRecognizer.view) { >+ if ([view isKindOfClass:[UIScrollView class]]) { >+ if (auto* delegate = ((UIScrollView*)view).delegate) >+ return [delegate isKindOfClass:[WKScrollingNodeScrollViewDelegate class]]; >+ } >+ } >+ >+ return NO; >+} >+ > - (BOOL)gestureRecognizerMayPinchToZoomWebView:(UIGestureRecognizer *)gestureRecognizer > { > // The gesture recognizer is the main UIScrollView's UIPinchGestureRecognizer. >diff --git a/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.h b/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.h >index 2a3f51a5593c50328bc859c6575d008070d5dff2..a3fe4c48e73063e9dc1f1802392b904e325bdd06 100644 >--- a/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.h >+++ b/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.h >@@ -38,6 +38,7 @@ > @end > > @protocol WKTouchActionGestureRecognizerDelegate <NSObject> >+- (BOOL)gestureRecognizerMayPanWebView:(UIGestureRecognizer *)gestureRecognizer; > - (BOOL)gestureRecognizerMayPinchToZoomWebView:(UIGestureRecognizer *)gestureRecognizer; > - (BOOL)gestureRecognizerMayDoubleTapToZoomWebView:(UIGestureRecognizer *)gestureRecognizer; > - (NSMapTable<NSNumber *, UITouch *> *)touchActionActiveTouches; >diff --git a/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.mm b/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.mm >index 36fa845ccce772533a28666a275115413e579b49..3da58d82fec7fd68a02f36542792f4b54901ac93 100644 >--- a/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.mm >+++ b/Source/WebKit/UIProcess/ios/WKTouchActionGestureRecognizer.mm >@@ -91,10 +91,11 @@ - (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecog > if (_touchActionsByTouchIdentifier.isEmpty()) > return NO; > >+ auto mayPan = [_touchActionDelegate gestureRecognizerMayPanWebView:preventedGestureRecognizer]; > auto mayPinchToZoom = [_touchActionDelegate gestureRecognizerMayPinchToZoomWebView:preventedGestureRecognizer]; > auto mayDoubleTapToZoom = [_touchActionDelegate gestureRecognizerMayDoubleTapToZoomWebView:preventedGestureRecognizer]; > >- if (!mayPinchToZoom && !mayDoubleTapToZoom) >+ if (!mayPan && !mayPinchToZoom && !mayDoubleTapToZoom) > return NO; > > // Now that we've established that this gesture recognizer may yield an interaction that is preventable by the "touch-action" >@@ -105,6 +106,10 @@ - (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecog > for (NSNumber *touchIdentifier in activeTouches) { > auto iterator = _touchActionsByTouchIdentifier.find([touchIdentifier unsignedIntegerValue]); > if (iterator != _touchActionsByTouchIdentifier.end() && [[activeTouches objectForKey:touchIdentifier].gestureRecognizers containsObject:preventedGestureRecognizer]) { >+ // Panning is only allowed if "pan-x", "pan-y" or "manipulation" is specified. Additional work is needed to respect individual values, but this takes >+ // care of the case where no panning is allowed. >+ if (mayPan && !iterator->value.containsAny({ WebCore::TouchAction::PanX, WebCore::TouchAction::PanY, WebCore::TouchAction::Manipulation })) >+ return YES; > // Pinch-to-zoom is only allowed if "pinch-zoom" or "manipulation" is specified. > if (mayPinchToZoom && !iterator->value.containsAny({ WebCore::TouchAction::PinchZoom, WebCore::TouchAction::Manipulation })) > return YES; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 706816370d42e45fca4ef261f60b7a56da77b6ab..c9ab554fd6899381c3346165a4d12b21e80df173 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,16 @@ >+2019-07-09 Antoine Quint <graouts@apple.com> >+ >+ [Pointer Events] Scroll indicators should not show for scrollable content with touch-action: none >+ https://bugs.webkit.org/show_bug.cgi?id=199618 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a new test that swipes "overflow: scroll" content which would show scroll indicators without scrolling >+ prior to this patch. >+ >+ * pointerevents/ios/touch-action-none-no-scroll-indicators-expected.html: Added. >+ * pointerevents/ios/touch-action-none-no-scroll-indicators.html: Added. >+ > 2019-07-08 Antoine Quint <graouts@apple.com> > > [Pointer Events] "touch-action: none" does not prevent double-tap-to-zoom >diff --git a/LayoutTests/pointerevents/ios/touch-action-none-no-scroll-indicators-expected.html b/LayoutTests/pointerevents/ios/touch-action-none-no-scroll-indicators-expected.html >new file mode 100644 >index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc >--- /dev/null >+++ b/LayoutTests/pointerevents/ios/touch-action-none-no-scroll-indicators-expected.html >@@ -0,0 +1 @@ >+ >diff --git a/LayoutTests/pointerevents/ios/touch-action-none-no-scroll-indicators.html b/LayoutTests/pointerevents/ios/touch-action-none-no-scroll-indicators.html >new file mode 100644 >index 0000000000000000000000000000000000000000..d38ac354a5540cbe355af921ca54ee1fcb91bcd7 >--- /dev/null >+++ b/LayoutTests/pointerevents/ios/touch-action-none-no-scroll-indicators.html >@@ -0,0 +1,36 @@ >+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] --> >+<html> >+<head> >+<meta charset=utf-8> >+<meta name="viewport" content="width=device-width, initial-scale=1"> >+<style> >+ >+ #container { >+ position: absolute; >+ left: 0; >+ top: 0; >+ width: 200px; >+ height: 200px; >+ overflow: scroll; >+ } >+ >+ #content { >+ position: absolute; >+ width: 200%; >+ height: 200%; >+ touch-action: none; >+ } >+ >+</style> >+</head> >+<body> >+<div id="container"><div id="content"></div></div> >+<script src="../utils.js"></script> >+<script> >+ >+if (window.testRunner) >+ ui.swipe({ x: 150, y: 150 }, { x: 50, y: 50 }).then(() => testRunner.notifyDone()); >+ >+</script> >+</body> >+</html> >\ No newline at end of file
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:
simon.fraser
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199618
: 373714