Title: [264785] trunk/Source/WebKit
Revision
264785
Author
david_ques...@apple.com
Date
2020-07-23 13:16:49 -0700 (Thu, 23 Jul 2020)

Log Message

Unable to present file upload picker after interactively dismissing a previously opened picker
https://bugs.webkit.org/show_bug.cgi?id=209613
rdar://problem/60931009

Reviewed by Daniel Bates.

-[<UIDocumentPickerViewController> documentPickerWasCancelled:] doesn't get called if you
dismiss the view controller using the interactive swipe dismissal gesture added in iOS 13.
As a result, the web view will continue to think it's showing a file picker after dismissing
it this way, meaning you can't present any other file pickers from the same web view. Fix
this by implementing UIAdaptivePresentationControllerDelegate in WKFileUploadPanel to cancel
and tear down the file picker operation when the view controller is interactively dismised.

* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[WKFileUploadPanel showFilePickerMenu]):
(-[WKFileUploadPanel presentationControllerDidDismiss:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (264784 => 264785)


--- trunk/Source/WebKit/ChangeLog	2020-07-23 20:00:43 UTC (rev 264784)
+++ trunk/Source/WebKit/ChangeLog	2020-07-23 20:16:49 UTC (rev 264785)
@@ -1,3 +1,22 @@
+2020-07-23  David Quesada  <david_ques...@apple.com>
+
+        Unable to present file upload picker after interactively dismissing a previously opened picker
+        https://bugs.webkit.org/show_bug.cgi?id=209613
+        rdar://problem/60931009
+
+        Reviewed by Daniel Bates.
+
+        -[<UIDocumentPickerViewController> documentPickerWasCancelled:] doesn't get called if you
+        dismiss the view controller using the interactive swipe dismissal gesture added in iOS 13.
+        As a result, the web view will continue to think it's showing a file picker after dismissing
+        it this way, meaning you can't present any other file pickers from the same web view. Fix
+        this by implementing UIAdaptivePresentationControllerDelegate in WKFileUploadPanel to cancel
+        and tear down the file picker operation when the view controller is interactively dismised.
+
+        * UIProcess/ios/forms/WKFileUploadPanel.mm:
+        (-[WKFileUploadPanel showFilePickerMenu]):
+        (-[WKFileUploadPanel presentationControllerDidDismiss:]):
+
 2020-07-23  Aditya Keerthi  <akeer...@apple.com>
 
         [macOS] Datalist dropdown scrollbar position does not match visible region

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm (264784 => 264785)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm	2020-07-23 20:00:43 UTC (rev 264784)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm	2020-07-23 20:16:49 UTC (rev 264785)
@@ -151,7 +151,7 @@
 #pragma mark - WKFileUploadPanel
 
 
-@interface WKFileUploadPanel () <UIPopoverControllerDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate, UIDocumentPickerDelegate
+@interface WKFileUploadPanel () <UIPopoverControllerDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate, UIDocumentPickerDelegate, UIAdaptivePresentationControllerDelegate
 #if USE(UICONTEXTMENU)
 , UIContextMenuInteractionDelegate
 #endif
@@ -499,6 +499,7 @@
     _documentPickerController = adoptNS([[UIDocumentPickerViewController alloc] initWithDocumentTypes:documentTypes inMode:UIDocumentPickerModeImport]);
     [_documentPickerController setAllowsMultipleSelection:_allowMultipleFiles];
     [_documentPickerController setDelegate:self];
+    [_documentPickerController presentationController].delegate = self;
     if ([_delegate respondsToSelector:@selector(fileUploadPanelDestinationIsManaged:)])
         [_documentPickerController _setIsContentManaged:[_delegate fileUploadPanelDestinationIsManaged:self]];
     [self _presentFullscreenViewController:_documentPickerController.get() animated:YES];
@@ -606,6 +607,13 @@
     [_presentationViewController presentViewController:viewController animated:animated completion:nil];
 }
 
+#pragma mark - UIAdaptivePresentationControllerDelegate
+
+- (void)presentationControllerDidDismiss:(UIPresentationController *)presentationController
+{
+    [self _cancel];
+}
+
 #pragma mark - UIPopoverControllerDelegate
 
 ALLOW_DEPRECATED_IMPLEMENTATIONS_BEGIN
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to