Title: [292715] trunk/Source/WebKit
- Revision
- 292715
- Author
- wenson_hs...@apple.com
- Date
- 2022-04-11 13:18:49 -0700 (Mon, 11 Apr 2022)
Log Message
REGRESSION (r289785): [iOS] Unable to double-click to select a word in a received email
https://bugs.webkit.org/show_bug.cgi?id=239055
rdar://90736710
Reviewed by Tim Horton.
Following r289785, double-clicking text in Mail message viewer on iOS (or more generally, any web view in an app
that does not have the "UIApplicationSupportsIndirectInputEvents" application plist key set to `YES`) produces a
selection that is immediately removed. This is because after double clicking, the synthetic click gesture fires
and immediately clears the selection.
In Safari (an application that sets UIApplicationSupportsIndirectInputEvents), the non-pointer gesture
recognizers (e.g. synthetic taps) don't fire because the type of the `UITouch` is `UITouchTypeIndirectPointer`,
which allows us to return `NO` from `-gestureRecognizer:shouldReceiveTouch:` for anything that is not the mouse
gesture recognizer's current mouse touch.
For apps that lack this plist key, the touch type remains `UITouchTypeDirect` to avoid breaking compatibility,
even for events that are generated via a pointing device (i.e. trackpad). This means that we no longer route
these events solely to the mouse gesture recognizer. To fix this, use `-_isPointerTouch` instead of
`-[UITouch type]` here. Unlike the latter, the former isn't affected by the "supports indirect input" plist key.
* Platform/spi/ios/UIKitSPI.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView gestureRecognizer:shouldReceiveTouch:]):
* UIProcess/ios/WKMouseGestureRecognizer.mm:
(-[WKMouseGestureRecognizer _shouldReceiveTouch:forEvent:recognizerView:]):
Also fix a similar bug here, where the check against `UITouchTypeIndirectPointer` instead of `-_isPointerEvent`
causes apps without the UIApplicationSupportsIndirectInputEvents key to lose the ability to listen for mousedown
and mouseup events when the user clicks via trackpad on iPad.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (292714 => 292715)
--- trunk/Source/WebKit/ChangeLog 2022-04-11 20:10:44 UTC (rev 292714)
+++ trunk/Source/WebKit/ChangeLog 2022-04-11 20:18:49 UTC (rev 292715)
@@ -1,3 +1,36 @@
+2022-04-11 Wenson Hsieh <wenson_hs...@apple.com>
+
+ REGRESSION (r289785): [iOS] Unable to double-click to select a word in a received email
+ https://bugs.webkit.org/show_bug.cgi?id=239055
+ rdar://90736710
+
+ Reviewed by Tim Horton.
+
+ Following r289785, double-clicking text in Mail message viewer on iOS (or more generally, any web view in an app
+ that does not have the "UIApplicationSupportsIndirectInputEvents" application plist key set to `YES`) produces a
+ selection that is immediately removed. This is because after double clicking, the synthetic click gesture fires
+ and immediately clears the selection.
+
+ In Safari (an application that sets UIApplicationSupportsIndirectInputEvents), the non-pointer gesture
+ recognizers (e.g. synthetic taps) don't fire because the type of the `UITouch` is `UITouchTypeIndirectPointer`,
+ which allows us to return `NO` from `-gestureRecognizer:shouldReceiveTouch:` for anything that is not the mouse
+ gesture recognizer's current mouse touch.
+
+ For apps that lack this plist key, the touch type remains `UITouchTypeDirect` to avoid breaking compatibility,
+ even for events that are generated via a pointing device (i.e. trackpad). This means that we no longer route
+ these events solely to the mouse gesture recognizer. To fix this, use `-_isPointerTouch` instead of
+ `-[UITouch type]` here. Unlike the latter, the former isn't affected by the "supports indirect input" plist key.
+
+ * Platform/spi/ios/UIKitSPI.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView gestureRecognizer:shouldReceiveTouch:]):
+ * UIProcess/ios/WKMouseGestureRecognizer.mm:
+ (-[WKMouseGestureRecognizer _shouldReceiveTouch:forEvent:recognizerView:]):
+
+ Also fix a similar bug here, where the check against `UITouchTypeIndirectPointer` instead of `-_isPointerEvent`
+ causes apps without the UIApplicationSupportsIndirectInputEvents key to lose the ability to listen for mousedown
+ and mouseup events when the user clicks via trackpad on iPad.
+
2022-04-11 J Pascoe <j_pas...@apple.com>
[WebAuthn] Ensure requestPin callback on main thread
Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (292714 => 292715)
--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2022-04-11 20:10:44 UTC (rev 292714)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h 2022-04-11 20:18:49 UTC (rev 292715)
@@ -75,6 +75,7 @@
#import <UIKit/UITextInput_Private.h>
#import <UIKit/UITextInteractionAssistant_Private.h>
#import <UIKit/UITextInteraction_Private.h>
+#import <UIKit/UITouch_Private.h>
#import <UIKit/UIViewControllerTransitioning_Private.h>
#import <UIKit/UIViewController_Private.h>
#import <UIKit/UIViewController_ViewService.h>
@@ -1363,6 +1364,12 @@
@property (nonatomic, readonly) NSString *_sceneIdentifier;
@end
+#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
+@interface UITouch ()
+@property (nonatomic, readonly) BOOL _isPointerTouch;
+@end
+#endif
+
#endif // USE(APPLE_INTERNAL_SDK)
#if HAVE(PASTEBOARD_DATA_OWNER)
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (292714 => 292715)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2022-04-11 20:10:44 UTC (rev 292714)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2022-04-11 20:18:49 UTC (rev 292715)
@@ -1854,7 +1854,7 @@
#endif
#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
- if (gestureRecognizer != _mouseGestureRecognizer && [_mouseGestureRecognizer mouseTouch] == touch && touch.type == UITouchTypeIndirectPointer)
+ if (gestureRecognizer != _mouseGestureRecognizer && [_mouseGestureRecognizer mouseTouch] == touch && touch._isPointerTouch)
return NO;
if (gestureRecognizer != _alternateMouseGestureRecognizer && [_alternateMouseGestureRecognizer mouseTouch] == touch)
Modified: trunk/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.mm (292714 => 292715)
--- trunk/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.mm 2022-04-11 20:10:44 UTC (rev 292714)
+++ trunk/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.mm 2022-04-11 20:18:49 UTC (rev 292715)
@@ -87,7 +87,7 @@
{
// 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 && touch.type == UITouchTypeIndirectPointer;
+ return touch == _currentTouch && touch._isPointerTouch;
}
- (WebKit::NativeWebMouseEvent *)lastMouseEvent
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes