Changeset 244586 in webkit


Ignore:
Timestamp:
Apr 24, 2019 5:23:20 AM (5 years ago)
Author:
dino@apple.com
Message:

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:]):

Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r244582 r244586  
     12019-04-24  Dean Jackson  <dino@apple.com>
     2
     3        Rename _highlightLongPressCanClick and only add gesture recognizer when necessary
     4        https://bugs.webkit.org/show_bug.cgi?id=197231
     5        <rdar://problem/50164234>
     6
     7        Reviewed by Antoine Quint.
     8
     9        Rename _highlightLongPressCanClick to _longPressCanClick since it will be
     10        used in other places.
     11
     12        Only attach the _highlightLongPressGestureRecognizer when we're not
     13        using long presses for preview. This might revert in the future, if we
     14        can set up an appropriate gesture resolution between the two.
     15
     16        * UIProcess/ios/WKContentViewInteraction.h:
     17        * UIProcess/ios/WKContentViewInteraction.mm:
     18        (-[WKContentView setupInteraction]):
     19        (-[WKContentView _webTouchEvent:preventsNativeGestures:]):
     20        (-[WKContentView _highlightLongPressRecognized:]):
     21        (-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):
     22        (-[WKContentView _presentedViewControllerForPreviewItemController:]):
     23        (-[WKContentView _previewItemControllerDidCancelPreview:]):
     24
    1252019-04-24  chris fleizach  <cfleizach@apple.com>
    226
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r244559 r244586  
    310310    BOOL _potentialTapInProgress;
    311311    BOOL _isDoubleTapPending;
    312     BOOL _highlightLongPressCanClick;
     312    BOOL _longPressCanClick;
    313313    BOOL _hasTapHighlightForPotentialTap;
    314314    BOOL _selectionNeedsUpdate;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r244559 r244586  
    746746    [_highlightLongPressGestureRecognizer setDelay:highlightDelay];
    747747    [_highlightLongPressGestureRecognizer setDelegate:self];
    748     [self addGestureRecognizer:_highlightLongPressGestureRecognizer.get()];
    749748
    750749#if HAVE(LINK_PREVIEW)
    751750    if (!self.shouldUsePreviewForLongPress)
    752751#endif
     752    {
     753        [self addGestureRecognizer:_highlightLongPressGestureRecognizer.get()];
     754
    753755        [self _createAndConfigureLongPressGestureRecognizer];
     756    }
    754757
    755758#if ENABLE(DATA_INTERACTION)
     
    13931396{
    13941397    if (preventsNativeGesture) {
    1395         _highlightLongPressCanClick = NO;
     1398        _longPressCanClick = NO;
    13961399
    13971400        _canSendTouchEventsAsynchronously = YES;
     
    21882191    switch ([gestureRecognizer state]) {
    21892192    case UIGestureRecognizerStateBegan:
    2190         _highlightLongPressCanClick = YES;
     2193        _longPressCanClick = YES;
    21912194        cancelPotentialTapIfNecessary(self);
    21922195        _page->tapHighlightAtPosition([gestureRecognizer startPoint], ++_latestTapID);
     
    21942197        break;
    21952198    case UIGestureRecognizerStateEnded:
    2196         if (_highlightLongPressCanClick && _positionInformation.isElement) {
     2199        if (_longPressCanClick && _positionInformation.isElement) {
    21972200            [self _attemptClickAtLocation:gestureRecognizer.startPoint modifierFlags:gestureRecognizerModifierFlags(gestureRecognizer)];
    21982201            [self _finishInteraction];
    21992202        } else
    22002203            [self _cancelInteraction];
    2201         _highlightLongPressCanClick = NO;
     2204        _longPressCanClick = NO;
    22022205        break;
    22032206    case UIGestureRecognizerStateCancelled:
    22042207        [self _cancelInteraction];
    2205         _highlightLongPressCanClick = NO;
     2208        _longPressCanClick = NO;
    22062209        break;
    22072210    default:
     
    71967199- (BOOL)_interactionShouldBeginFromPreviewItemController:(UIPreviewItemController *)controller forPosition:(CGPoint)position
    71977200{
    7198     if (!_highlightLongPressCanClick)
     7201    if (!_longPressCanClick)
    71997202        return NO;
    72007203
     
    73567359
    73577360    if ([_previewItemController type] == UIPreviewItemTypeLink) {
    7358         _highlightLongPressCanClick = NO;
     7361        _longPressCanClick = NO;
    73597362        _page->startInteractionWithElementAtPosition(_positionInformation.request.point);
    73607363
     
    75087511- (void)_previewItemControllerDidCancelPreview:(UIPreviewItemController *)controller
    75097512{
    7510     _highlightLongPressCanClick = NO;
     7513    _longPressCanClick = NO;
    75117514   
    75127515    [_webView _didDismissForcePressPreview];
Note: See TracChangeset for help on using the changeset viewer.