Title: [246867] trunk/Source/WebKit
- Revision
- 246867
- Author
- [email protected]
- Date
- 2019-06-26 18:28:57 -0700 (Wed, 26 Jun 2019)
Log Message
Add type to UIImage symbol mapping for _WKElementAction
https://bugs.webkit.org/show_bug.cgi?id=199255
Reviewed by Sam Weinig.
Moving some code in from WebKitAdditions now
that the API is public.
* UIProcess/API/Cocoa/_WKElementAction.mm:
(+[_WKElementAction imageForElementActionType:]):
(elementActionTypeToUIActionIdentifier):
(uiActionIdentifierToElementActionType):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (246866 => 246867)
--- trunk/Source/WebKit/ChangeLog 2019-06-27 01:08:23 UTC (rev 246866)
+++ trunk/Source/WebKit/ChangeLog 2019-06-27 01:28:57 UTC (rev 246867)
@@ -1,5 +1,20 @@
2019-06-26 Dean Jackson <[email protected]>
+ Add type to UIImage symbol mapping for _WKElementAction
+ https://bugs.webkit.org/show_bug.cgi?id=199255
+
+ Reviewed by Sam Weinig.
+
+ Moving some code in from WebKitAdditions now
+ that the API is public.
+
+ * UIProcess/API/Cocoa/_WKElementAction.mm:
+ (+[_WKElementAction imageForElementActionType:]):
+ (elementActionTypeToUIActionIdentifier):
+ (uiActionIdentifierToElementActionType):
+
+2019-06-26 Dean Jackson <[email protected]>
+
Expose UIAction identifiers for _WKElementActions
https://bugs.webkit.org/show_bug.cgi?id=199246
<rdar://problem/52218950>
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm (246866 => 246867)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm 2019-06-27 01:08:23 UTC (rev 246866)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKElementAction.mm 2019-06-27 01:28:57 UTC (rev 246867)
@@ -38,10 +38,6 @@
#import <wtf/WeakObjCPtr.h>
#import <wtf/text/WTFString.h>
-#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/WKElementActionAdditions.h>)
-#include <WebKitAdditions/WKElementActionAdditions.h>
-#endif
-
#if HAVE(SAFARI_SERVICES_FRAMEWORK)
#import <SafariServices/SSReadingList.h>
SOFT_LINK_FRAMEWORK(SafariServices);
@@ -193,16 +189,35 @@
[self _runActionWithElementInfo:info forActionSheetAssistant:_defaultActionSheetAssistant.get().get()];
}
-#if USE(APPLE_INTERNAL_SDK) && __has_include(<WebKitAdditions/WKElementActionAdditions.mm>)
-#include <WebKitAdditions/WKElementActionAdditions.mm>
-#else
+#if USE(UICONTEXTMENU)
+ (UIImage *)imageForElementActionType:(_WKElementActionType)actionType
{
- return nil;
+ switch (actionType) {
+ case _WKElementActionTypeCustom:
+ return nil;
+ case _WKElementActionTypeOpen:
+ return [UIImage systemImageNamed:@"safari"];
+ case _WKElementActionTypeCopy:
+ return [UIImage systemImageNamed:@"doc.on.doc"];
+ case _WKElementActionTypeSaveImage:
+ return [UIImage systemImageNamed:@"square.and.arrow.down"];
+ case _WKElementActionTypeAddToReadingList:
+ return [UIImage systemImageNamed:@"eyeglasses"];
+ case _WKElementActionTypeOpenInDefaultBrowser:
+ return [UIImage systemImageNamed:@"safari"];
+ case _WKElementActionTypeOpenInExternalApplication:
+ return [UIImage systemImageNamed:@"arrow.up.right.square"];
+ case _WKElementActionTypeShare:
+ return [UIImage systemImageNamed:@"square.and.arrow.up"];
+ case _WKElementActionTypeOpenInNewTab:
+ return [UIImage systemImageNamed:@"plus.square.on.square"];
+ case _WKElementActionTypeOpenInNewWindow:
+ return [UIImage systemImageNamed:@"square.grid.2x2"];
+ case _WKElementActionTypeDownload:
+ return [UIImage systemImageNamed:@"arrow.down.circle"];
+ }
}
-#endif
-#if USE(UICONTEXTMENU)
static UIActionIdentifier elementActionTypeToUIActionIdentifier(_WKElementActionType actionType)
{
switch (actionType) {
@@ -214,7 +229,6 @@
return WKElementActionTypeCopyIdentifier;
case _WKElementActionTypeSaveImage:
return WKElementActionTypeSaveImageIdentifier;
-#if !defined(TARGET_OS_IOS) || TARGET_OS_IOS
case _WKElementActionTypeAddToReadingList:
return WKElementActionTypeAddToReadingListIdentifier;
case _WKElementActionTypeOpenInDefaultBrowser:
@@ -221,7 +235,6 @@
return WKElementActionTypeOpenInDefaultBrowserIdentifier;
case _WKElementActionTypeOpenInExternalApplication:
return WKElementActionTypeOpenInExternalApplicationIdentifier;
-#endif
case _WKElementActionTypeShare:
return WKElementActionTypeShareIdentifier;
case _WKElementActionTypeOpenInNewTab:
@@ -243,7 +256,6 @@
return _WKElementActionTypeCopy;
if ([identifier isEqualToString:WKElementActionTypeSaveImageIdentifier])
return _WKElementActionTypeSaveImage;
-#if !defined(TARGET_OS_IOS) || TARGET_OS_IOS
if ([identifier isEqualToString:WKElementActionTypeAddToReadingListIdentifier])
return _WKElementActionTypeAddToReadingList;
if ([identifier isEqualToString:WKElementActionTypeOpenInDefaultBrowserIdentifier])
@@ -250,7 +262,6 @@
return _WKElementActionTypeOpenInDefaultBrowser;
if ([identifier isEqualToString:WKElementActionTypeOpenInExternalApplicationIdentifier])
return _WKElementActionTypeOpenInExternalApplication;
-#endif
if ([identifier isEqualToString:WKElementActionTypeShareIdentifier])
return _WKElementActionTypeShare;
if ([identifier isEqualToString:WKElementActionTypeOpenInNewTabIdentifier])
@@ -284,6 +295,11 @@
}];
}
#else
++ (UIImage *)imageForElementActionType:(_WKElementActionType)actionType
+{
+ return nil;
+}
+
+ (_WKElementActionType)elementActionTypeForUIActionIdentifier:(UIActionIdentifier)identifier
{
return _WKElementActionTypeCustom;
@@ -293,7 +309,7 @@
{
return nil;
}
-#endif
+#endif // USE(UICONTEXTMENU)
@end
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes