Title: [274380] trunk/Source
Revision
274380
Author
[email protected]
Date
2021-03-13 01:03:04 -0800 (Sat, 13 Mar 2021)

Log Message

Adopt DDMacAction instead of DDAction on macOS
https://bugs.webkit.org/show_bug.cgi?id=223145
<rdar://problem/70127512>

Reviewed by Megan Gardner.

Source/WebCore/PAL:

* pal/spi/mac/DataDetectorsSPI.h:

Source/WebKit:

* Platform/mac/MenuUtilities.mm:
(WebKit::actionForMenuItem):
(WebKit::menuItemForTelephoneNumber):
(WebKit::menuForTelephoneNumber):
Adopt the new class name, when available.

Source/WTF:

* wtf/PlatformHave.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (274379 => 274380)


--- trunk/Source/WTF/ChangeLog	2021-03-13 09:02:37 UTC (rev 274379)
+++ trunk/Source/WTF/ChangeLog	2021-03-13 09:03:04 UTC (rev 274380)
@@ -1,3 +1,13 @@
+2021-03-13  Tim Horton  <[email protected]>
+
+        Adopt DDMacAction instead of DDAction on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=223145
+        <rdar://problem/70127512>
+
+        Reviewed by Megan Gardner.
+
+        * wtf/PlatformHave.h:
+
 2021-03-12  Lauro Moura  <[email protected]>
 
         REGRESSION(r274327) [GLIB] 2D Canvas tests timing out after enabling GPUProces in testing

Modified: trunk/Source/WTF/wtf/PlatformHave.h (274379 => 274380)


--- trunk/Source/WTF/wtf/PlatformHave.h	2021-03-13 09:02:37 UTC (rev 274379)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2021-03-13 09:03:04 UTC (rev 274380)
@@ -916,6 +916,7 @@
 
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
 #define HAVE_STATIC_FONT_REGISTRY 1
+#define HAVE_DATA_DETECTORS_MAC_ACTION 1
 #endif
 
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000) \

Modified: trunk/Source/WebCore/PAL/ChangeLog (274379 => 274380)


--- trunk/Source/WebCore/PAL/ChangeLog	2021-03-13 09:02:37 UTC (rev 274379)
+++ trunk/Source/WebCore/PAL/ChangeLog	2021-03-13 09:03:04 UTC (rev 274380)
@@ -1,3 +1,13 @@
+2021-03-13  Tim Horton  <[email protected]>
+
+        Adopt DDMacAction instead of DDAction on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=223145
+        <rdar://problem/70127512>
+
+        Reviewed by Megan Gardner.
+
+        * pal/spi/mac/DataDetectorsSPI.h:
+
 2021-03-12  Myles C. Maxfield  <[email protected]>
 
         [macOS] MobileAsset fonts are broken in Reader mode in Safari

Modified: trunk/Source/WebCore/PAL/pal/spi/mac/DataDetectorsSPI.h (274379 => 274380)


--- trunk/Source/WebCore/PAL/pal/spi/mac/DataDetectorsSPI.h	2021-03-13 09:02:37 UTC (rev 274379)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/DataDetectorsSPI.h	2021-03-13 09:03:04 UTC (rev 274380)
@@ -39,6 +39,10 @@
 #import <DataDetectors/DDActionsManager.h>
 #import <DataDetectors/DDHighlightDrawing.h>
 
+#if HAVE(DATA_DETECTORS_MAC_ACTION)
+#import <DataDetectors/DDMacAction.h>
+#endif
+
 #else // !USE(APPLE_INTERNAL_SDK)
 
 @interface DDActionContext : NSObject <NSCopying, NSSecureCoding>
@@ -98,19 +102,26 @@
 typedef struct __DDHighlight *DDHighlightRef;
 typedef NSUInteger DDHighlightStyle;
 
+#if !HAVE(DATA_DETECTORS_MAC_ACTION)
 @interface DDAction : NSObject
 
 @property (readonly) NSString *actionUTI;
 
 @end
+#endif
 
 SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(DataDetectors)
 SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(DataDetectorsCore)
 
-SOFT_LINK_CLASS_OPTIONAL(DataDetectors, DDAction)
 SOFT_LINK_CLASS_OPTIONAL(DataDetectors, DDActionContext)
 SOFT_LINK_CLASS_OPTIONAL(DataDetectors, DDActionsManager)
 
+#if HAVE(DATA_DETECTORS_MAC_ACTION)
+SOFT_LINK_CLASS_OPTIONAL(DataDetectors, DDMacAction)
+#else
+SOFT_LINK_CLASS_OPTIONAL(DataDetectors, DDAction)
+#endif
+
 SOFT_LINK_CONSTANT(DataDetectorsCore, DDBinderPhoneNumberKey, CFStringRef)
 #if HAVE(DD_HIGHLIGHT_CREATE_WITH_SCALE)
 SOFT_LINK(DataDetectors, DDHighlightCreateWithRectsInVisibleRectWithStyleScaleAndDirection, DDHighlightRef, (CFAllocatorRef allocator, CGRect* rects, CFIndex count, CGRect globalVisibleRect, DDHighlightStyle style, Boolean withButton, NSWritingDirection writingDirection, Boolean endsWithEOL, Boolean flipped, CGFloat scale), (allocator, rects, count, globalVisibleRect, style, withButton, writingDirection, endsWithEOL, flipped, scale))

Modified: trunk/Source/WebKit/ChangeLog (274379 => 274380)


--- trunk/Source/WebKit/ChangeLog	2021-03-13 09:02:37 UTC (rev 274379)
+++ trunk/Source/WebKit/ChangeLog	2021-03-13 09:03:04 UTC (rev 274380)
@@ -1,3 +1,17 @@
+2021-03-13  Tim Horton  <[email protected]>
+
+        Adopt DDMacAction instead of DDAction on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=223145
+        <rdar://problem/70127512>
+
+        Reviewed by Megan Gardner.
+
+        * Platform/mac/MenuUtilities.mm:
+        (WebKit::actionForMenuItem):
+        (WebKit::menuItemForTelephoneNumber):
+        (WebKit::menuForTelephoneNumber):
+        Adopt the new class name, when available.
+
 2021-03-12  Jer Noble  <[email protected]>
 
         [Cocoa][WebM] Hang when reloading page before WebM content is loaded

Modified: trunk/Source/WebKit/Platform/mac/MenuUtilities.mm (274379 => 274380)


--- trunk/Source/WebKit/Platform/mac/MenuUtilities.mm	2021-03-13 09:02:37 UTC (rev 274379)
+++ trunk/Source/WebKit/Platform/mac/MenuUtilities.mm	2021-03-13 09:03:04 UTC (rev 274380)
@@ -49,6 +49,29 @@
     return [getTUCallClass() supplementalDialTelephonyCallString];
 }
 
+#if HAVE(DATA_DETECTORS_MAC_ACTION)
+static DDMacAction *actionForMenuItem(NSMenuItem *item)
+#else
+static DDAction *actionForMenuItem(NSMenuItem *item)
+#endif
+{
+    NSDictionary *representedObject = item.representedObject;
+    if (![representedObject isKindOfClass:[NSDictionary class]])
+        return nil;
+
+    id action = "" objectForKey:@"DDAction"];
+
+#if HAVE(DATA_DETECTORS_MAC_ACTION)
+    if (![action isKindOfClass:getDDMacActionClass()])
+        return nil;
+#else
+    if (![action isKindOfClass:getDDActionClass()])
+        return nil;
+#endif
+
+    return action;
+}
+
 NSMenuItem *menuItemForTelephoneNumber(const String& telephoneNumber)
 {
     if (!DataDetectorsLibrary())
@@ -59,15 +82,8 @@
 
     NSArray *proposedMenuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForValue:(NSString *)telephoneNumber type:getDDBinderPhoneNumberKey() service:nil context:actionContext.get()];
     for (NSMenuItem *item in proposedMenuItems) {
-        NSDictionary *representedObject = item.representedObject;
-        if (![representedObject isKindOfClass:[NSDictionary class]])
-            continue;
-
-        DDAction *actionObject = [representedObject objectForKey:@"DDAction"];
-        if (![actionObject isKindOfClass:getDDActionClass()])
-            continue;
-
-        if ([actionObject.actionUTI hasPrefix:@"com.apple.dial"]) {
+        auto action = ""
+        if ([action.actionUTI hasPrefix:@"com.apple.dial"]) {
             item.title = formattedPhoneNumberString(telephoneNumber);
             return item;
         }
@@ -90,17 +106,10 @@
 
     NSArray *proposedMenuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForValue:(NSString *)telephoneNumber type:getDDBinderPhoneNumberKey() service:nil context:actionContext.get()];
     for (NSMenuItem *item in proposedMenuItems) {
-        NSDictionary *representedObject = item.representedObject;
-        if (![representedObject isKindOfClass:[NSDictionary class]])
-            continue;
-
-        DDAction *actionObject = [representedObject objectForKey:@"DDAction"];
-        if (![actionObject isKindOfClass:getDDActionClass()])
-            continue;
-
-        if ([actionObject.actionUTI hasPrefix:@"com.apple.dial"])
+        auto action = ""
+        if ([action.actionUTI hasPrefix:@"com.apple.dial"])
             dialItem = item;
-        else if ([actionObject.actionUTI hasPrefix:@"com.apple.facetime"])
+        else if ([action.actionUTI hasPrefix:@"com.apple.facetime"])
             [faceTimeItems addObject:item];
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to