+2019-04-24 Dean Jackson <dino@apple.com>
+
+ Rename _highlightLongPressCanClick and only add gesture recognizer when necessary
+ https://bugs.webkit.org/show_bug.cgi?id=197231
+ <rdar://problem/50164234>
+
+ Reviewed by Antoine Quint.
+
+ Rename _highlightLongPressCanClick to _longPressCanClick since it will be
+ used in other places.
+
+ Only attach the _highlightLongPressGestureRecognizer when we're not
+ using long presses for preview. This might revert in the future, if we
+ can set up an appropriate gesture resolution between the two.
+
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView setupInteraction]):
+ (-[WKContentView _webTouchEvent:preventsNativeGestures:]):
+ (-[WKContentView _highlightLongPressRecognized:]):
+ (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
+ (-[WKContentView _presentedViewControllerForPreviewItemController:]):
+ (-[WKContentView _previewItemControllerDidCancelPreview:]):
+
2019-04-24 chris fleizach <cfleizach@apple.com>
AX: Remove deprecated Accessibility Object Model events
_highlightLongPressGestureRecognizer = adoptNS([[_UIWebHighlightLongPressGestureRecognizer alloc] initWithTarget:self action:@selector(_highlightLongPressRecognized:)]);
[_highlightLongPressGestureRecognizer setDelay:highlightDelay];
[_highlightLongPressGestureRecognizer setDelegate:self];
- [self addGestureRecognizer:_highlightLongPressGestureRecognizer.get()];
#if HAVE(LINK_PREVIEW)
if (!self.shouldUsePreviewForLongPress)
#endif
+ {
+ [self addGestureRecognizer:_highlightLongPressGestureRecognizer.get()];
+
[self _createAndConfigureLongPressGestureRecognizer];
+ }
#if ENABLE(DATA_INTERACTION)
[self setupDragAndDropInteractions];
- (void)_webTouchEvent:(const WebKit::NativeWebTouchEvent&)touchEvent preventsNativeGestures:(BOOL)preventsNativeGesture
{
if (preventsNativeGesture) {
- _highlightLongPressCanClick = NO;
+ _longPressCanClick = NO;
_canSendTouchEventsAsynchronously = YES;
[_touchEventGestureRecognizer setDefaultPrevented:YES];
switch ([gestureRecognizer state]) {
case UIGestureRecognizerStateBegan:
- _highlightLongPressCanClick = YES;
+ _longPressCanClick = YES;
cancelPotentialTapIfNecessary(self);
_page->tapHighlightAtPosition([gestureRecognizer startPoint], ++_latestTapID);
_isTapHighlightIDValid = YES;
break;
case UIGestureRecognizerStateEnded:
- if (_highlightLongPressCanClick && _positionInformation.isElement) {
+ if (_longPressCanClick && _positionInformation.isElement) {
[self _attemptClickAtLocation:gestureRecognizer.startPoint modifierFlags:gestureRecognizerModifierFlags(gestureRecognizer)];
[self _finishInteraction];
} else
[self _cancelInteraction];
- _highlightLongPressCanClick = NO;
+ _longPressCanClick = NO;
break;
case UIGestureRecognizerStateCancelled:
[self _cancelInteraction];
- _highlightLongPressCanClick = NO;
+ _longPressCanClick = NO;
break;
default:
break;
- (BOOL)_interactionShouldBeginFromPreviewItemController:(UIPreviewItemController *)controller forPosition:(CGPoint)position
{
- if (!_highlightLongPressCanClick)
+ if (!_longPressCanClick)
return NO;
WebKit::InteractionInformationRequest request(WebCore::roundedIntPoint(position));
bool isValidURLForImagePreview = !coreTargetURL.isEmpty() && (WTF::protocolIsInHTTPFamily(coreTargetURL) || WTF::protocolIs(coreTargetURL, "data"));
if ([_previewItemController type] == UIPreviewItemTypeLink) {
- _highlightLongPressCanClick = NO;
+ _longPressCanClick = NO;
_page->startInteractionWithElementAtPosition(_positionInformation.request.point);
// Treat animated images like a link preview
- (void)_previewItemControllerDidCancelPreview:(UIPreviewItemController *)controller
{
- _highlightLongPressCanClick = NO;
+ _longPressCanClick = NO;
[_webView _didDismissForcePressPreview];
}