Changeset 280647 in webkit
- Timestamp:
- Aug 4, 2021, 11:44:20 AM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/ios/WKImageAnalysisGestureRecognizer.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r280644 r280647 1 2021-08-04 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS 15] "Look Up" action is sometimes missing after force pressing images 4 https://bugs.webkit.org/show_bug.cgi?id=228774 5 rdar://78040734 6 7 Reviewed by Devin Rousso. 8 9 On iOS devices that support both 3D Touch and Visual Look Up (i.e., iPhone XS and iPhone XS Max), it's currently 10 possible to skip the image analysis preflight gesture entirely when showing the context menu over images in the 11 case where the user triggers the interaction by exceeding the force press threshold in under 100 ms (the current 12 delay of the image analysis long press gesture). 13 14 Mitigate this by teaching WKImageAnalysisGestureRecognizer to trigger image analysis preflight slightly ahead of 15 the context menu interaction when performing a force press by transitioning to Began state early under 16 `-touchesBegan:withEvent:` and `-touchesMoved:withEvent:`, if the touch's force exceeds a certain (relatively 17 low) threshold. 18 19 * UIProcess/ios/WKImageAnalysisGestureRecognizer.mm: 20 (-[WKImageAnalysisGestureRecognizer touchesBegan:withEvent:]): 21 (-[WKImageAnalysisGestureRecognizer touchesMoved:withEvent:]): 22 (-[WKImageAnalysisGestureRecognizer beginAfterExceedingForceThresholdIfNeeded:]): 23 1 24 2021-08-04 Per Arne <pvollan@apple.com> 2 25 -
trunk/Source/WebKit/UIProcess/ios/WKImageAnalysisGestureRecognizer.mm
r278575 r280647 46 46 } 47 47 48 - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event 49 { 50 [super touchesBegan:touches withEvent:event]; 51 52 [self beginAfterExceedingForceThresholdIfNeeded:touches]; 53 } 54 55 - (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event 56 { 57 [super touchesMoved:touches withEvent:event]; 58 59 [self beginAfterExceedingForceThresholdIfNeeded:touches]; 60 } 61 62 - (void)beginAfterExceedingForceThresholdIfNeeded:(NSSet<UITouch *> *)touches 63 { 64 if (self.state != UIGestureRecognizerStatePossible) 65 return; 66 67 if (touches.count > 1) 68 return; 69 70 constexpr CGFloat forceThreshold = 1.5; 71 if (touches.anyObject.force < forceThreshold) 72 return; 73 74 self.state = UIGestureRecognizerStateBegan; 75 } 76 48 77 - (void)setState:(UIGestureRecognizerState)state 49 78 {
Note:
See TracChangeset
for help on using the changeset viewer.