Title: [280006] trunk/Source/WebKit
Revision
280006
Author
[email protected]
Date
2021-07-16 16:22:27 -0700 (Fri, 16 Jul 2021)

Log Message

REGRESSION (r277820): Can't scroll up and down using trackpad in Mail message viewer when in Slide Over
https://bugs.webkit.org/show_bug.cgi?id=228033
rdar://80663917

Reviewed by Tim Horton.

This started happening after the changes in r277820, since UIHoverGestureRecognizer contained several internal
facilities in UIKit for avoiding failure dependencies to other (non-hover) gestures. After removing the
subclass, various UIKit gestures now attempt to add failure requirements to WKMouseGestureRecognizer, thereby
linking WKMouseGestureRecognizer to other gestures in the gesture dependency graph.

This means that all gestures connected to the same subgraph as WKMouseGestureRecognizer are unable to be reset
until WKMouseGestureRecognizer transitions to either Ended or Failed state; however, since this only happens
once the trackpad goes into idle state, these subgraph-connected gestures can effectively only recognize once
per trackpad interaction (resetting only after the trackpad goes idle). Since scroll view pan gesture
recognizers are indirectly connected to WKMouseGestureRecognizer in Slide Over mode, this manifests in scrolling
being unresponsive after an initial scroll gesture has ended.

To address this, we subclass UIHoverGestureRecognizer once again, and (unfortunately) also restore the IPI
override for `-_shouldReceiveTouch:forEvent:recognizerView:`, to ensure that we're still able to detect and
dispatch `mousedown` and `mousemove` events.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView gestureRecognizer:shouldReceiveTouch:]):
(-[WKContentView gestureRecognizer:shouldReceivePress:]):

Remove a couple of delegate overridees here, which are now unnecessary since WKMouseGestureRecognizer is a
UIHoverGestureRecognizer once again.

* UIProcess/ios/WKMouseGestureRecognizer.h:
* UIProcess/ios/WKMouseGestureRecognizer.mm:
(-[WKMouseGestureRecognizer _shouldReceiveTouch:forEvent:recognizerView:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (280005 => 280006)


--- trunk/Source/WebKit/ChangeLog	2021-07-16 22:59:36 UTC (rev 280005)
+++ trunk/Source/WebKit/ChangeLog	2021-07-16 23:22:27 UTC (rev 280006)
@@ -1,3 +1,38 @@
+2021-07-16  Wenson Hsieh  <[email protected]>
+
+        REGRESSION (r277820): Can't scroll up and down using trackpad in Mail message viewer when in Slide Over
+        https://bugs.webkit.org/show_bug.cgi?id=228033
+        rdar://80663917
+
+        Reviewed by Tim Horton.
+
+        This started happening after the changes in r277820, since UIHoverGestureRecognizer contained several internal
+        facilities in UIKit for avoiding failure dependencies to other (non-hover) gestures. After removing the
+        subclass, various UIKit gestures now attempt to add failure requirements to WKMouseGestureRecognizer, thereby
+        linking WKMouseGestureRecognizer to other gestures in the gesture dependency graph.
+
+        This means that all gestures connected to the same subgraph as WKMouseGestureRecognizer are unable to be reset
+        until WKMouseGestureRecognizer transitions to either Ended or Failed state; however, since this only happens
+        once the trackpad goes into idle state, these subgraph-connected gestures can effectively only recognize once
+        per trackpad interaction (resetting only after the trackpad goes idle). Since scroll view pan gesture
+        recognizers are indirectly connected to WKMouseGestureRecognizer in Slide Over mode, this manifests in scrolling
+        being unresponsive after an initial scroll gesture has ended.
+
+        To address this, we subclass UIHoverGestureRecognizer once again, and (unfortunately) also restore the IPI
+        override for `-_shouldReceiveTouch:forEvent:recognizerView:`, to ensure that we're still able to detect and
+        dispatch `mousedown` and `mousemove` events.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView gestureRecognizer:shouldReceiveTouch:]):
+        (-[WKContentView gestureRecognizer:shouldReceivePress:]):
+
+        Remove a couple of delegate overridees here, which are now unnecessary since WKMouseGestureRecognizer is a
+        UIHoverGestureRecognizer once again.
+
+        * UIProcess/ios/WKMouseGestureRecognizer.h:
+        * UIProcess/ios/WKMouseGestureRecognizer.mm:
+        (-[WKMouseGestureRecognizer _shouldReceiveTouch:forEvent:recognizerView:]):
+
 2021-07-16  Kate Cheney  <[email protected]>
 
         macOS Safari network sessions not being marked as being from a browser

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (280005 => 280006)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-07-16 22:59:36 UTC (rev 280005)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2021-07-16 23:22:27 UTC (rev 280006)
@@ -1758,9 +1758,6 @@
     if (gestureRecognizer != _mouseGestureRecognizer && [_mouseGestureRecognizer mouseTouch] == touch)
         return NO;
 
-    if (gestureRecognizer == _mouseGestureRecognizer)
-        return [_mouseGestureRecognizer mouseTouch] == touch;
-
     if (gestureRecognizer == _doubleTapGestureRecognizer || gestureRecognizer == _nonBlockingDoubleTapGestureRecognizer)
         return touch.type != UITouchTypeIndirectPointer;
 #endif
@@ -1783,10 +1780,6 @@
 
 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceivePress:(UIPress *)press
 {
-#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
-    if (gestureRecognizer == _mouseGestureRecognizer)
-        return NO;
-#endif
 #if ENABLE(HOVER_GESTURE_RECOGNIZER)
     if (gestureRecognizer == _hoverGestureRecognizer)
         return NO;

Modified: trunk/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.h (280005 => 280006)


--- trunk/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.h	2021-07-16 22:59:36 UTC (rev 280005)
+++ trunk/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.h	2021-07-16 23:22:27 UTC (rev 280006)
@@ -25,10 +25,10 @@
 
 #if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
 
-#import <UIKit/UIGestureRecognizer.h>
+#import <UIKit/UIHoverGestureRecognizer.h>
 #import "NativeWebMouseEvent.h"
 
-@interface WKMouseGestureRecognizer : UIGestureRecognizer
+@interface WKMouseGestureRecognizer : UIHoverGestureRecognizer
 
 - (std::optional<CGPoint>)lastMouseLocation;
 - (WebKit::NativeWebMouseEvent *)lastMouseEvent;

Modified: trunk/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.mm (280005 => 280006)


--- trunk/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.mm	2021-07-16 22:59:36 UTC (rev 280005)
+++ trunk/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.mm	2021-07-16 23:22:27 UTC (rev 280006)
@@ -75,6 +75,13 @@
     }
 }
 
+- (BOOL)_shouldReceiveTouch:(UITouch *)touch forEvent:(UIEvent *)event recognizerView:(id)gestureOwner
+{
+    // FIXME: We should move off of this UIKit IPI method once we have a viable SPI or API alternative
+    // for opting a UIHoverGestureRecognizer subclass into receiving UITouches. See also: rdar://80700227.
+    return touch == _currentTouch;
+}
+
 - (WebKit::NativeWebMouseEvent *)lastMouseEvent
 {
     return _lastEvent.get();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to