Changeset 219113 in webkit


Ignore:
Timestamp:
Jul 3, 2017, 9:33:21 PM (8 years ago)
Author:
Wenson Hsieh
Message:

[iOS DnD] [WK2] Callout bar should reappear after dragging ends for a text selection
https://bugs.webkit.org/show_bug.cgi?id=174116
<rdar://problem/33017845>

Reviewed by Ryosuke Niwa.

-willStartScrollingOverflow -didEndScrollingOverflow are helper methods on both the UIWKTextInteractionAssistant
and UIWebSelectionAssistant that handle hiding selection and callout bar UI during overflow scrolling and making
it reappear after scrolling ends. However, these hooks do not contain logic specific to scrolling, and simply
tell the inner UIWebSelectionView to either show or hide and are safe to invoke outside of the context of
scrolling.

This patch invokes these hooks when beginning a drag on a selection, and when a dragging ends, if it called
-willStartScrollingOverflow to begin with. We should rename these in the future to be something along the lines
of -hideSelectionViewAndControls and -showSelectionViewAndControls, respectively, and adopt these new names in
WebKit. We also move logic to hide the callout out of -itemsForBeginningSession: and into
-willAnimateLiftWithAnimator:, when the lift actually begins.

  • UIProcess/ios/WKContentViewInteraction.h:
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView cleanUpDragSourceSessionState]):
(-[WKContentView _restoreCalloutBarIfNeeded]):
(-[WKContentView dragInteraction:itemsForBeginningSession:]):
(-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
(-[WKContentView dragInteraction:session:didEndWithOperation:]):

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r219106 r219113  
     12017-07-03  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS DnD] [WK2] Callout bar should reappear after dragging ends for a text selection
     4        https://bugs.webkit.org/show_bug.cgi?id=174116
     5        <rdar://problem/33017845>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        -willStartScrollingOverflow -didEndScrollingOverflow are helper methods on both the UIWKTextInteractionAssistant
     10        and UIWebSelectionAssistant that handle hiding selection and callout bar UI during overflow scrolling and making
     11        it reappear after scrolling ends. However, these hooks do not contain logic specific to scrolling, and simply
     12        tell the inner UIWebSelectionView to either show or hide and are safe to invoke outside of the context of
     13        scrolling.
     14
     15        This patch invokes these hooks when beginning a drag on a selection, and when a dragging ends, if it called
     16        -willStartScrollingOverflow to begin with. We should rename these in the future to be something along the lines
     17        of -hideSelectionViewAndControls and -showSelectionViewAndControls, respectively, and adopt these new names in
     18        WebKit. We also move logic to hide the callout out of -itemsForBeginningSession: and into
     19        -willAnimateLiftWithAnimator:, when the lift actually begins.
     20
     21        * UIProcess/ios/WKContentViewInteraction.h:
     22        * UIProcess/ios/WKContentViewInteraction.mm:
     23        (-[WKContentView cleanUpDragSourceSessionState]):
     24        (-[WKContentView _restoreCalloutBarIfNeeded]):
     25        (-[WKContentView dragInteraction:itemsForBeginningSession:]):
     26        (-[WKContentView dragInteraction:willAnimateLiftWithAnimator:session:]):
     27        (-[WKContentView dragInteraction:session:didEndWithOperation:]):
     28
    1292017-07-03  Matt Rajca  <mrajca@apple.com>
    230
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h

    r218899 r219113  
    126126    BOOL isPerformingOperation { NO };
    127127    BOOL isAnimatingConcludeEditDrag { NO };
     128    BOOL shouldRestoreCalloutBar { NO };
    128129    RetainPtr<id <UIDragSession>> dragSession;
    129130    RetainPtr<id <UIDropSession>> dropSession;
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

    r219055 r219113  
    43774377    }
    43784378
     4379    [self _restoreCalloutBarIfNeeded];
    43794380    [_dataInteractionState.caretView remove];
    43804381    [_dataInteractionState.visibleContentViewSnapshot removeFromSuperview];
     
    45074508}
    45084509
     4510- (void)_restoreCalloutBarIfNeeded
     4511{
     4512    if (!_dataInteractionState.shouldRestoreCalloutBar)
     4513        return;
     4514
     4515    // FIXME: This SPI should be renamed in UIKit to reflect a more general purpose of revealing hidden interaction assistant controls.
     4516    [_webSelectionAssistant didEndScrollingOverflow];
     4517    [_textSelectionAssistant didEndScrollingOverflow];
     4518    _dataInteractionState.shouldRestoreCalloutBar = NO;
     4519}
     4520
    45094521#pragma mark - UIDragInteractionDelegate
    45104522
     
    45524564        return @[ ];
    45534565    }
    4554 
    4555     [UICalloutBar fadeSharedCalloutBar];
    45564566
    45574567    // Give internal clients such as Mail one final chance to augment the contents of each UIItemProvider before sending the drag items off to UIKit.
     
    46014611- (void)dragInteraction:(UIDragInteraction *)interaction willAnimateLiftWithAnimator:(id <UIDragAnimating>)animator session:(id <UIDragSession>)session
    46024612{
     4613    if (!_dataInteractionState.shouldRestoreCalloutBar && (_dataInteractionState.sourceAction & DragSourceActionSelection)) {
     4614        // FIXME: This SPI should be renamed in UIKit to reflect a more general purpose of hiding interaction assistant controls.
     4615        [_webSelectionAssistant willStartScrollingOverflow];
     4616        [_textSelectionAssistant willStartScrollingOverflow];
     4617        _dataInteractionState.shouldRestoreCalloutBar = YES;
     4618    }
     4619
    46034620    auto adjustedOrigin = _dataInteractionState.adjustedOrigin;
    46044621    RetainPtr<WKContentView> protectedSelf(self);
     
    46324649{
    46334650    RELEASE_LOG(DragAndDrop, "Drag session ended: %p (with operation: %tu, performing operation: %d, began dragging: %d)", session, operation, _dataInteractionState.isPerformingOperation, _dataInteractionState.didBeginDragging);
     4651
     4652    [self _restoreCalloutBarIfNeeded];
     4653
    46344654    id <WKUIDelegatePrivate> uiDelegate = self.webViewUIDelegate;
    46354655    if ([uiDelegate respondsToSelector:@selector(_webView:dataInteraction:session:didEndWithOperation:)])
Note: See TracChangeset for help on using the changeset viewer.