Changeset 218899 in webkit


Ignore:
Timestamp:
Jun 28, 2017 3:58:16 PM (7 years ago)
Author:
Wenson Hsieh
Message:

2017-06-28 Wenson Hsieh <Wenson Hsieh>

Followup to r218885: adjust for further UIKit SPI changes
https://bugs.webkit.org/show_bug.cgi?id=173927
<rdar://problem/33020792>

Reviewed by Tim Horton.

On ToT, UIKit now invokes -_dragInteraction:item:shouldDelaySetDownAnimationWithCompletion: before the
completion block of -dragInteraction:willAnimateLiftWithAnimator:session: is called. This means we now need to
store the completion block in -shouldDelaySetDownAnimationWithCompletion: and wait until the UIDragAnimating
completion block in -willAnimateCancelWithAnimator: before invoking it.

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

(-[WKContentView cleanUpDragSourceSessionState]):

Ensure that the set-down completion block is invoked when a drag session ends (e.g., if the web content process
crashes).

(-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]):
(-[WKContentView _api_dragInteraction:item:willAnimateCancelWithAnimator:]):

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r218894 r218899  
     1 2017-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Followup to r218885: adjust for further UIKit SPI changes
     4        https://bugs.webkit.org/show_bug.cgi?id=173927
     5        <rdar://problem/33020792>
     6
     7        Reviewed by Tim Horton.
     8
     9        On ToT, UIKit now invokes -_dragInteraction:item:shouldDelaySetDownAnimationWithCompletion: before the
     10        completion block of -dragInteraction:willAnimateLiftWithAnimator:session: is called. This means we now need to
     11        store the completion block in -shouldDelaySetDownAnimationWithCompletion: and wait until the UIDragAnimating
     12        completion block in -willAnimateCancelWithAnimator: before invoking it.
     13
     14        * UIProcess/ios/WKContentViewInteraction.h:
     15        * UIProcess/ios/WKContentViewInteraction.mm:
     16        (-[WKContentView cleanUpDragSourceSessionState]):
     17
     18        Ensure that the set-down completion block is invoked when a drag session ends (e.g., if the web content process
     19        crashes).
     20
     21        (-[WKContentView _dragInteraction:item:shouldDelaySetDownAnimationWithCompletion:]):
     22        (-[WKContentView _api_dragInteraction:item:willAnimateCancelWithAnimator:]):
     23
    1242017-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
    225
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h

    r218837 r218899  
    129129    RetainPtr<id <UIDropSession>> dropSession;
    130130    BlockPtr<void()> dragStartCompletionBlock;
     131    BlockPtr<void()> dragCancelSetDownBlock;
    131132    WebCore::DragSourceAction sourceAction { WebCore::DragSourceActionNone };
    132133
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

    r218894 r218899  
    43764376    }
    43774377
     4378    if (auto completionBlock = _dataInteractionState.dragCancelSetDownBlock) {
     4379        _dataInteractionState.dragCancelSetDownBlock = nil;
     4380        completionBlock();
     4381    }
     4382
    43784383    if (auto completionBlock = _dataInteractionState.dragStartCompletionBlock) {
    43794384        // If the previous drag session is still initializing, we need to ensure that its completion block is called to prevent UIKit from getting out of state.
     
    46614666- (BOOL)_dragInteraction:(UIDragInteraction *)interaction item:(UIDragItem *)item shouldDelaySetDownAnimationWithCompletion:(void(^)(void))completion
    46624667{
    4663     _page->callAfterNextPresentationUpdate([capturedBlock = makeBlockPtr(completion)] (CallbackBase::Error) {
    4664         capturedBlock();
    4665     });
     4668    _dataInteractionState.dragCancelSetDownBlock = completion;
    46664669    return YES;
    46674670}
     
    46694672- (void)_api_dragInteraction:(UIDragInteraction *)interaction item:(UIDragItem *)item willAnimateCancelWithAnimator:(id <UIDragAnimating>)animator
    46704673{
    4671     [animator addCompletion:[page = _page] (UIViewAnimatingPosition finalPosition) {
     4674    [animator addCompletion:[protectedSelf = retainPtr(self), page = _page] (UIViewAnimatingPosition finalPosition) {
    46724675        page->dragCancelled();
     4676        if (auto completion = protectedSelf->_dataInteractionState.dragCancelSetDownBlock) {
     4677            protectedSelf->_dataInteractionState.dragCancelSetDownBlock = nil;
     4678            page->callAfterNextPresentationUpdate([completion] (CallbackBase::Error) {
     4679                completion();
     4680            });
     4681        }
    46734682    }];
    46744683}
Note: See TracChangeset for help on using the changeset viewer.