Title: [244472] trunk/Source/WebKit
Revision
244472
Author
[email protected]
Date
2019-04-19 15:24:53 -0700 (Fri, 19 Apr 2019)

Log Message

Add more _WKElementActionTypes and provide API to create with custom types
https://bugs.webkit.org/show_bug.cgi?id=197117
<rdar://problem/50059548>

Reviewed by Tim Horton.

We were missing a few obvious types that are well-known
browser actions, and/or should be visible in share sheets.
Also, clean up the API for constructing new types.

* UIProcess/API/Cocoa/_WKElementAction.h: Add new types for opening
in new tabs, windows and downloading.
* UIProcess/API/Cocoa/_WKElementAction.mm:
(+[_WKElementAction elementActionWithType:title:actionHandler:]): New constructor
with type, title and action.
(+[_WKElementAction elementActionWithType:]): Call new method.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (244471 => 244472)


--- trunk/Source/WebKit/ChangeLog	2019-04-19 21:53:22 UTC (rev 244471)
+++ trunk/Source/WebKit/ChangeLog	2019-04-19 22:24:53 UTC (rev 244472)
@@ -1,3 +1,22 @@
+2019-04-19  Dean Jackson  <[email protected]>
+
+        Add more _WKElementActionTypes and provide API to create with custom types
+        https://bugs.webkit.org/show_bug.cgi?id=197117
+        <rdar://problem/50059548>
+
+        Reviewed by Tim Horton.
+
+        We were missing a few obvious types that are well-known
+        browser actions, and/or should be visible in share sheets.
+        Also, clean up the API for constructing new types.
+
+        * UIProcess/API/Cocoa/_WKElementAction.h: Add new types for opening
+        in new tabs, windows and downloading.
+        * UIProcess/API/Cocoa/_WKElementAction.mm:
+        (+[_WKElementAction elementActionWithType:title:actionHandler:]): New constructor
+        with type, title and action.
+        (+[_WKElementAction elementActionWithType:]): Call new method.
+
 2019-04-18  Daniel Bates  <[email protected]>
 
         Use existing KeyEventCodesIOS constants instead of duplicating them

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.h (244471 => 244472)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.h	2019-04-19 21:53:22 UTC (rev 244471)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.h	2019-04-19 22:24:53 UTC (rev 244472)
@@ -42,7 +42,10 @@
     _WKElementActionTypeOpenInDefaultBrowser WK_API_AVAILABLE(ios(9_0)),
     _WKElementActionTypeOpenInExternalApplication WK_API_AVAILABLE(ios(9_0)),
 #endif
-    _WKElementActionTypeShare WK_API_AVAILABLE(ios(10.0)),
+    _WKElementActionTypeShare WK_API_AVAILABLE(macos(10.12), ios(10.0)),
+    _WKElementActionTypeOpenInNewTab WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)),
+    _WKElementActionTypeOpenInNewWindow WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)),
+    _WKElementActionTypeDownload WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)),
 } WK_API_AVAILABLE(macos(10.10), ios(8.0));
 
 WK_CLASS_AVAILABLE(macos(10.10), ios(8.0))
@@ -49,8 +52,8 @@
 @interface _WKElementAction : NSObject
 
 + (instancetype)elementActionWithType:(_WKElementActionType)type;
++ (instancetype)elementActionWithType:(_WKElementActionType)type title:(NSString *)title actionHandler:(WKElementActionHandler)actionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 + (instancetype)elementActionWithType:(_WKElementActionType)type customTitle:(NSString *)title;
-
 + (instancetype)elementActionWithTitle:(NSString *)title actionHandler:(WKElementActionHandler)handler;
 
 - (void)runActionWithElementInfo:(_WKActivatedElementInfo *)info WK_API_AVAILABLE(ios(9_0));

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm (244471 => 244472)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm	2019-04-19 21:53:22 UTC (rev 244471)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm	2019-04-19 22:24:53 UTC (rev 244472)
@@ -89,6 +89,11 @@
 }
 #endif
 
++ (instancetype)elementActionWithType:(_WKElementActionType)type title:(NSString *)title actionHandler:(WKElementActionHandler)actionHandler
+{
+    return [_WKElementAction _elementActionWithType:type title:title actionHandler:actionHandler];
+}
+
 + (instancetype)_elementActionWithType:(_WKElementActionType)type title:(NSString *)title actionHandler:(WKElementActionHandler)actionHandler
 {
     WKElementActionHandlerInternal handler = ^(WKActionSheetAssistant *, _WKActivatedElementInfo *actionInfo) { actionHandler(actionInfo); };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to