Title: [219224] trunk/Source/WebKit2
Revision
219224
Author
[email protected]
Date
2017-07-06 16:30:10 -0700 (Thu, 06 Jul 2017)

Log Message

[iOS DnD] [WK2] Add delegate hooks for specifying the data owner for a drag or drop session
https://bugs.webkit.org/show_bug.cgi?id=174139
<rdar://problem/33126212>

Reviewed by Beth Dakin.

Add hooks to query the UI delegate for a _UIDataOwner on both drag and drop sides.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _dragInteraction:dataOwnerForSession:]):
(-[WKContentView _dropInteraction:dataOwnerForSession:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (219223 => 219224)


--- trunk/Source/WebKit2/ChangeLog	2017-07-06 23:04:18 UTC (rev 219223)
+++ trunk/Source/WebKit2/ChangeLog	2017-07-06 23:30:10 UTC (rev 219224)
@@ -1,3 +1,19 @@
+2017-07-06  Wenson Hsieh  <[email protected]>
+
+        [iOS DnD] [WK2] Add delegate hooks for specifying the data owner for a drag or drop session
+        https://bugs.webkit.org/show_bug.cgi?id=174139
+        <rdar://problem/33126212>
+
+        Reviewed by Beth Dakin.
+
+        Add hooks to query the UI delegate for a _UIDataOwner on both drag and drop sides.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _dragInteraction:dataOwnerForSession:]):
+        (-[WKContentView _dropInteraction:dataOwnerForSession:]):
+
 2017-07-06  Brent Fulgham  <[email protected]>
 
         [WK2] ResourceLoadStatistics should batch its writes

Modified: trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h (219223 => 219224)


--- trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h	2017-07-06 23:04:18 UTC (rev 219223)
+++ trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h	2017-07-06 23:30:10 UTC (rev 219224)
@@ -81,7 +81,8 @@
 #import <UIKit/UIPreviewItemController.h>
 #endif
 
-#if ENABLE(DATA_INTERACTION)
+#if ENABLE(DRAG_SUPPORT)
+#import <UIKit/NSItemProvider+UIKitAdditions_Private.h>
 #import <UIKit/UIItemProvider_Private.h>
 #endif
 
@@ -124,6 +125,15 @@
 @end
 #endif
 
+#if ENABLE(DRAG_SUPPORT)
+typedef NS_ENUM(NSInteger, _UIDataOwner) {
+    _UIDataOwnerUndefined,
+    _UIDataOwnerUser,
+    _UIDataOwnerEnterprise,
+    _UIDataOwnerShared,
+};
+#endif
+
 @interface UIAlertController ()
 - (void)_addActionWithTitle:(NSString *)title style:(UIAlertActionStyle)style handler:(void (^)(void))handler;
 - (void)_addActionWithTitle:(NSString *)title style:(UIAlertActionStyle)style handler:(void (^)(void))handler shouldDismissHandler:(BOOL (^)(void))shouldDismissHandler;

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (219223 => 219224)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2017-07-06 23:04:18 UTC (rev 219223)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2017-07-06 23:30:10 UTC (rev 219224)
@@ -114,6 +114,8 @@
 - (UITargetedDragPreview *)_webView:(WKWebView *)webView previewForLiftingItem:(UIDragItem *)item session:(id <UIDragSession>)session WK_API_AVAILABLE(ios(WK_IOS_TBA));
 - (UITargetedDragPreview *)_webView:(WKWebView *)webView previewForCancellingItem:(UIDragItem *)item withDefault:(UITargetedDragPreview *)defaultPreview WK_API_AVAILABLE(ios(WK_IOS_TBA));
 - (NSArray<UIDragItem *> *)_webView:(WKWebView *)webView willPerformDropWithSession:(id <UIDropSession>)session WK_API_AVAILABLE(ios(WK_IOS_TBA));
+- (NSInteger)_webView:(WKWebView *)webView dataOwnerForDropSession:(id <UIDropSession>)session;
+- (NSInteger)_webView:(WKWebView *)webView dataOwnerForDragSession:(id <UIDragSession>)session;
 #endif
 - (void)_webView:(WKWebView *)webView didChangeSafeAreaShouldAffectObscuredInsets:(BOOL)safeAreaShouldAffectObscuredInsets WK_API_AVAILABLE(ios(WK_IOS_TBA));
 #else

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (219223 => 219224)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2017-07-06 23:04:18 UTC (rev 219223)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2017-07-06 23:30:10 UTC (rev 219224)
@@ -4535,6 +4535,15 @@
     return [competingGestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]];
 }
 
+- (_UIDataOwner)_dragInteraction:(UIDragInteraction *)interaction dataOwnerForSession:(id <UIDragSession>)session
+{
+    id <WKUIDelegatePrivate> uiDelegate = self.webViewUIDelegate;
+    _UIDataOwner dataOwner = _UIDataOwnerUndefined;
+    if ([uiDelegate respondsToSelector:@selector(_webView:dataOwnerForDragSession:)])
+        dataOwner = (_UIDataOwner)[uiDelegate _webView:_webView dataOwnerForDragSession:session];
+    return dataOwner;
+}
+
 - (void)_dragInteraction:(UIDragInteraction *)interaction prepareForSession:(id <UIDragSession>)session completion:(dispatch_block_t)completion
 {
     [self _cancelLongPressGestureRecognizer];
@@ -4709,6 +4718,15 @@
 
 #pragma mark - UIDropInteractionDelegate
 
+- (_UIDataOwner)_dropInteraction:(UIDropInteraction *)interaction dataOwnerForSession:(id <UIDropSession>)session
+{
+    id <WKUIDelegatePrivate> uiDelegate = self.webViewUIDelegate;
+    _UIDataOwner dataOwner = _UIDataOwnerUndefined;
+    if ([uiDelegate respondsToSelector:@selector(_webView:dataOwnerForDropSession:)])
+        dataOwner = (_UIDataOwner)[uiDelegate _webView:_webView dataOwnerForDropSession:session];
+    return dataOwner;
+}
+
 - (BOOL)dropInteraction:(UIDropInteraction *)interaction canHandleSession:(id<UIDropSession>)session
 {
     // FIXME: Support multiple simultaneous drop sessions in the future.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to