Title: [211643] trunk/Source/WebKit2
Revision
211643
Author
wenson_hs...@apple.com
Date
2017-02-03 12:07:49 -0800 (Fri, 03 Feb 2017)

Log Message

WKActionSheet should dismiss with animation when done with the sheet
https://bugs.webkit.org/show_bug.cgi?id=167804
<rdar://problem/30334861>

Reviewed by Tim Horton.

Currently, we do not dismiss the action menu when -doneWithSheet is invoked. While this is okay when the menu is
dismissed via tap (since it will be dismissed as default behavior by the popover controller) we need to manually
dismiss it if we are trying to programmatically dismiss the action sheet/menu.

* UIProcess/ios/WKActionSheet.mm:
(-[WKActionSheet presentSheetFromRect:]):
(-[WKActionSheet doneWithSheet]):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setupInteraction]):
(-[WKContentView resignFirstResponder]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (211642 => 211643)


--- trunk/Source/WebKit2/ChangeLog	2017-02-03 20:00:53 UTC (rev 211642)
+++ trunk/Source/WebKit2/ChangeLog	2017-02-03 20:07:49 UTC (rev 211643)
@@ -1,3 +1,22 @@
+2017-02-03  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        WKActionSheet should dismiss with animation when done with the sheet
+        https://bugs.webkit.org/show_bug.cgi?id=167804
+        <rdar://problem/30334861>
+
+        Reviewed by Tim Horton.
+
+        Currently, we do not dismiss the action menu when -doneWithSheet is invoked. While this is okay when the menu is
+        dismissed via tap (since it will be dismissed as default behavior by the popover controller) we need to manually
+        dismiss it if we are trying to programmatically dismiss the action sheet/menu.
+
+        * UIProcess/ios/WKActionSheet.mm:
+        (-[WKActionSheet presentSheetFromRect:]):
+        (-[WKActionSheet doneWithSheet]):
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView setupInteraction]):
+        (-[WKContentView resignFirstResponder]):
+
 2017-02-03  Olivier Blin  <olivier.b...@softathome.com>
 
         Doc generation failure in WebKitSecurityOrigin

Modified: trunk/Source/WebKit2/UIProcess/ios/WKActionSheet.mm (211642 => 211643)


--- trunk/Source/WebKit2/UIProcess/ios/WKActionSheet.mm	2017-02-03 20:00:53 UTC (rev 211642)
+++ trunk/Source/WebKit2/UIProcess/ios/WKActionSheet.mm	2017-02-03 20:07:49 UTC (rev 211643)
@@ -37,6 +37,7 @@
     BOOL _isRotating;
     BOOL _readyToPresentAfterRotation;
 
+    RetainPtr<UIViewController> _currentPresentingViewController;
     RetainPtr<UIViewController> _presentedViewControllerWhileRotating;
     RetainPtr<id <UIPopoverPresentationControllerDelegate>> _popoverPresentationControllerDelegateWhileRotating;
 }
@@ -99,8 +100,8 @@
     if (_popoverPresentationControllerDelegateWhileRotating)
         presentationController.delegate = _popoverPresentationControllerDelegateWhileRotating.get();
 
-    UIViewController *presentingViewController = [UIViewController _viewControllerForFullScreenPresentationFromView:view];
-    [presentingViewController presentViewController:presentedViewController animated:YES completion:NULL];
+    _currentPresentingViewController = [UIViewController _viewControllerForFullScreenPresentationFromView:view];
+    [_currentPresentingViewController presentViewController:presentedViewController animated:YES completion:nil];
 
     return YES;
 }
@@ -107,6 +108,10 @@
 
 - (void)doneWithSheet
 {
+    if (_currentPresentingViewController)
+        [_currentPresentingViewController dismissViewControllerAnimated:YES completion:nil];
+
+    _currentPresentingViewController = nil;
     _presentedViewControllerWhileRotating = nil;
     _popoverPresentationControllerDelegateWhileRotating = nil;
 

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (211642 => 211643)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2017-02-03 20:00:53 UTC (rev 211642)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2017-02-03 20:07:49 UTC (rev 211643)
@@ -582,7 +582,7 @@
 
 #if ENABLE(DATA_INTERACTION)
     _dataInteractionGestureRecognizer = adoptNS([[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(_dataInteractionGestureRecognizer:)]);
-    [_dataInteractionGestureRecognizer setDelay:0.25];
+    [_dataInteractionGestureRecognizer setDelay:0.5];
     [_dataInteractionGestureRecognizer setDelegate:self];
     [_dataInteractionGestureRecognizer _setRequiresQuietImpulse:YES];
     [self addGestureRecognizer:_dataInteractionGestureRecognizer.get()];
@@ -850,9 +850,6 @@
 
 - (BOOL)resignFirstResponder
 {
-#if ENABLE(DATA_INTERACTION)
-    _dataInteractionState.shouldHandleLongPressAction = NO;
-#endif
     // FIXME: Maybe we should call resignFirstResponder on the superclass
     // and do nothing if the return value is NO.
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to