Title: [218380] trunk/Source/WebKit/mac
Revision
218380
Author
wenson_hs...@apple.com
Date
2017-06-15 21:06:04 -0700 (Thu, 15 Jun 2017)

Log Message

[iOS DnD] [WK1] Dropping links onto UIWebViews should not trigger navigation by default
https://bugs.webkit.org/show_bug.cgi?id=173454
<rdar://problem/31720671>

Reviewed by Tim Horton.

Adds -webView:dragDestinationActionMaskForSession: as SPI to WebUIDelegate.
If unimplemented, the default UI delegate allows all actions except for URL loading.

* DefaultDelegates/WebDefaultUIDelegate.mm:
(-[WebDefaultUIDelegate webView:dragDestinationActionMaskForSession:]):
* WebView/WebUIDelegatePrivate.h:
* WebView/WebView.mm:
(-[WebView dragDestinationActionMaskForSession:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (218379 => 218380)


--- trunk/Source/WebKit/mac/ChangeLog	2017-06-16 03:55:43 UTC (rev 218379)
+++ trunk/Source/WebKit/mac/ChangeLog	2017-06-16 04:06:04 UTC (rev 218380)
@@ -1,5 +1,22 @@
 2017-06-15  Wenson Hsieh  <wenson_hs...@apple.com>
 
+        [iOS DnD] [WK1] Dropping links onto UIWebViews should not trigger navigation by default
+        https://bugs.webkit.org/show_bug.cgi?id=173454
+        <rdar://problem/31720671>
+
+        Reviewed by Tim Horton.
+
+        Adds -webView:dragDestinationActionMaskForSession: as SPI to WebUIDelegate.
+        If unimplemented, the default UI delegate allows all actions except for URL loading.
+
+        * DefaultDelegates/WebDefaultUIDelegate.mm:
+        (-[WebDefaultUIDelegate webView:dragDestinationActionMaskForSession:]):
+        * WebView/WebUIDelegatePrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView dragDestinationActionMaskForSession:]):
+
+2017-06-15  Wenson Hsieh  <wenson_hs...@apple.com>
+
         Using -[WebItemProviderPasteboard setItemProviders:] to swap out item providers before a drop breaks item provider loading
         https://bugs.webkit.org/show_bug.cgi?id=173338
         <rdar://problem/32777720>

Modified: trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.mm (218379 => 218380)


--- trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.mm	2017-06-16 03:55:43 UTC (rev 218379)
+++ trunk/Source/WebKit/mac/DefaultDelegates/WebDefaultUIDelegate.mm	2017-06-16 04:06:04 UTC (rev 218380)
@@ -270,6 +270,13 @@
 - (void)webViewSupportedOrientationsUpdated:(WebView *)sender
 {
 }
+
+#if ENABLE(DRAG_SUPPORT)
+- (WebDragDestinationAction)webView:(WebView *)sender dragDestinationActionMaskForSession:(id <UIDropSession>)session
+{
+    return WebDragDestinationActionAny & ~WebDragDestinationActionLoad;
+}
 #endif
+#endif
 
 @end

Modified: trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h (218379 => 218380)


--- trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h	2017-06-16 03:55:43 UTC (rev 218379)
+++ trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h	2017-06-16 04:06:04 UTC (rev 218380)
@@ -45,6 +45,10 @@
 #endif
 #endif
 
+#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+@protocol UIDropSession;
+#endif
+
 #define WEBMENUITEMTAG_WEBKIT_3_0_SPI_START 2000
 enum { 
     // FIXME: These should move to WebUIDelegate.h as part of the WebMenuItemTag enum there, when we're not in API freeze
@@ -290,7 +294,17 @@
 - (void)webViewSupportedOrientationsUpdated:(WebView *)sender;
 
 - (BOOL)webViewCanCheckGeolocationAuthorizationStatus:(WebView *)sender;
+
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+/*!
+ @method webView:dragDestinationActionMaskForSession:
+ @param sender The WebView sending the delegate method
+ @param session The drop session which this destination action mask will affect
+ @abstract May be implemented to adjust which destination actions are allowed upon dropping the given session.
+ */
+- (WebDragDestinationAction)webView:(WebView *)sender dragDestinationActionMaskForSession:(id <UIDropSession>)session;
 #endif
+#endif
 
 - (NSData *)webCryptoMasterKeyForWebView:(WebView *)sender;
 

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (218379 => 218380)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2017-06-16 03:55:43 UTC (rev 218379)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2017-06-16 04:06:04 UTC (rev 218380)
@@ -1898,6 +1898,11 @@
     return [previewImage retain];
 }
 
+- (WebDragDestinationAction)dragDestinationActionMaskForSession:(id <UIDropSession>)session
+{
+    return [self._UIDelegateForwarder webView:self dragDestinationActionMaskForSession:session];
+}
+
 #if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/WebViewAdditions.mm>)
 #include <WebKitAdditions/WebViewAdditions.mm>
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to