Changeset 212574 in webkit


Ignore:
Timestamp:
Feb 17, 2017 1:43:41 PM (7 years ago)
Author:
Wenson Hsieh
Message:

[WK2] Action sheet should not dismiss when a DDAction with user interface is being presented
https://bugs.webkit.org/show_bug.cgi?id=168528
<rdar://problem/30515324>

Reviewed by Beth Dakin.

After r211643, -[WKActionSheet doneWithSheet] now dismisses the presenting view controller. This is called when
interaction with the sheet is finished and is a reasonable thing to do in most cases. However, when using data
detectors, we don't want to dismiss the presenting view controller, since DataDetector handles dismissing on its
own and expects that its completion handler will be invoked.

To fix this, we add a parameter to doneWithSheet: to indicate whether or not we should additionally dismiss the
presenting view controller, and pass in NO in the case where we are handing control over to DataDetector.

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

(-[WKActionSheet doneWithSheet:]):
(-[WKActionSheet doneWithSheet]): Deleted.

  • UIProcess/ios/WKActionSheetAssistant.mm:

(-[WKActionSheetAssistant showDataDetectorsSheet]):
(-[WKActionSheetAssistant cleanupSheet]):

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r212557 r212574  
     12017-02-17  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [WK2] Action sheet should not dismiss when a DDAction with user interface is being presented
     4        https://bugs.webkit.org/show_bug.cgi?id=168528
     5        <rdar://problem/30515324>
     6
     7        Reviewed by Beth Dakin.
     8
     9        After r211643, -[WKActionSheet doneWithSheet] now dismisses the presenting view controller. This is called when
     10        interaction with the sheet is finished and is a reasonable thing to do in most cases. However, when using data
     11        detectors, we don't want to dismiss the presenting view controller, since DataDetector handles dismissing on its
     12        own and expects that its completion handler will be invoked.
     13
     14        To fix this, we add a parameter to doneWithSheet: to indicate whether or not we should additionally dismiss the
     15        presenting view controller, and pass in NO in the case where we are handing control over to DataDetector.
     16
     17        * UIProcess/ios/WKActionSheet.h:
     18        * UIProcess/ios/WKActionSheet.mm:
     19        (-[WKActionSheet doneWithSheet:]):
     20        (-[WKActionSheet doneWithSheet]): Deleted.
     21        * UIProcess/ios/WKActionSheetAssistant.mm:
     22        (-[WKActionSheetAssistant showDataDetectorsSheet]):
     23        (-[WKActionSheetAssistant cleanupSheet]):
     24
    1252017-02-17  Michael Catanzaro  <mcatanzaro@igalia.com>
    226
  • trunk/Source/WebKit2/UIProcess/ios/WKActionSheet.h

    r212342 r212574  
    4242@property (nonatomic, assign) id <WKActionSheetDelegate> sheetDelegate;
    4343@property (nonatomic) UIPopoverArrowDirection arrowDirections;
    44 - (void)doneWithSheet;
     44- (void)doneWithSheet:(BOOL)dismiss;
    4545- (BOOL)presentSheet:(WKActionSheetPresentationStyle)style;
    4646- (BOOL)presentSheetFromRect:(CGRect)presentationRect;
  • trunk/Source/WebKit2/UIProcess/ios/WKActionSheet.mm

    r212342 r212574  
    120120}
    121121
    122 - (void)doneWithSheet
    123 {
    124     if (_currentPresentingViewController)
     122- (void)doneWithSheet:(BOOL)dismiss
     123{
     124    if (dismiss && _currentPresentingViewController)
    125125        [_currentPresentingViewController dismissViewControllerAnimated:YES completion:nil];
    126126
  • trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm

    r212342 r212574  
    9191    UIView *_view;
    9292    BOOL _needsLinkIndicator;
     93    BOOL _isPresentingDDUserInterface;
    9394}
    9495
     
    546547    for (NSUInteger actionNumber = 0; actionNumber < [dataDetectorsActions count]; actionNumber++) {
    547548        DDAction *action = [dataDetectorsActions objectAtIndex:actionNumber];
     549        RetainPtr<WKActionSheetAssistant> retainedSelf = self;
    548550        _WKElementAction *elementAction = [_WKElementAction elementActionWithTitle:[action localizedName] actionHandler:^(_WKActivatedElementInfo *actionInfo) {
    549             [[getDDDetectionControllerClass() sharedController] performAction:action
    550                                                           fromAlertController:_interactionSheet.get()
    551                                                           interactionDelegate:self];
     551            retainedSelf.get()->_isPresentingDDUserInterface = action.hasUserInterface;
     552            [[getDDDetectionControllerClass() sharedController] performAction:action fromAlertController:retainedSelf.get()->_interactionSheet.get() interactionDelegate:retainedSelf.get()];
    552553        }];
    553554        elementAction.dismissalHandler = ^{
     
    574575        [delegate actionSheetAssistantDidStopInteraction:self];
    575576
    576     [_interactionSheet doneWithSheet];
     577    [_interactionSheet doneWithSheet:!_isPresentingDDUserInterface];
    577578    [_interactionSheet setSheetDelegate:nil];
    578579    _interactionSheet = nil;
    579580    _elementInfo = nil;
    580581    _needsLinkIndicator = NO;
     582    _isPresentingDDUserInterface = NO;
    581583}
    582584
Note: See TracChangeset for help on using the changeset viewer.