Changeset 219224 in webkit


Ignore:
Timestamp:
Jul 6, 2017 4:30:10 PM (7 years ago)
Author:
Wenson Hsieh
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:]):

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r219220 r219224  
     12017-07-06  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS DnD] [WK2] Add delegate hooks for specifying the data owner for a drag or drop session
     4        https://bugs.webkit.org/show_bug.cgi?id=174139
     5        <rdar://problem/33126212>
     6
     7        Reviewed by Beth Dakin.
     8
     9        Add hooks to query the UI delegate for a _UIDataOwner on both drag and drop sides.
     10
     11        * Platform/spi/ios/UIKitSPI.h:
     12        * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
     13        * UIProcess/ios/WKContentViewInteraction.mm:
     14        (-[WKContentView _dragInteraction:dataOwnerForSession:]):
     15        (-[WKContentView _dropInteraction:dataOwnerForSession:]):
     16
    1172017-07-06  Brent Fulgham  <bfulgham@apple.com>
    218
  • trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h

    r219055 r219224  
    8282#endif
    8383
    84 #if ENABLE(DATA_INTERACTION)
     84#if ENABLE(DRAG_SUPPORT)
     85#import <UIKit/NSItemProvider+UIKitAdditions_Private.h>
    8586#import <UIKit/UIItemProvider_Private.h>
    8687#endif
     
    123124@property (strong, nonatomic, readonly) UIGestureRecognizer *presentationSecondaryGestureRecognizer;
    124125@end
     126#endif
     127
     128#if ENABLE(DRAG_SUPPORT)
     129typedef NS_ENUM(NSInteger, _UIDataOwner) {
     130    _UIDataOwnerUndefined,
     131    _UIDataOwnerUser,
     132    _UIDataOwnerEnterprise,
     133    _UIDataOwnerShared,
     134};
    125135#endif
    126136
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h

    r218453 r219224  
    115115- (UITargetedDragPreview *)_webView:(WKWebView *)webView previewForCancellingItem:(UIDragItem *)item withDefault:(UITargetedDragPreview *)defaultPreview WK_API_AVAILABLE(ios(WK_IOS_TBA));
    116116- (NSArray<UIDragItem *> *)_webView:(WKWebView *)webView willPerformDropWithSession:(id <UIDropSession>)session WK_API_AVAILABLE(ios(WK_IOS_TBA));
     117- (NSInteger)_webView:(WKWebView *)webView dataOwnerForDropSession:(id <UIDropSession>)session;
     118- (NSInteger)_webView:(WKWebView *)webView dataOwnerForDragSession:(id <UIDragSession>)session;
    117119#endif
    118120- (void)_webView:(WKWebView *)webView didChangeSafeAreaShouldAffectObscuredInsets:(BOOL)safeAreaShouldAffectObscuredInsets WK_API_AVAILABLE(ios(WK_IOS_TBA));
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

    r219191 r219224  
    45364536}
    45374537
     4538- (_UIDataOwner)_dragInteraction:(UIDragInteraction *)interaction dataOwnerForSession:(id <UIDragSession>)session
     4539{
     4540    id <WKUIDelegatePrivate> uiDelegate = self.webViewUIDelegate;
     4541    _UIDataOwner dataOwner = _UIDataOwnerUndefined;
     4542    if ([uiDelegate respondsToSelector:@selector(_webView:dataOwnerForDragSession:)])
     4543        dataOwner = (_UIDataOwner)[uiDelegate _webView:_webView dataOwnerForDragSession:session];
     4544    return dataOwner;
     4545}
     4546
    45384547- (void)_dragInteraction:(UIDragInteraction *)interaction prepareForSession:(id <UIDragSession>)session completion:(dispatch_block_t)completion
    45394548{
     
    47094718
    47104719#pragma mark - UIDropInteractionDelegate
     4720
     4721- (_UIDataOwner)_dropInteraction:(UIDropInteraction *)interaction dataOwnerForSession:(id <UIDropSession>)session
     4722{
     4723    id <WKUIDelegatePrivate> uiDelegate = self.webViewUIDelegate;
     4724    _UIDataOwner dataOwner = _UIDataOwnerUndefined;
     4725    if ([uiDelegate respondsToSelector:@selector(_webView:dataOwnerForDropSession:)])
     4726        dataOwner = (_UIDataOwner)[uiDelegate _webView:_webView dataOwnerForDropSession:session];
     4727    return dataOwner;
     4728}
    47114729
    47124730- (BOOL)dropInteraction:(UIDropInteraction *)interaction canHandleSession:(id<UIDropSession>)session
Note: See TracChangeset for help on using the changeset viewer.