Title: [278530] trunk/Source
Revision
278530
Author
[email protected]
Date
2021-06-05 18:18:09 -0700 (Sat, 05 Jun 2021)

Log Message

[macOS] Move DataDetectors softlinking in DataDetectorsSPI.h out into a separate PAL header
https://bugs.webkit.org/show_bug.cgi?id=226669

Reviewed by Sam Weinig.

Source/WebCore:

Clean up some softlinking code for the DataDetectors framework. Currently, the `SOFT_LINK_*` macros are defined
inside the SPI header (`pal/spi/mac/DataDetectorsSPI.h`); this patch moves them out into
`pal/mac/DataDetectorsSoftLink.{h|mm}` instead, and updates a few places that use these soft-linked symbols to
import `DataDetectorsSoftLink.h` instead of `DataDetectorsSPI.h`.

* editing/cocoa/DataDetection.mm:
(WebCore::detectItem):
(WebCore::DataDetection::detectItemAroundHitTestResult):
* page/mac/ImageOverlayControllerMac.mm:
(WebCore::ImageOverlayController::updateDataDetectorHighlights):
(WebCore::ImageOverlayController::platformHandleMouseEvent):
* page/mac/ServicesOverlayController.mm:
(WebCore::ServicesOverlayController::mouseIsOverHighlight const):
(WebCore::ServicesOverlayController::buildPhoneNumberHighlights):
(WebCore::ServicesOverlayController::buildSelectionHighlight):
* platform/mac/DataDetectorHighlight.mm:
(WebCore::DataDetectorHighlight::setHighlight):
(WebCore::DataDetectorHighlight::paintContents):

Source/WebCore/PAL:

Add the new softlinking headers. See WebCore/ChangeLog for more details.

* PAL.xcodeproj/project.pbxproj:
* pal/PlatformMac.cmake:
* pal/cocoa/DataDetectorsCoreSoftLink.h:
* pal/cocoa/DataDetectorsCoreSoftLink.mm:

Move the `DDBinderPhoneNumberKey` soft link into `DataDetectorsCoreSoftLink` instead, since this symbol comes
from DataDetectorsCore rather than the DataDetectors framework.

* pal/mac/DataDetectorsSoftLink.h: Added.
* pal/mac/DataDetectorsSoftLink.mm: Added.
* pal/mac/QuickLookUISoftLink.h:
* pal/spi/mac/DataDetectorsSPI.h:

Source/WebKit:

Adopt the new PAL softlinking header in a few places. See WebCore/ChangeLog for more details. Additionally, move
several softlinking header imports so that they're the last imported headers in a few sources.

* Platform/mac/MenuUtilities.mm:
(WebKit::actionForMenuItem):
(WebKit::menuItemForTelephoneNumber):
* Shared/Cocoa/DataDetectionResult.mm:
(WebKit::DataDetectionResult::decode):
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::decode):
* Shared/mac/WebHitTestResultData.mm:
(WebKit::WebHitTestResultData::platformDecode):
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly):
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController _clearImmediateActionState]):
(-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
(-[WKImmediateActionController _animationControllerForDataDetectedText]):
(-[WKImmediateActionController _animationControllerForDataDetectedLink]):

Source/WebKitLegacy/mac:

Adopt the new PAL softlinking header in a few places. See WebCore/ChangeLog for more details.

* WebView/WebImmediateActionController.mm:
(-[WebImmediateActionController _clearImmediateActionState]):
(-[WebImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
(-[WebImmediateActionController _animationControllerForDataDetectedText]):
(-[WebImmediateActionController _animationControllerForDataDetectedLink]):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (278529 => 278530)


--- trunk/Source/WebCore/ChangeLog	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebCore/ChangeLog	2021-06-06 01:18:09 UTC (rev 278530)
@@ -1,3 +1,29 @@
+2021-06-05  Wenson Hsieh  <[email protected]>
+
+        [macOS] Move DataDetectors softlinking in DataDetectorsSPI.h out into a separate PAL header
+        https://bugs.webkit.org/show_bug.cgi?id=226669
+
+        Reviewed by Sam Weinig.
+
+        Clean up some softlinking code for the DataDetectors framework. Currently, the `SOFT_LINK_*` macros are defined
+        inside the SPI header (`pal/spi/mac/DataDetectorsSPI.h`); this patch moves them out into
+        `pal/mac/DataDetectorsSoftLink.{h|mm}` instead, and updates a few places that use these soft-linked symbols to
+        import `DataDetectorsSoftLink.h` instead of `DataDetectorsSPI.h`.
+
+        * editing/cocoa/DataDetection.mm:
+        (WebCore::detectItem):
+        (WebCore::DataDetection::detectItemAroundHitTestResult):
+        * page/mac/ImageOverlayControllerMac.mm:
+        (WebCore::ImageOverlayController::updateDataDetectorHighlights):
+        (WebCore::ImageOverlayController::platformHandleMouseEvent):
+        * page/mac/ServicesOverlayController.mm:
+        (WebCore::ServicesOverlayController::mouseIsOverHighlight const):
+        (WebCore::ServicesOverlayController::buildPhoneNumberHighlights):
+        (WebCore::ServicesOverlayController::buildSelectionHighlight):
+        * platform/mac/DataDetectorHighlight.mm:
+        (WebCore::DataDetectorHighlight::setHighlight):
+        (WebCore::DataDetectorHighlight::paintContents):
+
 2021-06-05  Dean Jackson  <[email protected]>
 
         [WebXR] Supply an IOSurface in SimulatedXRDevice

Modified: trunk/Source/WebCore/PAL/ChangeLog (278529 => 278530)


--- trunk/Source/WebCore/PAL/ChangeLog	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebCore/PAL/ChangeLog	2021-06-06 01:18:09 UTC (rev 278530)
@@ -1,3 +1,25 @@
+2021-06-05  Wenson Hsieh  <[email protected]>
+
+        [macOS] Move DataDetectors softlinking in DataDetectorsSPI.h out into a separate PAL header
+        https://bugs.webkit.org/show_bug.cgi?id=226669
+
+        Reviewed by Sam Weinig.
+
+        Add the new softlinking headers. See WebCore/ChangeLog for more details.
+
+        * PAL.xcodeproj/project.pbxproj:
+        * pal/PlatformMac.cmake:
+        * pal/cocoa/DataDetectorsCoreSoftLink.h:
+        * pal/cocoa/DataDetectorsCoreSoftLink.mm:
+
+        Move the `DDBinderPhoneNumberKey` soft link into `DataDetectorsCoreSoftLink` instead, since this symbol comes
+        from DataDetectorsCore rather than the DataDetectors framework.
+
+        * pal/mac/DataDetectorsSoftLink.h: Added.
+        * pal/mac/DataDetectorsSoftLink.mm: Added.
+        * pal/mac/QuickLookUISoftLink.h:
+        * pal/spi/mac/DataDetectorsSPI.h:
+
 2021-06-01  Darin Adler  <[email protected]>
 
         Remove <wtf/Optional.h>

Modified: trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj (278529 => 278530)


--- trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj	2021-06-06 01:18:09 UTC (rev 278530)
@@ -213,6 +213,8 @@
 		F4C85A4F2658551A005B89CC /* QuickLookUISoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = F4C85A4D2658551A005B89CC /* QuickLookUISoftLink.h */; };
 		F4DDD01B264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4DDD019264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.mm */; };
 		F4DDD01C264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = F4DDD01A264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.h */; };
+		F4E0875B266ACA53000F814A /* DataDetectorsSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = F4E08759266ACA53000F814A /* DataDetectorsSoftLink.h */; };
+		F4E0875C266ACA53000F814A /* DataDetectorsSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4E0875A266ACA53000F814A /* DataDetectorsSoftLink.mm */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -432,6 +434,8 @@
 		F4C85A4D2658551A005B89CC /* QuickLookUISoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickLookUISoftLink.h; sourceTree = "<group>"; };
 		F4DDD019264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataDetectorsCoreSoftLink.mm; sourceTree = "<group>"; };
 		F4DDD01A264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataDetectorsCoreSoftLink.h; sourceTree = "<group>"; };
+		F4E08759266ACA53000F814A /* DataDetectorsSoftLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DataDetectorsSoftLink.h; sourceTree = "<group>"; };
+		F4E0875A266ACA53000F814A /* DataDetectorsSoftLink.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DataDetectorsSoftLink.mm; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -755,6 +759,8 @@
 		44E1A8AC21FA548F00C3048E /* mac */ = {
 			isa = PBXGroup;
 			children = (
+				F4E08759266ACA53000F814A /* DataDetectorsSoftLink.h */,
+				F4E0875A266ACA53000F814A /* DataDetectorsSoftLink.mm */,
 				44E1A8AD21FA54DA00C3048E /* LookupSoftLink.h */,
 				44E1A8AE21FA54DA00C3048E /* LookupSoftLink.mm */,
 				F4C85A4D2658551A005B89CC /* QuickLookUISoftLink.h */,
@@ -867,6 +873,7 @@
 				DF83E209263734F1000825EF /* CryptoKitCBridgingSPI.h in Headers */,
 				F4DDD01C264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.h in Headers */,
 				0C2DA1411F3BEB4900DBC317 /* DataDetectorsCoreSPI.h in Headers */,
+				F4E0875B266ACA53000F814A /* DataDetectorsSoftLink.h in Headers */,
 				0C77858A1F45130F00F4EBB6 /* DataDetectorsSPI.h in Headers */,
 				0C5AF91A1F43A4C7002EAC02 /* DataDetectorsUISPI.h in Headers */,
 				A1175B571F6B470500C4B9F0 /* DefaultSearchProvider.h in Headers */,
@@ -1081,6 +1088,7 @@
 				1C09D0561E31C46500725F18 /* CryptoDigestCommonCrypto.cpp in Sources */,
 				57F1C90A25DCF0CF00E8F6EA /* CryptoKitCBridgingSoftLink.mm in Sources */,
 				F4DDD01B264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.mm in Sources */,
+				F4E0875C266ACA53000F814A /* DataDetectorsSoftLink.mm in Sources */,
 				A1175B581F6B470500C4B9F0 /* DefaultSearchProvider.cpp in Sources */,
 				F44291641FA52670002CC93E /* FileSizeFormatter.cpp in Sources */,
 				F44291681FA52705002CC93E /* FileSizeFormatterCocoa.mm in Sources */,

Modified: trunk/Source/WebCore/PAL/pal/PlatformMac.cmake (278529 => 278530)


--- trunk/Source/WebCore/PAL/pal/PlatformMac.cmake	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebCore/PAL/pal/PlatformMac.cmake	2021-06-06 01:18:09 UTC (rev 278530)
@@ -20,6 +20,7 @@
     cocoa/SpeechSoftLink.h
     cocoa/UsageTrackingSoftLink.h
 
+    mac/DataDetectorsSoftLink.h
     mac/LookupSoftLink.h
     mac/QuickLookUISoftLink.h
 
@@ -163,7 +164,9 @@
 
     crypto/commoncrypto/CryptoDigestCommonCrypto.cpp
 
+    mac/DataDetectorsSoftLink.mm
     mac/LookupSoftLink.mm
+    mac/QuickLookUISoftLink.mm
 
     spi/cocoa/AccessibilitySupportSoftLink.cpp
 

Modified: trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.h (278529 => 278530)


--- trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.h	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.h	2021-06-06 01:18:09 UTC (rev 278530)
@@ -32,7 +32,9 @@
 
 SOFT_LINK_CLASS_FOR_HEADER(PAL, DDScannerResult)
 
-#if PLATFORM(IOS_FAMILY)
+#if PLATFORM(MAC)
+SOFT_LINK_CONSTANT_FOR_HEADER(PAL, DataDetectorsCore, DDBinderPhoneNumberKey, CFStringRef)
+#elif PLATFORM(IOS_FAMILY)
 SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDScannerCreate, DDScannerRef, (DDScannerType type, DDScannerOptions options, CFErrorRef * errorRef), (type, options, errorRef))
 SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDScannerScanQuery, Boolean, (DDScannerRef scanner, DDScanQueryRef query), (scanner, query))
 SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDScanQueryCreate, DDScanQueryRef, (CFAllocatorRef allocator), (allocator))

Modified: trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.mm (278529 => 278530)


--- trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.mm	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.mm	2021-06-06 01:18:09 UTC (rev 278530)
@@ -33,7 +33,9 @@
 SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE(PAL, DataDetectorsCore)
 SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, DataDetectorsCore, DDScannerResult, PAL_EXPORT)
 
-#if PLATFORM(IOS_FAMILY)
+#if PLATFORM(MAC)
+SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, DataDetectorsCore, DDBinderPhoneNumberKey, CFStringRef, PAL_EXPORT)
+#elif PLATFORM(IOS_FAMILY)
 SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDScannerCreate, DDScannerRef, (DDScannerType type, DDScannerOptions options, CFErrorRef * errorRef), (type, options, errorRef))
 SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDScannerScanQuery, Boolean, (DDScannerRef scanner, DDScanQueryRef query), (scanner, query))
 SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDScanQueryCreate, DDScanQueryRef, (CFAllocatorRef allocator), (allocator))

Added: trunk/Source/WebCore/PAL/pal/mac/DataDetectorsSoftLink.h (0 => 278530)


--- trunk/Source/WebCore/PAL/pal/mac/DataDetectorsSoftLink.h	                        (rev 0)
+++ trunk/Source/WebCore/PAL/pal/mac/DataDetectorsSoftLink.h	2021-06-06 01:18:09 UTC (rev 278530)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if PLATFORM(MAC) && ENABLE(DATA_DETECTION)
+
+#import <pal/spi/mac/DataDetectorsSPI.h>
+#import <wtf/SoftLinking.h>
+
+SOFT_LINK_FRAMEWORK_FOR_HEADER(PAL, DataDetectors)
+
+SOFT_LINK_CLASS_FOR_HEADER(PAL, DDActionContext)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, DDActionsManager)
+
+#if HAVE(DATA_DETECTORS_MAC_ACTION)
+SOFT_LINK_CLASS_FOR_HEADER(PAL, DDMacAction)
+#else
+SOFT_LINK_CLASS_FOR_HEADER(PAL, DDAction)
+#endif
+
+#if HAVE(DD_HIGHLIGHT_CREATE_WITH_SCALE)
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, 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))
+#else
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectors, DDHighlightCreateWithRectsInVisibleRectWithStyleAndDirection, DDHighlightRef, (CFAllocatorRef allocator, CGRect* rects, CFIndex count, CGRect globalVisibleRect, DDHighlightStyle style, Boolean withArrow, NSWritingDirection writingDirection, Boolean endsWithEOL, Boolean flipped), (allocator, rects, count, globalVisibleRect, style, withArrow, writingDirection, endsWithEOL, flipped))
+#endif
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectors, DDHighlightGetLayerWithContext, CGLayerRef, (DDHighlightRef highlight, CGContextRef context), (highlight, context))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectors, DDHighlightGetBoundingRect, CGRect, (DDHighlightRef highlight), (highlight))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectors, DDHighlightPointIsOnHighlight, Boolean, (DDHighlightRef highlight, CGPoint point, Boolean* onButton), (highlight, point, onButton))
+
+#endif // PLATFORM(MAC) && ENABLE(DATA_DETECTION)

Added: trunk/Source/WebCore/PAL/pal/mac/DataDetectorsSoftLink.mm (0 => 278530)


--- trunk/Source/WebCore/PAL/pal/mac/DataDetectorsSoftLink.mm	                        (rev 0)
+++ trunk/Source/WebCore/PAL/pal/mac/DataDetectorsSoftLink.mm	2021-06-06 01:18:09 UTC (rev 278530)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+
+#if PLATFORM(MAC) && ENABLE(DATA_DETECTION)
+
+#import <AppKit/AppKit.h>
+#import <pal/spi/mac/DataDetectorsSPI.h>
+#import <wtf/SoftLinking.h>
+
+SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE_WITH_EXPORT(PAL, DataDetectors, PAL_EXPORT)
+
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, DataDetectors, DDActionContext, PAL_EXPORT)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, DataDetectors, DDActionsManager, PAL_EXPORT)
+
+#if HAVE(DATA_DETECTORS_MAC_ACTION)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, DataDetectors, DDMacAction, PAL_EXPORT)
+#else
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, DataDetectors, DDAction, PAL_EXPORT)
+#endif
+
+#if HAVE(DD_HIGHLIGHT_CREATE_WITH_SCALE)
+SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(PAL, 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), PAL_EXPORT)
+#else
+SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(PAL, DataDetectors, DDHighlightCreateWithRectsInVisibleRectWithStyleAndDirection, DDHighlightRef, (CFAllocatorRef allocator, CGRect* rects, CFIndex count, CGRect globalVisibleRect, DDHighlightStyle style, Boolean withArrow, NSWritingDirection writingDirection, Boolean endsWithEOL, Boolean flipped), (allocator, rects, count, globalVisibleRect, style, withArrow, writingDirection, endsWithEOL, flipped), PAL_EXPORT)
+#endif
+
+SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(PAL, DataDetectors, DDHighlightGetLayerWithContext, CGLayerRef, (DDHighlightRef highlight, CGContextRef context), (highlight, context), PAL_EXPORT)
+SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(PAL, DataDetectors, DDHighlightGetBoundingRect, CGRect, (DDHighlightRef highlight), (highlight), PAL_EXPORT)
+SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(PAL, DataDetectors, DDHighlightPointIsOnHighlight, Boolean, (DDHighlightRef highlight, CGPoint point, Boolean* onButton), (highlight, point, onButton), PAL_EXPORT)
+
+#endif // PLATFORM(MAC) && ENABLE(DATA_DETECTION)

Modified: trunk/Source/WebCore/PAL/pal/mac/QuickLookUISoftLink.h (278529 => 278530)


--- trunk/Source/WebCore/PAL/pal/mac/QuickLookUISoftLink.h	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebCore/PAL/pal/mac/QuickLookUISoftLink.h	2021-06-06 01:18:09 UTC (rev 278530)
@@ -26,8 +26,8 @@
 
 #if PLATFORM(MAC)
 
-#include <pal/spi/mac/QuickLookMacSPI.h>
-#include <wtf/SoftLinking.h>
+#import <pal/spi/mac/QuickLookMacSPI.h>
+#import <wtf/SoftLinking.h>
 
 SOFT_LINK_FRAMEWORK_FOR_HEADER(PAL, QuickLookUI)
 

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


--- trunk/Source/WebCore/PAL/pal/spi/mac/DataDetectorsSPI.h	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/DataDetectorsSPI.h	2021-06-06 01:18:09 UTC (rev 278530)
@@ -99,48 +99,22 @@
 
 #endif // !USE(APPLE_INTERNAL_SDK)
 
-#if PLATFORM(MAC)
-
 WTF_EXTERN_C_BEGIN
 CFTypeID DDResultGetCFTypeID(void);
 WTF_EXTERN_C_END
 
-#endif
-
 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)
+#endif // !HAVE(DATA_DETECTORS_MAC_ACTION)
 
-SOFT_LINK_CLASS_OPTIONAL(DataDetectors, DDActionContext)
-SOFT_LINK_CLASS_OPTIONAL(DataDetectors, DDActionsManager)
+#endif // PLATFORM(MAC)
 
-#if HAVE(DATA_DETECTORS_MAC_ACTION)
-SOFT_LINK_CLASS_OPTIONAL(DataDetectors, DDMacAction)
-#else
-SOFT_LINK_CLASS_OPTIONAL(DataDetectors, DDAction)
-#endif
+#endif // ENABLE(DATA_DETECTION)
 
-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))
-#else
-SOFT_LINK(DataDetectors, DDHighlightCreateWithRectsInVisibleRectWithStyleAndDirection, DDHighlightRef, (CFAllocatorRef allocator, CGRect* rects, CFIndex count, CGRect globalVisibleRect, DDHighlightStyle style, Boolean withArrow, NSWritingDirection writingDirection, Boolean endsWithEOL, Boolean flipped), (allocator, rects, count, globalVisibleRect, style, withArrow, writingDirection, endsWithEOL, flipped))
-#endif
-SOFT_LINK(DataDetectors, DDHighlightGetLayerWithContext, CGLayerRef, (DDHighlightRef highlight, CGContextRef context), (highlight, context))
-SOFT_LINK(DataDetectors, DDHighlightGetBoundingRect, CGRect, (DDHighlightRef highlight), (highlight))
-SOFT_LINK(DataDetectors, DDHighlightPointIsOnHighlight, Boolean, (DDHighlightRef highlight, CGPoint point, Boolean* onButton), (highlight, point, onButton))
-
-#endif
-
-#endif
-

Modified: trunk/Source/WebCore/editing/cocoa/DataDetection.mm (278529 => 278530)


--- trunk/Source/WebCore/editing/cocoa/DataDetection.mm	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.mm	2021-06-06 01:18:09 UTC (rev 278530)
@@ -53,12 +53,12 @@
 #import "TextIterator.h"
 #import "VisiblePosition.h"
 #import "VisibleUnits.h"
-#import <pal/cocoa/DataDetectorsCoreSoftLink.h>
 #import <pal/spi/ios/DataDetectorsUISPI.h>
-#import <pal/spi/mac/DataDetectorsSPI.h>
 #import <wtf/cf/TypeCastsCF.h>
 #import <wtf/text/StringBuilder.h>
 #import <wtf/text/StringToIntegerConversion.h>
+#import <pal/cocoa/DataDetectorsCoreSoftLink.h>
+#import <pal/mac/DataDetectorsSoftLink.h>
 
 #if PLATFORM(MAC)
 template<> struct WTF::CFTypeTrait<DDResultRef> {
@@ -108,7 +108,7 @@
     if (!view)
         return { };
 
-    auto actionContext = adoptNS([allocDDActionContextInstance() init]);
+    auto actionContext = adoptNS([PAL::allocDDActionContextInstance() init]);
     [actionContext setAllResults:@[ (__bridge id)mainResult ]];
     [actionContext setMainResult:mainResult];
 
@@ -121,7 +121,7 @@
 
 std::optional<DetectedItem> DataDetection::detectItemAroundHitTestResult(const HitTestResult& hitTestResult)
 {
-    if (!DataDetectorsLibrary())
+    if (!PAL::isDataDetectorsFrameworkAvailable())
         return { };
 
     Node* node = hitTestResult.innerNonSharedNode();

Modified: trunk/Source/WebCore/page/mac/ImageOverlayControllerMac.mm (278529 => 278530)


--- trunk/Source/WebCore/page/mac/ImageOverlayControllerMac.mm	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebCore/page/mac/ImageOverlayControllerMac.mm	2021-06-06 01:18:09 UTC (rev 278530)
@@ -41,9 +41,9 @@
 #import "SimpleRange.h"
 #import "TypedElementDescendantIterator.h"
 #import <QuartzCore/QuartzCore.h>
-#import <pal/spi/mac/DataDetectorsSPI.h>
 #import <wtf/HashSet.h>
 #import <wtf/text/StringToIntegerConversion.h>
+#import <pal/mac/DataDetectorsSoftLink.h>
 
 namespace WebCore {
 
@@ -88,9 +88,9 @@
 
         // FIXME: We should teach DataDetectorHighlight to render quads instead of always falling back to axis-aligned bounding rects.
 #if HAVE(DD_HIGHLIGHT_CREATE_WITH_SCALE)
-        auto highlight = adoptCF(DDHighlightCreateWithRectsInVisibleRectWithStyleScaleAndDirection(nullptr, &elementBounds, 1, mainFrameView->visibleContentRect(), DDHighlightStyleBubbleStandard | DDHighlightStyleStandardIconArrow, YES, NSWritingDirectionNatural, NO, YES, 0));
+        auto highlight = adoptCF(PAL::softLink_DataDetectors_DDHighlightCreateWithRectsInVisibleRectWithStyleScaleAndDirection(nullptr, &elementBounds, 1, mainFrameView->visibleContentRect(), DDHighlightStyleBubbleStandard | DDHighlightStyleStandardIconArrow, YES, NSWritingDirectionNatural, NO, YES, 0));
 #else
-        auto highlight = adoptCF(DDHighlightCreateWithRectsInVisibleRectWithStyleAndDirection(nullptr, &elementBounds, 1, mainFrameView->visibleContentRect(), DDHighlightStyleBubbleStandard | DDHighlightStyleStandardIconArrow, YES, NSWritingDirectionNatural, NO, YES));
+        auto highlight = adoptCF(PAL::softLink_DataDetectors_DDHighlightCreateWithRectsInVisibleRectWithStyleAndDirection(nullptr, &elementBounds, 1, mainFrameView->visibleContentRect(), DDHighlightStyleBubbleStandard | DDHighlightStyleStandardIconArrow, YES, NSWritingDirectionNatural, NO, YES));
 #endif
         m_dataDetectorContainersAndHighlights.append({ makeWeakPtr(element.get()), DataDetectorHighlight::createForImageOverlay(*m_page, *this, WTFMove(highlight), *makeRangeSelectingNode(element.get())) });
     }
@@ -112,7 +112,7 @@
             continue;
 
         Boolean isOverButton = NO;
-        if (!DDHighlightPointIsOnHighlight(highlight->highlight(), mousePositionInContents, &isOverButton))
+        if (!PAL::softLink_DataDetectors_DDHighlightPointIsOnHighlight(highlight->highlight(), mousePositionInContents, &isOverButton))
             continue;
 
         mouseIsOverActiveDataDetectorHighlightButton = isOverButton;

Modified: trunk/Source/WebCore/page/mac/ServicesOverlayController.mm (278529 => 278530)


--- trunk/Source/WebCore/page/mac/ServicesOverlayController.mm	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebCore/page/mac/ServicesOverlayController.mm	2021-06-06 01:18:09 UTC (rev 278530)
@@ -47,8 +47,7 @@
 #import "PageOverlayController.h"
 #import "Settings.h"
 #import <QuartzCore/QuartzCore.h>
-#import <pal/spi/mac/DataDetectorsSPI.h>
-#import <wtf/SoftLinking.h>
+#import <pal/mac/DataDetectorsSoftLink.h>
 
 namespace WebCore {
 
@@ -268,11 +267,11 @@
 
 bool ServicesOverlayController::mouseIsOverHighlight(DataDetectorHighlight& highlight, bool& mouseIsOverButton) const
 {
-    if (!DataDetectorsLibrary())
+    if (!PAL::isDataDetectorsFrameworkAvailable())
         return false;
 
     Boolean onButton;
-    bool hovered = DDHighlightPointIsOnHighlight(highlight.highlight(), (CGPoint)m_mousePosition, &onButton);
+    bool hovered = PAL::softLink_DataDetectors_DDHighlightPointIsOnHighlight(highlight.highlight(), (CGPoint)m_mousePosition, &onButton);
     mouseIsOverButton = onButton;
     return hovered;
 }
@@ -345,7 +344,7 @@
         return;
     }
 
-    if (!DataDetectorsLibrary())
+    if (!PAL::isDataDetectorsFrameworkAvailable())
         return;
 
     HashSet<RefPtr<DataDetectorHighlight>> newPotentialHighlights;
@@ -368,9 +367,9 @@
 
         CGRect cgRect = rect;
 #if HAVE(DD_HIGHLIGHT_CREATE_WITH_SCALE)
-        auto ddHighlight = adoptCF(DDHighlightCreateWithRectsInVisibleRectWithStyleScaleAndDirection(nullptr, &cgRect, 1, mainFrameView.visibleContentRect(), DDHighlightStyleBubbleStandard | DDHighlightStyleStandardIconArrow, YES, NSWritingDirectionNatural, NO, YES, 0));
+        auto ddHighlight = adoptCF(PAL::softLink_DataDetectors_DDHighlightCreateWithRectsInVisibleRectWithStyleScaleAndDirection(nullptr, &cgRect, 1, mainFrameView.visibleContentRect(), DDHighlightStyleBubbleStandard | DDHighlightStyleStandardIconArrow, YES, NSWritingDirectionNatural, NO, YES, 0));
 #else
-        auto ddHighlight = adoptCF(DDHighlightCreateWithRectsInVisibleRectWithStyleAndDirection(nullptr, &cgRect, 1, mainFrameView.visibleContentRect(), DDHighlightStyleBubbleStandard | DDHighlightStyleStandardIconArrow, YES, NSWritingDirectionNatural, NO, YES));
+        auto ddHighlight = adoptCF(PAL::softLink_DataDetectors_DDHighlightCreateWithRectsInVisibleRectWithStyleAndDirection(nullptr, &cgRect, 1, mainFrameView.visibleContentRect(), DDHighlightStyleBubbleStandard | DDHighlightStyleStandardIconArrow, YES, NSWritingDirectionNatural, NO, YES));
 #endif
         auto highlight = DataDetectorHighlight::createForTelephoneNumber(m_page, *this, WTFMove(ddHighlight), WTFMove(range));
         m_highlights.add(highlight.get());
@@ -387,7 +386,7 @@
         return;
     }
 
-    if (!DataDetectorsLibrary())
+    if (!PAL::isDataDetectorsFrameworkAvailable())
         return;
 
     HashSet<RefPtr<DataDetectorHighlight>> newPotentialHighlights;
@@ -413,9 +412,9 @@
         if (!cgRects.isEmpty()) {
             CGRect visibleRect = mainFrameView->visibleContentRect();
 #if HAVE(DD_HIGHLIGHT_CREATE_WITH_SCALE)
-            auto ddHighlight = adoptCF(DDHighlightCreateWithRectsInVisibleRectWithStyleScaleAndDirection(nullptr, cgRects.begin(), cgRects.size(), visibleRect, DDHighlightStyleBubbleNone | DDHighlightStyleStandardIconArrow | DDHighlightStyleButtonShowAlways, YES, NSWritingDirectionNatural, NO, YES, 0));
+            auto ddHighlight = adoptCF(PAL::softLink_DataDetectors_DDHighlightCreateWithRectsInVisibleRectWithStyleScaleAndDirection(nullptr, cgRects.begin(), cgRects.size(), visibleRect, DDHighlightStyleBubbleNone | DDHighlightStyleStandardIconArrow | DDHighlightStyleButtonShowAlways, YES, NSWritingDirectionNatural, NO, YES, 0));
 #else
-            auto ddHighlight = adoptCF(DDHighlightCreateWithRectsInVisibleRectWithStyleAndDirection(nullptr, cgRects.begin(), cgRects.size(), visibleRect, DDHighlightStyleBubbleNone | DDHighlightStyleStandardIconArrow | DDHighlightStyleButtonShowAlways, YES, NSWritingDirectionNatural, NO, YES));
+            auto ddHighlight = adoptCF(PAL::softLink_DataDetectors_DDHighlightCreateWithRectsInVisibleRectWithStyleAndDirection(nullptr, cgRects.begin(), cgRects.size(), visibleRect, DDHighlightStyleBubbleNone | DDHighlightStyleStandardIconArrow | DDHighlightStyleButtonShowAlways, YES, NSWritingDirectionNatural, NO, YES));
 #endif
             auto highlight = DataDetectorHighlight::createForSelection(m_page, *this, WTFMove(ddHighlight), WTFMove(*selectionRange));
             m_highlights.add(highlight.get());

Modified: trunk/Source/WebCore/platform/mac/DataDetectorHighlight.mm (278529 => 278530)


--- trunk/Source/WebCore/platform/mac/DataDetectorHighlight.mm	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebCore/platform/mac/DataDetectorHighlight.mm	2021-06-06 01:18:09 UTC (rev 278530)
@@ -39,9 +39,8 @@
 #import "PlatformCAAnimationCocoa.h"
 #import "PlatformCALayer.h"
 #import <QuartzCore/QuartzCore.h>
-#import <pal/spi/mac/DataDetectorsSPI.h>
 #import <wtf/Seconds.h>
-#import <wtf/SoftLinking.h>
+#import <pal/mac/DataDetectorsSoftLink.h>
 
 namespace WebCore {
 
@@ -82,7 +81,7 @@
 
 void DataDetectorHighlight::setHighlight(DDHighlightRef highlight)
 {
-    if (!DataDetectorsLibrary())
+    if (!PAL::isDataDetectorsFrameworkAvailable())
         return;
 
     if (!m_client)
@@ -93,7 +92,7 @@
     if (!m_highlight)
         return;
 
-    CGRect highlightBoundingRect = DDHighlightGetBoundingRect(m_highlight.get());
+    CGRect highlightBoundingRect = PAL::softLink_DataDetectors_DDHighlightGetBoundingRect(m_highlight.get());
     m_graphicsLayer->setPosition(FloatPoint(highlightBoundingRect.origin));
     m_graphicsLayer->setSize(FloatSize(highlightBoundingRect.size));
 
@@ -117,7 +116,7 @@
 
 void DataDetectorHighlight::paintContents(const GraphicsLayer*, GraphicsContext& graphicsContext, const FloatRect&, GraphicsLayerPaintBehavior)
 {
-    if (!DataDetectorsLibrary())
+    if (!PAL::isDataDetectorsFrameworkAvailable())
         return;
 
     // FIXME: This needs to be moved into GraphicsContext as a DisplayList-compatible drawing command.
@@ -129,9 +128,9 @@
     CGContextRef cgContext = graphicsContext.platformContext();
 
     ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-    CGLayerRef highlightLayer = DDHighlightGetLayerWithContext(highlight(), cgContext);
+    CGLayerRef highlightLayer = PAL::softLink_DataDetectors_DDHighlightGetLayerWithContext(highlight(), cgContext);
     ALLOW_DEPRECATED_DECLARATIONS_END
-    CGRect highlightBoundingRect = DDHighlightGetBoundingRect(highlight());
+    CGRect highlightBoundingRect = PAL::softLink_DataDetectors_DDHighlightGetBoundingRect(highlight());
     highlightBoundingRect.origin = CGPointZero;
 
     CGContextDrawLayerInRect(cgContext, highlightBoundingRect, highlightLayer);

Modified: trunk/Source/WebKit/ChangeLog (278529 => 278530)


--- trunk/Source/WebKit/ChangeLog	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebKit/ChangeLog	2021-06-06 01:18:09 UTC (rev 278530)
@@ -1,3 +1,30 @@
+2021-06-05  Wenson Hsieh  <[email protected]>
+
+        [macOS] Move DataDetectors softlinking in DataDetectorsSPI.h out into a separate PAL header
+        https://bugs.webkit.org/show_bug.cgi?id=226669
+
+        Reviewed by Sam Weinig.
+
+        Adopt the new PAL softlinking header in a few places. See WebCore/ChangeLog for more details. Additionally, move
+        several softlinking header imports so that they're the last imported headers in a few sources.
+
+        * Platform/mac/MenuUtilities.mm:
+        (WebKit::actionForMenuItem):
+        (WebKit::menuItemForTelephoneNumber):
+        * Shared/Cocoa/DataDetectionResult.mm:
+        (WebKit::DataDetectionResult::decode):
+        * Shared/ios/InteractionInformationAtPosition.mm:
+        (WebKit::InteractionInformationAtPosition::decode):
+        * Shared/mac/WebHitTestResultData.mm:
+        (WebKit::WebHitTestResultData::platformDecode):
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::dismissContentRelativeChildWindowsFromViewOnly):
+        * UIProcess/mac/WKImmediateActionController.mm:
+        (-[WKImmediateActionController _clearImmediateActionState]):
+        (-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
+        (-[WKImmediateActionController _animationControllerForDataDetectedText]):
+        (-[WKImmediateActionController _animationControllerForDataDetectedLink]):
+
 2021-06-04  Chris Dumez  <[email protected]>
 
         Optimize a few call sites creating SharedBuffer objects

Modified: trunk/Source/WebKit/Platform/mac/MenuUtilities.mm (278529 => 278530)


--- trunk/Source/WebKit/Platform/mac/MenuUtilities.mm	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebKit/Platform/mac/MenuUtilities.mm	2021-06-06 01:18:09 UTC (rev 278530)
@@ -31,7 +31,6 @@
 
 #import "StringUtilities.h"
 #import <WebCore/LocalizedStrings.h>
-#import <pal/spi/mac/DataDetectorsSPI.h>
 
 #if ENABLE(TELEPHONE_NUMBER_DETECTION)
 #import <pal/spi/mac/TelephonyUtilitiesSPI.h>
@@ -41,6 +40,9 @@
 SOFT_LINK_CLASS(TelephonyUtilities, TUCall)
 #endif
 
+#import <pal/cocoa/DataDetectorsCoreSoftLink.h>
+#import <pal/mac/DataDetectorsSoftLink.h>
+
 @interface WKEmptyPresenterHighlightDelegate : NSObject <RVPresenterHighlightDelegate>
 @end
 
@@ -75,10 +77,10 @@
     id action = "" objectForKey:@"DDAction"];
 
 #if HAVE(DATA_DETECTORS_MAC_ACTION)
-    if (![action isKindOfClass:getDDMacActionClass()])
+    if (![action isKindOfClass:PAL::getDDMacActionClass()])
         return nil;
 #else
-    if (![action isKindOfClass:getDDActionClass()])
+    if (![action isKindOfClass:PAL::getDDActionClass()])
         return nil;
 #endif
 
@@ -87,13 +89,13 @@
 
 NSMenuItem *menuItemForTelephoneNumber(const String& telephoneNumber)
 {
-    if (!DataDetectorsLibrary())
+    if (!PAL::isDataDetectorsFrameworkAvailable())
         return nil;
 
-    RetainPtr<DDActionContext> actionContext = adoptNS([allocDDActionContextInstance() init]);
+    auto actionContext = adoptNS([PAL::allocDDActionContextInstance() init]);
     [actionContext setAllowedActionUTIs:@[ @"com.apple.dial" ]];
 
-    NSArray *proposedMenuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForValue:(NSString *)telephoneNumber type:getDDBinderPhoneNumberKey() service:nil context:actionContext.get()];
+    NSArray *proposedMenuItems = [[PAL::getDDActionsManagerClass() sharedManager] menuItemsForValue:(NSString *)telephoneNumber type:PAL::get_DataDetectorsCore_DDBinderPhoneNumberKey() service:nil context:actionContext.get()];
     for (NSMenuItem *item in proposedMenuItems) {
         auto action = ""
         if ([action.actionUTI hasPrefix:@"com.apple.dial"]) {

Modified: trunk/Source/WebKit/Shared/Cocoa/DataDetectionResult.mm (278529 => 278530)


--- trunk/Source/WebKit/Shared/Cocoa/DataDetectionResult.mm	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebKit/Shared/Cocoa/DataDetectionResult.mm	2021-06-06 01:18:09 UTC (rev 278530)
@@ -28,12 +28,8 @@
 
 #import "ArgumentCodersCocoa.h"
 #import "WebCoreArgumentCoders.h"
-#import <pal/spi/cocoa/DataDetectorsCoreSPI.h>
-#import <wtf/SoftLinking.h>
+#import <pal/cocoa/DataDetectorsCoreSoftLink.h>
 
-SOFT_LINK_PRIVATE_FRAMEWORK(DataDetectorsCore)
-SOFT_LINK_CLASS(DataDetectorsCore, DDScannerResult)
-
 namespace WebKit {
 
 #if ENABLE(DATA_DETECTION)
@@ -45,7 +41,7 @@
 
 std::optional<DataDetectionResult> DataDetectionResult::decode(IPC::Decoder& decoder)
 {
-    auto results = IPC::decode<NSArray>(decoder, @[ [NSArray class], getDDScannerResultClass() ]);
+    auto results = IPC::decode<NSArray>(decoder, @[ NSArray.class, PAL::getDDScannerResultClass() ]);
     if (!results)
         return std::nullopt;
 

Modified: trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm (278529 => 278530)


--- trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm	2021-06-06 01:18:09 UTC (rev 278530)
@@ -28,12 +28,8 @@
 
 #import "ArgumentCodersCocoa.h"
 #import "WebCoreArgumentCoders.h"
-#import <pal/spi/cocoa/DataDetectorsCoreSPI.h>
-#import <wtf/SoftLinking.h>
+#import <pal/cocoa/DataDetectorsCoreSoftLink.h>
 
-SOFT_LINK_PRIVATE_FRAMEWORK(DataDetectorsCore)
-SOFT_LINK_CLASS(DataDetectorsCore, DDScannerResult)
-
 namespace WebKit {
 
 #if PLATFORM(IOS_FAMILY)
@@ -192,7 +188,7 @@
     if (!decoder.decode(result.dataDetectorIdentifier))
         return false;
 
-    auto dataDetectorResults = IPC::decode<NSArray>(decoder, @[ NSArray.class, getDDScannerResultClass() ]);
+    auto dataDetectorResults = IPC::decode<NSArray>(decoder, @[ NSArray.class, PAL::getDDScannerResultClass() ]);
     if (!dataDetectorResults)
         return false;
 

Modified: trunk/Source/WebKit/Shared/mac/WebHitTestResultData.mm (278529 => 278530)


--- trunk/Source/WebKit/Shared/mac/WebHitTestResultData.mm	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebKit/Shared/mac/WebHitTestResultData.mm	2021-06-06 01:18:09 UTC (rev 278530)
@@ -34,7 +34,7 @@
 #import "Encoder.h"
 #import "WebCoreArgumentCoders.h"
 #import <WebCore/TextIndicator.h>
-#import <pal/spi/mac/DataDetectorsSPI.h>
+#import <pal/mac/DataDetectorsSoftLink.h>
 
 namespace WebKit {
 
@@ -64,9 +64,9 @@
 
     if (!hasActionContext)
         return true;
-    ASSERT(DataDetectorsLibrary());
+    ASSERT(PAL::isDataDetectorsFrameworkAvailable());
 
-    auto detectedDataActionContext = IPC::decode<DDActionContext>(decoder, getDDActionContextClass());
+    auto detectedDataActionContext = IPC::decode<DDActionContext>(decoder, PAL::getDDActionContextClass());
     if (!detectedDataActionContext)
         return false;
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (278529 => 278530)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2021-06-06 01:18:09 UTC (rev 278530)
@@ -120,7 +120,6 @@
 #import <pal/spi/cocoa/AVKitSPI.h>
 #import <pal/spi/cocoa/NSAccessibilitySPI.h>
 #import <pal/spi/cocoa/NSTouchBarSPI.h>
-#import <pal/spi/mac/DataDetectorsSPI.h>
 #import <pal/spi/mac/LookupSPI.h>
 #import <pal/spi/mac/NSAppearanceSPI.h>
 #import <pal/spi/mac/NSApplicationSPI.h>
@@ -158,6 +157,7 @@
 #endif
 
 #import <pal/cocoa/RevealSoftLink.h>
+#import <pal/mac/DataDetectorsSoftLink.h>
 
 #if HAVE(TOUCH_BAR) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
 SOFT_LINK_FRAMEWORK(AVKit)
@@ -3623,8 +3623,8 @@
     if ([m_view window].isKeyWindow || hasActiveImmediateAction) {
         WebCore::DictionaryLookup::hidePopup();
 
-        if (DataDetectorsLibrary())
-            [[getDDActionsManagerClass() sharedManager] requestBubbleClosureUnanchorOnFailure:YES];
+        if (PAL::isDataDetectorsFrameworkAvailable())
+            [[PAL::getDDActionsManagerClass() sharedManager] requestBubbleClosureUnanchorOnFailure:YES];
     }
 
     clearTextIndicatorWithAnimation(WebCore::TextIndicatorDismissalAnimation::FadeOut);

Modified: trunk/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm (278529 => 278530)


--- trunk/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebKit/UIProcess/mac/WKImmediateActionController.mm	2021-06-06 01:18:09 UTC (rev 278530)
@@ -38,12 +38,12 @@
 #import <WebCore/DictionaryLookup.h>
 #import <WebCore/GeometryUtilities.h>
 #import <WebCore/TextIndicatorWindow.h>
-#import <pal/mac/QuickLookUISoftLink.h>
-#import <pal/spi/mac/DataDetectorsSPI.h>
 #import <pal/spi/mac/LookupSPI.h>
 #import <pal/spi/mac/NSMenuSPI.h>
 #import <pal/spi/mac/NSPopoverSPI.h>
 #import <wtf/URL.h>
+#import <pal/mac/DataDetectorsSoftLink.h>
+#import <pal/mac/QuickLookUISoftLink.h>
 
 @interface WKImmediateActionController () <QLPreviewMenuItemDelegate>
 @end
@@ -114,8 +114,8 @@
 
     if (_currentActionContext && _hasActivatedActionContext) {
         _hasActivatedActionContext = NO;
-        if (DataDetectorsLibrary())
-            [getDDActionsManagerClass() didUseActions];
+        if (PAL::isDataDetectorsFrameworkAvailable())
+            [PAL::getDDActionsManagerClass() didUseActions];
     }
 
     _state = WebKit::ImmediateActionState::None;
@@ -202,8 +202,8 @@
 
     if (_currentActionContext) {
         _hasActivatedActionContext = YES;
-        if (DataDetectorsLibrary()) {
-            if (![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()])
+        if (PAL::isDataDetectorsFrameworkAvailable()) {
+            if (![PAL::getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()])
                 [self _cancelImmediateAction];
         }
     }
@@ -401,7 +401,7 @@
 
 - (id<NSImmediateActionAnimationController>)_animationControllerForDataDetectedText
 {
-    if (!DataDetectorsLibrary())
+    if (!PAL::isDataDetectorsFrameworkAvailable())
         return nil;
 
     DDActionContext *actionContext = _hitTestResultData.detectedDataActionContext.get();
@@ -410,7 +410,7 @@
 
     actionContext.altMode = YES;
     actionContext.immediate = YES;
-    if (![[getDDActionsManagerClass() sharedManager] hasActionsForResult:actionContext.mainResult actionContext:actionContext])
+    if (![[PAL::getDDActionsManagerClass() sharedManager] hasActionsForResult:actionContext.mainResult actionContext:actionContext])
         return nil;
 
     RefPtr<WebKit::WebPageProxy> page = _page.get();
@@ -428,7 +428,7 @@
 
     [_currentActionContext setHighlightFrame:[_view.window convertRectToScreen:[_view convertRect:_hitTestResultData.detectedDataBoundingBox toView:nil]]];
 
-    NSArray *menuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForResult:[_currentActionContext mainResult] actionContext:_currentActionContext.get()];
+    NSArray *menuItems = [[PAL::getDDActionsManagerClass() sharedManager] menuItemsForResult:[_currentActionContext mainResult] actionContext:_currentActionContext.get()];
 
     if (menuItems.count != 1)
         return nil;
@@ -438,10 +438,10 @@
 
 - (id<NSImmediateActionAnimationController>)_animationControllerForDataDetectedLink
 {
-    if (!DataDetectorsLibrary())
+    if (!PAL::isDataDetectorsFrameworkAvailable())
         return nil;
 
-    RetainPtr<DDActionContext> actionContext = adoptNS([allocDDActionContextInstance() init]);
+    auto actionContext = adoptNS([PAL::allocDDActionContextInstance() init]);
 
     if (!actionContext)
         return nil;
@@ -464,7 +464,7 @@
     if (!hitTestResult)
         return nil;
 
-    NSArray *menuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForTargetURL:hitTestResult->absoluteLinkURL() actionContext:_currentActionContext.get()];
+    NSArray *menuItems = [[PAL::getDDActionsManagerClass() sharedManager] menuItemsForTargetURL:hitTestResult->absoluteLinkURL() actionContext:_currentActionContext.get()];
 
     if (menuItems.count != 1)
         return nil;

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (278529 => 278530)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2021-06-06 01:18:09 UTC (rev 278530)
@@ -1,3 +1,18 @@
+2021-06-05  Wenson Hsieh  <[email protected]>
+
+        [macOS] Move DataDetectors softlinking in DataDetectorsSPI.h out into a separate PAL header
+        https://bugs.webkit.org/show_bug.cgi?id=226669
+
+        Reviewed by Sam Weinig.
+
+        Adopt the new PAL softlinking header in a few places. See WebCore/ChangeLog for more details.
+
+        * WebView/WebImmediateActionController.mm:
+        (-[WebImmediateActionController _clearImmediateActionState]):
+        (-[WebImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
+        (-[WebImmediateActionController _animationControllerForDataDetectedText]):
+        (-[WebImmediateActionController _animationControllerForDataDetectedLink]):
+
 2021-06-04  Chris Dumez  <[email protected]>
 
         Use Vector<uint8_t> instead of Vector<char> to store bytes in SharedBuffer

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm (278529 => 278530)


--- trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm	2021-06-06 00:30:55 UTC (rev 278529)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm	2021-06-06 01:18:09 UTC (rev 278530)
@@ -56,10 +56,10 @@
 #import <WebCore/TextIterator.h>
 #import <objc/objc-class.h>
 #import <objc/objc.h>
-#import <pal/mac/QuickLookUISoftLink.h>
-#import <pal/spi/mac/DataDetectorsSPI.h>
 #import <pal/spi/mac/LookupSPI.h>
 #import <pal/spi/mac/NSMenuSPI.h>
+#import <pal/mac/DataDetectorsSoftLink.h>
+#import <pal/mac/QuickLookUISoftLink.h>
 
 @interface WebImmediateActionController () <QLPreviewMenuItemDelegate>
 @end
@@ -140,15 +140,15 @@
 
 - (void)_clearImmediateActionState
 {
-    if (!DataDetectorsLibrary())
+    if (!PAL::isDataDetectorsFrameworkAvailable())
         return;
 
-    DDActionsManager *actionsManager = [getDDActionsManagerClass() sharedManager];
+    DDActionsManager *actionsManager = [PAL::getDDActionsManagerClass() sharedManager];
     [actionsManager requestBubbleClosureUnanchorOnFailure:YES];
 
     if (_currentActionContext && _hasActivatedActionContext) {
         _hasActivatedActionContext = NO;
-        [getDDActionsManagerClass() didUseActions];
+        [PAL::getDDActionsManagerClass() didUseActions];
     }
 
     _type = WebImmediateActionNone;
@@ -205,7 +205,7 @@
 
 - (void)immediateActionRecognizerWillBeginAnimation:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
 {
-    if (!DataDetectorsLibrary())
+    if (!PAL::isDataDetectorsFrameworkAvailable())
         return;
 
     if (immediateActionRecognizer != _immediateActionRecognizer)
@@ -213,7 +213,7 @@
 
     if (_currentActionContext) {
         _hasActivatedActionContext = YES;
-        if (![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()])
+        if (![PAL::getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()])
             [self _cancelImmediateAction];
     }
 }
@@ -424,7 +424,7 @@
 
 - (id <NSImmediateActionAnimationController>)_animationControllerForDataDetectedText
 {
-    if (!DataDetectorsLibrary())
+    if (!PAL::isDataDetectorsFrameworkAvailable())
         return nil;
 
     std::optional<WebCore::DetectedItem> detectedItem;
@@ -452,7 +452,7 @@
 
     [detectedItem->actionContext setAltMode:YES];
     [detectedItem->actionContext setImmediate:YES];
-    if (![[getDDActionsManagerClass() sharedManager] hasActionsForResult:[detectedItem->actionContext mainResult] actionContext:detectedItem->actionContext.get()])
+    if (![[PAL::getDDActionsManagerClass() sharedManager] hasActionsForResult:[detectedItem->actionContext mainResult] actionContext:detectedItem->actionContext.get()])
         return nil;
 
     auto indicator = WebCore::TextIndicator::createWithRange(detectedItem->range, { }, WebCore::TextIndicatorPresentationTransition::FadeIn);
@@ -467,7 +467,7 @@
 
     [_currentActionContext setHighlightFrame:[_webView.window convertRectToScreen:detectedItem->boundingBox]];
 
-    NSArray *menuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForResult:[_currentActionContext mainResult] actionContext:_currentActionContext.get()];
+    NSArray *menuItems = [[PAL::getDDActionsManagerClass() sharedManager] menuItemsForResult:[_currentActionContext mainResult] actionContext:_currentActionContext.get()];
     if (menuItems.count != 1)
         return nil;
 
@@ -476,10 +476,10 @@
 
 - (id <NSImmediateActionAnimationController>)_animationControllerForDataDetectedLink
 {
-    if (!DataDetectorsLibrary())
+    if (!PAL::isDataDetectorsFrameworkAvailable())
         return nil;
 
-    RetainPtr<DDActionContext> actionContext = adoptNS([allocDDActionContextInstance() init]);
+    auto actionContext = adoptNS([PAL::allocDDActionContextInstance() init]);
 
     if (!actionContext)
         return nil;
@@ -500,7 +500,7 @@
 
     [_currentActionContext setHighlightFrame:[_webView.window convertRectToScreen:elementBoundingBoxInWindowCoordinatesFromNode(_hitTestResult.URLElement())]];
 
-    NSArray *menuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForTargetURL:_hitTestResult.absoluteLinkURL().string() actionContext:_currentActionContext.get()];
+    NSArray *menuItems = [[PAL::getDDActionsManagerClass() sharedManager] menuItemsForTargetURL:_hitTestResult.absoluteLinkURL().string() actionContext:_currentActionContext.get()];
     if (menuItems.count != 1)
         return nil;
     
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to