Title: [258290] branches/safari-610.1.7-branch/Source/WebKit
Revision
258290
Author
alanc...@apple.com
Date
2020-03-11 15:22:12 -0700 (Wed, 11 Mar 2020)

Log Message

Cherry-pick r258225. rdar://problem/60342513

    File upload cancels before files can be uploaded.
    https://bugs.webkit.org/show_bug.cgi?id=208846
    <rdar://problem/60244249>

    Reviewed by Tim Horton.

    With the new UIContextMenus, we needed to cancel in order for everything to be
    reset correctly in WebCore. But this can only be done in the animation completion
    handler, but we only want to cancel if we aren't presenting a different picker.

    * UIProcess/ios/forms/WKFileUploadPanel.mm:
    (-[WKFileUploadPanel contextMenuInteraction:configurationForMenuAtLocation:]):
    (-[WKFileUploadPanel contextMenuInteraction:willEndForConfiguration:animator:]):
    (-[WKFileUploadPanel ensureContextMenuInteraction]):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258225 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-610.1.7-branch/Source/WebKit/ChangeLog (258289 => 258290)


--- branches/safari-610.1.7-branch/Source/WebKit/ChangeLog	2020-03-11 22:18:04 UTC (rev 258289)
+++ branches/safari-610.1.7-branch/Source/WebKit/ChangeLog	2020-03-11 22:22:12 UTC (rev 258290)
@@ -1,3 +1,42 @@
+2020-03-11  Russell Epstein  <repst...@apple.com>
+
+        Cherry-pick r258225. rdar://problem/60342513
+
+    File upload cancels before files can be uploaded.
+    https://bugs.webkit.org/show_bug.cgi?id=208846
+    <rdar://problem/60244249>
+    
+    Reviewed by Tim Horton.
+    
+    With the new UIContextMenus, we needed to cancel in order for everything to be
+    reset correctly in WebCore. But this can only be done in the animation completion
+    handler, but we only want to cancel if we aren't presenting a different picker.
+    
+    * UIProcess/ios/forms/WKFileUploadPanel.mm:
+    (-[WKFileUploadPanel contextMenuInteraction:configurationForMenuAtLocation:]):
+    (-[WKFileUploadPanel contextMenuInteraction:willEndForConfiguration:animator:]):
+    (-[WKFileUploadPanel ensureContextMenuInteraction]):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-03-10  Megan Gardner  <megan_gard...@apple.com>
+
+            File upload cancels before files can be uploaded.
+            https://bugs.webkit.org/show_bug.cgi?id=208846
+            <rdar://problem/60244249>
+
+            Reviewed by Tim Horton.
+
+            With the new UIContextMenus, we needed to cancel in order for everything to be
+            reset correctly in WebCore. But this can only be done in the animation completion
+            handler, but we only want to cancel if we aren't presenting a different picker.
+
+            * UIProcess/ios/forms/WKFileUploadPanel.mm:
+            (-[WKFileUploadPanel contextMenuInteraction:configurationForMenuAtLocation:]):
+            (-[WKFileUploadPanel contextMenuInteraction:willEndForConfiguration:animator:]):
+            (-[WKFileUploadPanel ensureContextMenuInteraction]):
+
 2020-03-11  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r258284. rdar://problem/60341123

Modified: branches/safari-610.1.7-branch/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm (258289 => 258290)


--- branches/safari-610.1.7-branch/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm	2020-03-11 22:18:04 UTC (rev 258289)
+++ branches/safari-610.1.7-branch/Source/WebKit/UIProcess/ios/forms/WKFileUploadPanel.mm	2020-03-11 22:22:12 UTC (rev 258290)
@@ -169,6 +169,7 @@
     RetainPtr<UIViewController> _presentationViewController; // iPhone always. iPad for Fullscreen Camera.
     ALLOW_DEPRECATED_DECLARATIONS_BEGIN
     RetainPtr<UIPopoverController> _presentationPopover; // iPad for action sheet and Photo Library.
+    BOOL _isPresentingSubMenu;
     ALLOW_DEPRECATED_DECLARATIONS_END
 #if USE(UICONTEXTMENU)
     RetainPtr<UIContextMenuInteraction> _documentContextMenuInteraction;
@@ -436,11 +437,14 @@
         if (!strongSelf)
             return nil;
         
+        self->_isPresentingSubMenu = NO;
         UIAction *browseAction = [UIAction actionWithTitle:[strongSelf _browseFilesButtonLabel] image:[UIImage systemImageNamed:@"ellipsis"] identifier:@"browse" handler:^(__kindof UIAction *action) {
+            self->_isPresentingSubMenu = YES;
             [self showFilePickerMenu];
         }];
 
         UIAction *photoAction = [UIAction actionWithTitle:[strongSelf _photoLibraryButtonLabel] image:[UIImage systemImageNamed:@"rectangle.on.rectangle"] identifier:@"photo" handler:^(__kindof UIAction *action) {
+            self->_isPresentingSubMenu = YES;
             [self _showPhotoPickerWithSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
         }];
 
@@ -448,6 +452,7 @@
             NSString *cameraString = [strongSelf _cameraButtonLabelAllowingPhoto:allowsImageMediaType allowingVideo:allowsVideoMediaType];
             UIAction *cameraAction = [UIAction actionWithTitle:cameraString image:[UIImage systemImageNamed:@"camera.fill"] identifier:@"camera" handler:^(__kindof UIAction *action) {
                 _usingCamera = YES;
+                self->_isPresentingSubMenu = YES;
                 [self _showPhotoPickerWithSourceType:UIImagePickerControllerSourceTypeCamera];
             }];
             actions = @[photoAction, cameraAction, browseAction];
@@ -464,7 +469,8 @@
 {
     [animator addCompletion:^{
         [self removeContextMenuInteraction];
-        [self _cancel];
+        if (!self->_isPresentingSubMenu)
+            [self _cancel];
     }];
 }
 
@@ -481,6 +487,7 @@
     if (!_documentContextMenuInteraction) {
         _documentContextMenuInteraction = adoptNS([[UIContextMenuInteraction alloc] initWithDelegate:self]);
         [_view addInteraction:_documentContextMenuInteraction.get()];
+        self->_isPresentingSubMenu = NO;
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to