Diff
Modified: trunk/Source/WebCore/ChangeLog (277478 => 277479)
--- trunk/Source/WebCore/ChangeLog 2021-05-14 03:30:39 UTC (rev 277478)
+++ trunk/Source/WebCore/ChangeLog 2021-05-14 04:06:37 UTC (rev 277479)
@@ -1,3 +1,40 @@
+2021-05-13 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [Cocoa] Plumb data detector results through some platform objects
+ https://bugs.webkit.org/show_bug.cgi?id=225775
+ Work towards rdar://75504956
+
+ Reviewed by Tim Horton and Devin Rousso.
+
+ Introduce a new struct to hold data detection results, and add it to the existing results object when
+ `ENABLE(DATA_DETECTION)` is defined.
+
+ No change in behavior.
+
+ * SourcesCocoa.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * editing/cocoa/DataDetection.mm:
+ (WebCore::DataDetection::canBePresentedByDataDetectors):
+ (WebCore::DataDetection::canPresentDataDetectorsUIForElement):
+ (WebCore::resultIsURL):
+ (WebCore::constructURLStringForResult):
+ (WebCore::buildQuery):
+ (WebCore::DataDetection::detectContentInRange):
+
+ Add a `PAL` namespace to each of these DataDetectorsCore softlinking call sites, since the soft link header now
+ exists in PAL.
+
+ * platform/ImageExtractionResult.h:
+ (WebCore::ImageExtractionDataDetectorInfo::ImageExtractionDataDetectorInfo):
+ (WebCore::ImageExtractionResult::isEmpty const):
+ (WebCore::ImageExtractionResult::encode const):
+ (WebCore::ImageExtractionResult::decode):
+ * platform/cocoa/DataDetectorsCoreSoftLink.h: Removed.
+ * platform/cocoa/DataDetectorsCoreSoftLink.mm: Removed.
+
+ Additionally, move `DataDetectorsCoreSoftLink.{h|mm}` out of `WebCore/platform` and into PAL as softlinking
+ headers, so that they can be imported in WebKit as well as WebCore.
+
2021-05-13 Devin Rousso <drou...@apple.com>
[iOS] REGRESSION(r271216) pointerevents/ios/pointer-events-no-mousedown-when-prevent-default-called-on-pointerdown.html is consistently failing
Modified: trunk/Source/WebCore/PAL/ChangeLog (277478 => 277479)
--- trunk/Source/WebCore/PAL/ChangeLog 2021-05-14 03:30:39 UTC (rev 277478)
+++ trunk/Source/WebCore/PAL/ChangeLog 2021-05-14 04:06:37 UTC (rev 277479)
@@ -1,3 +1,25 @@
+2021-05-13 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [Cocoa] Plumb data detector results through some platform objects
+ https://bugs.webkit.org/show_bug.cgi?id=225775
+ Work towards rdar://75504956
+
+ Reviewed by Tim Horton and Devin Rousso.
+
+ Move `DataDetectorsCoreSoftLink.{h|mm}` into PAL, so that it can be used in WebKit as well.
+
+ * PAL.xcodeproj/project.pbxproj:
+ * pal/PlatformMac.cmake:
+
+ Add the header and source file to the CMake build.
+
+ * pal/cocoa/DataDetectorsCoreSoftLink.h: Added.
+ * pal/cocoa/DataDetectorsCoreSoftLink.mm: Added.
+ * pal/spi/cocoa/DataDetectorsCoreSPI.h:
+
+ Explicitly import Foundation headers here, so that the forward declarations don't cause compilation failures in
+ non-internal SDKs.
+
2021-05-13 Tim Horton <timothy_hor...@apple.com>
Work around WebCore failing to build due to NDEBUG getting undefined in release
Modified: trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj (277478 => 277479)
--- trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj 2021-05-14 03:30:39 UTC (rev 277478)
+++ trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj 2021-05-14 04:06:37 UTC (rev 277479)
@@ -207,6 +207,8 @@
F44291601FA5261E002CC93E /* FileSizeFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = F442915F1FA5261E002CC93E /* FileSizeFormatter.h */; };
F44291641FA52670002CC93E /* FileSizeFormatter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F44291621FA52670002CC93E /* FileSizeFormatter.cpp */; };
F44291681FA52705002CC93E /* FileSizeFormatterCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44291661FA52705002CC93E /* FileSizeFormatterCocoa.mm */; };
+ F4DDD01B264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4DDD019264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.mm */; };
+ F4DDD01C264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = F4DDD01A264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.h */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -420,6 +422,8 @@
F442915F1FA5261E002CC93E /* FileSizeFormatter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FileSizeFormatter.h; sourceTree = "<group>"; };
F44291621FA52670002CC93E /* FileSizeFormatter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FileSizeFormatter.cpp; sourceTree = "<group>"; };
F44291661FA52705002CC93E /* FileSizeFormatterCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FileSizeFormatterCocoa.mm; 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>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -707,6 +711,8 @@
077E87AF226A460200A2AFF0 /* AVFoundationSoftLink.mm */,
57F1C90725DCF0CF00E8F6EA /* CryptoKitCBridgingSoftLink.h */,
57F1C90825DCF0CF00E8F6EA /* CryptoKitCBridgingSoftLink.mm */,
+ F4DDD01A264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.h */,
+ F4DDD019264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.mm */,
F44291661FA52705002CC93E /* FileSizeFormatterCocoa.mm */,
1C022EFC22CFE8E0006DF01B /* Gunzip.cpp */,
CDACB35E23873E480018D7CE /* MediaToolboxSoftLink.cpp */,
@@ -847,6 +853,7 @@
1C09D0531E31C44100725F18 /* CryptoDigest.h in Headers */,
57F1C90925DCF0CF00E8F6EA /* CryptoKitCBridgingSoftLink.h in Headers */,
DF83E209263734F1000825EF /* CryptoKitCBridgingSPI.h in Headers */,
+ F4DDD01C264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.h in Headers */,
0C2DA1411F3BEB4900DBC317 /* DataDetectorsCoreSPI.h in Headers */,
0C77858A1F45130F00F4EBB6 /* DataDetectorsSPI.h in Headers */,
0C5AF91A1F43A4C7002EAC02 /* DataDetectorsUISPI.h in Headers */,
@@ -1059,6 +1066,7 @@
1C77C8C925D7972000635E0C /* CoreTextSoftLink.cpp in Sources */,
1C09D0561E31C46500725F18 /* CryptoDigestCommonCrypto.cpp in Sources */,
57F1C90A25DCF0CF00E8F6EA /* CryptoKitCBridgingSoftLink.mm in Sources */,
+ F4DDD01B264DC69E00EF1B91 /* DataDetectorsCoreSoftLink.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 (277478 => 277479)
--- trunk/Source/WebCore/PAL/pal/PlatformMac.cmake 2021-05-14 03:30:39 UTC (rev 277478)
+++ trunk/Source/WebCore/PAL/pal/PlatformMac.cmake 2021-05-14 04:06:37 UTC (rev 277479)
@@ -12,6 +12,7 @@
cocoa/AppSSOSoftLink.h
cocoa/AVFoundationSoftLink.h
cocoa/CryptoKitCBridgingSoftLink.h
+ cocoa/DataDetectorsCoreSoftLink.h
cocoa/MediaToolboxSoftLink.h
cocoa/OpenGLSoftLinkCocoa.h
cocoa/PassKitSoftLink.h
@@ -148,6 +149,7 @@
cocoa/AppSSOSoftLink.mm
cocoa/AVFoundationSoftLink.mm
cocoa/CryptoKitCBridgingSoftLink.mm
+ cocoa/DataDetectorsCoreSoftLink.mm
cocoa/FileSizeFormatterCocoa.mm
cocoa/Gunzip.cpp
cocoa/MediaToolboxSoftLink.cpp
Added: trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.h (0 => 277479)
--- trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.h (rev 0)
+++ trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.h 2021-05-14 04:06:37 UTC (rev 277479)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2016-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 ENABLE(DATA_DETECTION)
+
+#include <pal/spi/cocoa/DataDetectorsCoreSPI.h>
+#include <wtf/SoftLinking.h>
+
+SOFT_LINK_CLASS_FOR_HEADER(PAL, DDScannerResult)
+
+#if 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))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDScannerCopyResultsWithOptions, CFArrayRef, (DDScannerRef scanner, DDScannerCopyResultsOptions options), (scanner, options))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDResultGetRange, CFRange, (DDResultRef result), (result))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDResultGetType, CFStringRef, (DDResultRef result), (result))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDResultGetCategory, DDResultCategory, (DDResultRef result), (result))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDResultIsPastDate, Boolean, (DDResultRef result, CFDateRef referenceDate, CFTimeZoneRef referenceTimeZone), (result, referenceDate, referenceTimeZone))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDScanQueryAddTextFragment, void, (DDScanQueryRef query, CFStringRef fragment, CFRange range, void *identifier, DDTextFragmentMode mode, DDTextCoalescingType type), (query, fragment, range, identifier, mode, type))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDScanQueryAddSeparator, void, (DDScanQueryRef query, DDTextCoalescingType type), (query, type))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDScanQueryAddLineBreak, void, (DDScanQueryRef query), (query))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDScanQueryGetFragmentMetaData, void *, (DDScanQueryRef query, CFIndex queryIndex), (query, queryIndex))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDResultHasProperties, bool, (DDResultRef result, CFIndex propertySet), (result, propertySet))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDResultGetSubResults, CFArrayRef, (DDResultRef result), (result))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDResultGetQueryRangeForURLification, DDQueryRange, (DDResultRef result), (result))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDURLStringForResult, NSString *, (DDResultRef currentResult, NSString * resultIdentifier, DDURLifierPhoneNumberDetectionTypes includingTelGroups, NSDate * referenceDate, NSTimeZone * referenceTimeZone), (currentResult, resultIdentifier, includingTelGroups, referenceDate, referenceTimeZone))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDURLTapAndHoldSchemes, NSArray *, (), ())
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForURL, BOOL, (NSURL *url), (url))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForResult, BOOL, (DDResultRef result), (result))
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDShouldUseLightLinksForResult, BOOL, (DDResultRef result, BOOL extractedFromSignature), (result, extractedFromSignature))
+SOFT_LINK_POINTER_FOR_HEADER(PAL, DataDetectorsCore, DDBinderParsecSourceKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_HEADER(PAL, DataDetectorsCore, DDBinderHttpURLKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_HEADER(PAL, DataDetectorsCore, DDBinderWebURLKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_HEADER(PAL, DataDetectorsCore, DDBinderMailURLKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_HEADER(PAL, DataDetectorsCore, DDBinderGenericURLKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_HEADER(PAL, DataDetectorsCore, DDBinderEmailKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_HEADER(PAL, DataDetectorsCore, DDBinderTrackingNumberKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_HEADER(PAL, DataDetectorsCore, DDBinderFlightInformationKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_HEADER(PAL, DataDetectorsCore, DDBinderSignatureBlockKey, CFStringRef)
+SOFT_LINK_CONSTANT_FOR_HEADER(PAL, DataDetectorsCore, DDScannerCopyResultsOptionsForPassiveUse, DDScannerCopyResultsOptions)
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, DataDetectorsCore, DDScannerEnableOptionalSource, void, (DDScannerRef scanner, DDScannerSource source, Boolean enable), (scanner, source, enable))
+#endif // PLATFORM(IOS_FAMILY)
+
+#endif // ENABLE(DATA_DETECTION)
Added: trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.mm (0 => 277479)
--- trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.mm (rev 0)
+++ trunk/Source/WebCore/PAL/pal/cocoa/DataDetectorsCoreSoftLink.mm 2021-05-14 04:06:37 UTC (rev 277479)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2016-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 ENABLE(DATA_DETECTION)
+
+#include <pal/spi/cocoa/DataDetectorsCoreSPI.h>
+#include <wtf/SoftLinking.h>
+
+SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE(PAL, DataDetectorsCore)
+SOFT_LINK_CLASS_FOR_SOURCE_WITH_EXPORT(PAL, DataDetectorsCore, DDScannerResult, PAL_EXPORT)
+
+#if 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))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDScannerCopyResultsWithOptions, CFArrayRef, (DDScannerRef scanner, DDScannerCopyResultsOptions options), (scanner, options))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDResultGetRange, CFRange, (DDResultRef result), (result))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDResultGetType, CFStringRef, (DDResultRef result), (result))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDResultGetCategory, DDResultCategory, (DDResultRef result), (result))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDResultIsPastDate, Boolean, (DDResultRef result, CFDateRef referenceDate, CFTimeZoneRef referenceTimeZone), (result, referenceDate, referenceTimeZone))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDScanQueryAddTextFragment, void, (DDScanQueryRef query, CFStringRef fragment, CFRange range, void *identifier, DDTextFragmentMode mode, DDTextCoalescingType type), (query, fragment, range, identifier, mode, type))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDScanQueryAddSeparator, void, (DDScanQueryRef query, DDTextCoalescingType type), (query, type))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDScanQueryAddLineBreak, void, (DDScanQueryRef query), (query))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDScanQueryGetFragmentMetaData, void *, (DDScanQueryRef query, CFIndex queryIndex), (query, queryIndex))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDResultHasProperties, bool, (DDResultRef result, CFIndex propertySet), (result, propertySet))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDResultGetSubResults, CFArrayRef, (DDResultRef result), (result))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDResultGetQueryRangeForURLification, DDQueryRange, (DDResultRef result), (result))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDURLStringForResult, NSString *, (DDResultRef currentResult, NSString * resultIdentifier, DDURLifierPhoneNumberDetectionTypes includingTelGroups, NSDate * referenceDate, NSTimeZone * referenceTimeZone), (currentResult, resultIdentifier, includingTelGroups, referenceDate, referenceTimeZone))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDURLTapAndHoldSchemes, NSArray *, (), ())
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForURL, BOOL, (NSURL *url), (url))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForResult, BOOL, (DDResultRef result), (result))
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDShouldUseLightLinksForResult, BOOL, (DDResultRef result, BOOL extractedFromSignature), (result, extractedFromSignature))
+SOFT_LINK_POINTER_FOR_SOURCE(PAL, DataDetectorsCore, DDBinderParsecSourceKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_SOURCE(PAL, DataDetectorsCore, DDBinderHttpURLKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_SOURCE(PAL, DataDetectorsCore, DDBinderWebURLKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_SOURCE(PAL, DataDetectorsCore, DDBinderMailURLKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_SOURCE(PAL, DataDetectorsCore, DDBinderGenericURLKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_SOURCE(PAL, DataDetectorsCore, DDBinderEmailKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_SOURCE(PAL, DataDetectorsCore, DDBinderTrackingNumberKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_SOURCE(PAL, DataDetectorsCore, DDBinderFlightInformationKey, CFStringRef)
+SOFT_LINK_POINTER_FOR_SOURCE(PAL, DataDetectorsCore, DDBinderSignatureBlockKey, CFStringRef)
+SOFT_LINK_CONSTANT_FOR_SOURCE(PAL, DataDetectorsCore, DDScannerCopyResultsOptionsForPassiveUse, DDScannerCopyResultsOptions)
+SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, DataDetectorsCore, DDScannerEnableOptionalSource, void, (DDScannerRef scanner, DDScannerSource source, Boolean enable), (scanner, source, enable))
+#endif // PLATFORM(IOS_FAMILY)
+
+#endif // ENABLE(DATA_DETECTION)
Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/DataDetectorsCoreSPI.h (277478 => 277479)
--- trunk/Source/WebCore/PAL/pal/spi/cocoa/DataDetectorsCoreSPI.h 2021-05-14 03:30:39 UTC (rev 277478)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/DataDetectorsCoreSPI.h 2021-05-14 04:06:37 UTC (rev 277479)
@@ -40,6 +40,8 @@
#else // !USE(APPLE_INTERNAL_SDK)
+#import <Foundation/Foundation.h>
+
typedef enum {
DDScannerTypeStandard = 0,
DDScannerType1 = 1,
Modified: trunk/Source/WebCore/SourcesCocoa.txt (277478 => 277479)
--- trunk/Source/WebCore/SourcesCocoa.txt 2021-05-14 03:30:39 UTC (rev 277478)
+++ trunk/Source/WebCore/SourcesCocoa.txt 2021-05-14 04:06:37 UTC (rev 277479)
@@ -237,7 +237,6 @@
platform/cf/SharedBufferCF.cpp
platform/cocoa/ContentFilterUnblockHandlerCocoa.mm @no-unify
platform/cocoa/CoreVideoSoftLink.cpp
-platform/cocoa/DataDetectorsCoreSoftLink.mm @no-unify
platform/cocoa/DragDataCocoa.mm
platform/cocoa/DragImageCocoa.mm
platform/cocoa/FileMonitorCocoa.mm
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (277478 => 277479)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-05-14 03:30:39 UTC (rev 277478)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-05-14 04:06:37 UTC (rev 277479)
@@ -1257,7 +1257,6 @@
4430D00D2575A8A50046D401 /* HighlightRegister.h in Headers */ = {isa = PBXBuildFile; fileRef = 44E88E50236A56AC009B4847 /* HighlightRegister.h */; settings = {ATTRIBUTES = (Private, ); }; };
445210DF25D61F00003A2ED8 /* AppHighlight.h in Headers */ = {isa = PBXBuildFile; fileRef = 445210DD25D61EFF003A2ED8 /* AppHighlight.h */; settings = {ATTRIBUTES = (Private, ); }; };
445775E520472F73008DCE5D /* LocalDefaultSystemAppearance.h in Headers */ = {isa = PBXBuildFile; fileRef = 445775E420472F73008DCE5D /* LocalDefaultSystemAppearance.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 4463CF682212FA68001A8577 /* DataDetectorsCoreSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C7941E21C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm */; };
4465D7BD2536D05E0016666D /* SelectionRangeData.h in Headers */ = {isa = PBXBuildFile; fileRef = 44B38BF42536901A00A4458D /* SelectionRangeData.h */; settings = {ATTRIBUTES = (Private, ); }; };
446DC64824A29DAB0061F390 /* PlaybackTargetClientContextIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 446DC64624A29D9B0061F390 /* PlaybackTargetClientContextIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
4471710E205AF945000A116E /* MediaQueryParserContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 4471710C205AF945000A116E /* MediaQueryParserContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2390,7 +2389,6 @@
7C77C3D71DEF850A00A50BFA /* EndingType.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C77C3D61DEF850A00A50BFA /* EndingType.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C77C3DC1DEF86D700A50BFA /* JSEndingType.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C77C3DA1DEF86D700A50BFA /* JSEndingType.h */; };
7C7903B31F86F95C00463A70 /* ImageBitmapRenderingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C7903B01F86F95C00463A70 /* ImageBitmapRenderingContext.h */; };
- 7C7941E51C56C29300A4C58E /* DataDetectorsCoreSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C7941E31C56C29300A4C58E /* DataDetectorsCoreSoftLink.h */; };
7C7BF9422516C90C00808682 /* PerformanceMarkOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C7BF93E2516C8BC00808682 /* PerformanceMarkOptions.h */; };
7C7BF94C2516FA5400808682 /* PerformanceMeasureOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C7BF9492516FA5400808682 /* PerformanceMeasureOptions.h */; };
7C8139A61ED6286A00CE26E8 /* JSDOMAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C8139A31ED6281D00CE26E8 /* JSDOMAttribute.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -10700,8 +10698,6 @@
7C7903B81F86FDE600463A70 /* JSImageBitmapRenderingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSImageBitmapRenderingContext.h; sourceTree = "<group>"; };
7C7903BA1F86FF3300463A70 /* PlaceholderRenderingContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlaceholderRenderingContext.cpp; sourceTree = "<group>"; };
7C7903BC1F86FF3400463A70 /* PlaceholderRenderingContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlaceholderRenderingContext.h; sourceTree = "<group>"; };
- 7C7941E21C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataDetectorsCoreSoftLink.mm; sourceTree = "<group>"; };
- 7C7941E31C56C29300A4C58E /* DataDetectorsCoreSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataDetectorsCoreSoftLink.h; sourceTree = "<group>"; };
7C7BF93E2516C8BC00808682 /* PerformanceMarkOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PerformanceMarkOptions.h; sourceTree = "<group>"; };
7C7BF9402516C8BC00808682 /* PerformanceMarkOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PerformanceMarkOptions.idl; sourceTree = "<group>"; };
7C7BF9442516CC9200808682 /* PerformanceMark.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PerformanceMark.cpp; sourceTree = "<group>"; };
@@ -24889,8 +24885,6 @@
A14090FA1AA51E1D0091191A /* ContentFilterUnblockHandlerCocoa.mm */,
CD7D33451C7A16BF00041293 /* CoreVideoSoftLink.cpp */,
CD7D33461C7A16BF00041293 /* CoreVideoSoftLink.h */,
- 7C7941E31C56C29300A4C58E /* DataDetectorsCoreSoftLink.h */,
- 7C7941E21C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm */,
F462E79F242ADA3C00204DDD /* DragDataCocoa.mm */,
F462E7A0242ADA3D00204DDD /* DragImageCocoa.mm */,
7A09CEF01F01D1F700E93BDB /* FileMonitorCocoa.mm */,
@@ -32159,7 +32153,6 @@
97BC6A321505F081001B74AC /* DatabaseTracker.h in Headers */,
BE23480D18A9871400E4B6E8 /* DataCue.h in Headers */,
C5227DF11C3C6DF100F5ED54 /* DataDetection.h in Headers */,
- 7C7941E51C56C29300A4C58E /* DataDetectorsCoreSoftLink.h in Headers */,
BC4A533525605A560028C592 /* DataDetectorType.h in Headers */,
E58B45BA20AD07DD00991025 /* DataListButtonElement.h in Headers */,
E517670320B88C1400D41167 /* DataListSuggestionInformation.h in Headers */,
@@ -36466,7 +36459,6 @@
1ABA76CA11D20E50004C201C /* CSSPropertyNames.cpp in Sources */,
2D22830323A8470700364B7E /* CursorMac.mm in Sources */,
5CBD59592280E926002B22AA /* CustomHeaderFields.cpp in Sources */,
- 4463CF682212FA68001A8577 /* DataDetectorsCoreSoftLink.mm in Sources */,
6E72F54C229DCD0C00B3E151 /* ExtensionsGLANGLE.cpp in Sources */,
7CE6CBFD187F394900D46BF5 /* FormatConverter.cpp in Sources */,
5130F2F624AEA60A00E1D0A0 /* GameControllerSoftLink.mm in Sources */,
Modified: trunk/Source/WebCore/editing/cocoa/DataDetection.mm (277478 => 277479)
--- trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2021-05-14 03:30:39 UTC (rev 277478)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2021-05-14 04:06:37 UTC (rev 277479)
@@ -50,6 +50,7 @@
#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>
@@ -56,8 +57,6 @@
#import <wtf/text/StringBuilder.h>
#import <wtf/text/StringToIntegerConversion.h>
-#import "DataDetectorsCoreSoftLink.h"
-
#if PLATFORM(MAC)
template<> struct WTF::CFTypeTrait<DDResultRef> {
static inline CFTypeID typeID(void) { return DDResultGetCFTypeID(); }
@@ -166,7 +165,7 @@
bool DataDetection::canBePresentedByDataDetectors(const URL& url)
{
- return [softLink_DataDetectorsCore_DDURLTapAndHoldSchemes() containsObject:(NSString *)url.protocol().toStringWithoutCopying().convertToASCIILowercase()];
+ return [PAL::softLink_DataDetectorsCore_DDURLTapAndHoldSchemes() containsObject:(NSString *)url.protocol().toStringWithoutCopying().convertToASCIILowercase()];
}
bool DataDetection::isDataDetectorLink(Element& element)
@@ -192,7 +191,7 @@
if (!isDataDetectorLink(element))
return false;
- if (softLink_DataDetectorsCore_DDShouldImmediatelyShowActionSheetForURL(downcast<HTMLAnchorElement>(element).href()))
+ if (PAL::softLink_DataDetectorsCore_DDShouldImmediatelyShowActionSheetForURL(downcast<HTMLAnchorElement>(element).href()))
return true;
auto& resultAttribute = element.attributeWithoutSynchronization(x_apple_data_detectors_resultAttr);
@@ -208,11 +207,11 @@
// Handle the case of a signature block, where we need to follow the path down one or more subresult levels.
while (++indexIterator != resultIndices.end()) {
- results = (__bridge NSArray *)softLink_DataDetectorsCore_DDResultGetSubResults(result);
+ results = (__bridge NSArray *)PAL::softLink_DataDetectorsCore_DDResultGetSubResults(result);
result = (__bridge DDResultRef)results[parseIntegerAllowingTrailingJunk<int>(*indexIterator).valueOr(0)];
}
- return softLink_DataDetectorsCore_DDShouldImmediatelyShowActionSheetForResult(result);
+ return PAL::softLink_DataDetectorsCore_DDShouldImmediatelyShowActionSheetForResult(result);
}
static BOOL resultIsURL(DDResultRef result)
@@ -221,34 +220,34 @@
return NO;
static NeverDestroyed<RetainPtr<NSSet>> urlTypes = [NSSet setWithObjects:
- (NSString *)get_DataDetectorsCore_DDBinderHttpURLKey(),
- (NSString *)get_DataDetectorsCore_DDBinderWebURLKey(),
- (NSString *)get_DataDetectorsCore_DDBinderMailURLKey(),
- (NSString *)get_DataDetectorsCore_DDBinderGenericURLKey(),
- (NSString *)get_DataDetectorsCore_DDBinderEmailKey(), nil];
- return [urlTypes.get() containsObject:(NSString *)softLink_DataDetectorsCore_DDResultGetType(result)];
+ (NSString *)PAL::get_DataDetectorsCore_DDBinderHttpURLKey(),
+ (NSString *)PAL::get_DataDetectorsCore_DDBinderWebURLKey(),
+ (NSString *)PAL::get_DataDetectorsCore_DDBinderMailURLKey(),
+ (NSString *)PAL::get_DataDetectorsCore_DDBinderGenericURLKey(),
+ (NSString *)PAL::get_DataDetectorsCore_DDBinderEmailKey(), nil];
+ return [urlTypes.get() containsObject:(NSString *)PAL::softLink_DataDetectorsCore_DDResultGetType(result)];
}
static NSString *constructURLStringForResult(DDResultRef currentResult, NSString *resultIdentifier, NSDate *referenceDate, NSTimeZone *referenceTimeZone, OptionSet<DataDetectorType> detectionTypes)
{
- if (!softLink_DataDetectorsCore_DDResultHasProperties(currentResult, DDResultPropertyPassiveDisplay))
+ if (!PAL::softLink_DataDetectorsCore_DDResultHasProperties(currentResult, DDResultPropertyPassiveDisplay))
return nil;
auto phoneTypes = detectionTypes.contains(DataDetectorType::PhoneNumber) ? DDURLifierPhoneNumberDetectionRegular : DDURLifierPhoneNumberDetectionNone;
- auto category = softLink_DataDetectorsCore_DDResultGetCategory(currentResult);
- auto type = softLink_DataDetectorsCore_DDResultGetType(currentResult);
+ auto category = PAL::softLink_DataDetectorsCore_DDResultGetCategory(currentResult);
+ auto type = PAL::softLink_DataDetectorsCore_DDResultGetType(currentResult);
if ((detectionTypes.contains(DataDetectorType::Address) && DDResultCategoryAddress == category)
- || (detectionTypes.contains(DataDetectorType::TrackingNumber) && CFEqual(get_DataDetectorsCore_DDBinderTrackingNumberKey(), type))
- || (detectionTypes.contains(DataDetectorType::FlightNumber) && CFEqual(get_DataDetectorsCore_DDBinderFlightInformationKey(), type))
- || (detectionTypes.contains(DataDetectorType::LookupSuggestion) && CFEqual(get_DataDetectorsCore_DDBinderParsecSourceKey(), type))
+ || (detectionTypes.contains(DataDetectorType::TrackingNumber) && CFEqual(PAL::get_DataDetectorsCore_DDBinderTrackingNumberKey(), type))
+ || (detectionTypes.contains(DataDetectorType::FlightNumber) && CFEqual(PAL::get_DataDetectorsCore_DDBinderFlightInformationKey(), type))
+ || (detectionTypes.contains(DataDetectorType::LookupSuggestion) && CFEqual(PAL::get_DataDetectorsCore_DDBinderParsecSourceKey(), type))
|| (detectionTypes.contains(DataDetectorType::PhoneNumber) && DDResultCategoryPhoneNumber == category)
|| (detectionTypes.contains(DataDetectorType::Link) && resultIsURL(currentResult))) {
- return softLink_DataDetectorsCore_DDURLStringForResult(currentResult, resultIdentifier, phoneTypes, referenceDate, referenceTimeZone);
+ return PAL::softLink_DataDetectorsCore_DDURLStringForResult(currentResult, resultIdentifier, phoneTypes, referenceDate, referenceTimeZone);
}
if (detectionTypes.contains(DataDetectorType::CalendarEvent) && DDResultCategoryCalendarEvent == category) {
- if (!softLink_DataDetectorsCore_DDResultIsPastDate(currentResult, (CFDateRef)referenceDate, (CFTimeZoneRef)referenceTimeZone))
- return softLink_DataDetectorsCore_DDURLStringForResult(currentResult, resultIdentifier, phoneTypes, referenceDate, referenceTimeZone);
+ if (!PAL::softLink_DataDetectorsCore_DDResultIsPastDate(currentResult, (CFDateRef)referenceDate, (CFTimeZoneRef)referenceTimeZone))
+ return PAL::softLink_DataDetectorsCore_DDURLStringForResult(currentResult, resultIdentifier, phoneTypes, referenceDate, referenceTimeZone);
}
return nil;
}
@@ -359,7 +358,7 @@
StringView currentText = iterator.text();
size_t currentTextLength = currentText.length();
if (!currentTextLength) {
- softLink_DataDetectorsCore_DDScanQueryAddSeparator(scanQuery, DDTextCoalescingTypeHardBreak);
+ PAL::softLink_DataDetectorsCore_DDScanQueryAddSeparator(scanQuery, DDTextCoalescingTypeHardBreak);
if (iteratorCount > maxFragmentWithHardBreak)
break;
continue;
@@ -394,11 +393,11 @@
}
if (containsOnlyWhiteSpace) {
if (hasNewline) {
- softLink_DataDetectorsCore_DDScanQueryAddLineBreak(scanQuery);
+ PAL::softLink_DataDetectorsCore_DDScanQueryAddLineBreak(scanQuery);
if (iteratorCount > maxFragmentWithLinebreak)
break;
} else {
- softLink_DataDetectorsCore_DDScanQueryAddSeparator(scanQuery, hasTab ? DDTextCoalescingTypeTab : DDTextCoalescingTypeSpace);
+ PAL::softLink_DataDetectorsCore_DDScanQueryAddSeparator(scanQuery, hasTab ? DDTextCoalescingTypeTab : DDTextCoalescingTypeSpace);
if (iteratorCount > maxFragmentSpace)
break;
}
@@ -406,7 +405,7 @@
}
auto currentTextCFString = adoptCF(CFStringCreateWithCharacters(kCFAllocatorDefault, reinterpret_cast<const UniChar*>(currentTextUpconvertedCharacters.get()), currentTextLength));
- softLink_DataDetectorsCore_DDScanQueryAddTextFragment(scanQuery, currentTextCFString.get(), CFRangeMake(0, currentTextLength), (void *)iteratorCount, (DDTextFragmentMode)0, DDTextCoalescingTypeNone);
+ PAL::softLink_DataDetectorsCore_DDScanQueryAddTextFragment(scanQuery, currentTextCFString.get(), CFRangeMake(0, currentTextLength), (void *)iteratorCount, (DDTextFragmentMode)0, DDTextCoalescingTypeNone);
fragmentCount++;
}
}
@@ -436,18 +435,18 @@
NSArray *DataDetection::detectContentInRange(const SimpleRange& contextRange, OptionSet<DataDetectorType> types, NSDictionary *context)
{
- auto scanner = adoptCF(softLink_DataDetectorsCore_DDScannerCreate(DDScannerTypeStandard, 0, nullptr));
- auto scanQuery = adoptCF(softLink_DataDetectorsCore_DDScanQueryCreate(NULL));
+ auto scanner = adoptCF(PAL::softLink_DataDetectorsCore_DDScannerCreate(DDScannerTypeStandard, 0, nullptr));
+ auto scanQuery = adoptCF(PAL::softLink_DataDetectorsCore_DDScanQueryCreate(NULL));
buildQuery(scanQuery.get(), contextRange);
if (types.contains(DataDetectorType::LookupSuggestion))
- softLink_DataDetectorsCore_DDScannerEnableOptionalSource(scanner.get(), DDScannerSourceSpotlight, true);
+ PAL::softLink_DataDetectorsCore_DDScannerEnableOptionalSource(scanner.get(), DDScannerSourceSpotlight, true);
// FIXME: we should add a timeout to this call to make sure it doesn't take too much time.
- if (!softLink_DataDetectorsCore_DDScannerScanQuery(scanner.get(), scanQuery.get()))
+ if (!PAL::softLink_DataDetectorsCore_DDScannerScanQuery(scanner.get(), scanQuery.get()))
return nil;
- auto scannerResults = adoptCF(softLink_DataDetectorsCore_DDScannerCopyResultsWithOptions(scanner.get(), get_DataDetectorsCore_DDScannerCopyResultsOptionsForPassiveUse() | DDScannerCopyResultsOptionsCoalesceSignatures));
+ auto scannerResults = adoptCF(PAL::softLink_DataDetectorsCore_DDScannerCopyResultsWithOptions(scanner.get(), PAL::get_DataDetectorsCore_DDScannerCopyResultsOptionsForPassiveUse() | DDScannerCopyResultsOptionsCoalesceSignatures));
if (!scannerResults)
return nil;
@@ -463,8 +462,8 @@
for (id resultObject in (NSArray *)scannerResults.get()) {
DDResultRef result = (DDResultRef)resultObject;
NSIndexPath *indexPath = [NSIndexPath indexPathWithIndex:currentTopLevelIndex];
- if (CFEqual(softLink_DataDetectorsCore_DDResultGetType(result), get_DataDetectorsCore_DDBinderSignatureBlockKey())) {
- NSArray *subresults = (NSArray *)softLink_DataDetectorsCore_DDResultGetSubResults(result);
+ if (CFEqual(PAL::softLink_DataDetectorsCore_DDResultGetType(result), PAL::get_DataDetectorsCore_DDBinderSignatureBlockKey())) {
+ NSArray *subresults = (NSArray *)PAL::softLink_DataDetectorsCore_DDResultGetSubResults(result);
for (NSUInteger subResultIndex = 0 ; subResultIndex < [subresults count] ; subResultIndex++) {
indexPaths.append([indexPath indexPathByAddingIndex:subResultIndex]);
@@ -485,8 +484,8 @@
// where the DOM needs to be modified.
// Each result can be contained all in one text node or can span multiple text nodes.
for (auto& result : allResults) {
- DDQueryRange queryRange = softLink_DataDetectorsCore_DDResultGetQueryRangeForURLification(result.get());
- CFIndex iteratorTargetAdvanceCount = (CFIndex)softLink_DataDetectorsCore_DDScanQueryGetFragmentMetaData(scanQuery.get(), queryRange.start.queryIndex);
+ DDQueryRange queryRange = PAL::softLink_DataDetectorsCore_DDResultGetQueryRangeForURLification(result.get());
+ CFIndex iteratorTargetAdvanceCount = (CFIndex)PAL::softLink_DataDetectorsCore_DDScanQueryGetFragmentMetaData(scanQuery.get(), queryRange.start.queryIndex);
for (; iteratorCount < iteratorTargetAdvanceCount; ++iteratorCount)
iterator.advance();
@@ -505,7 +504,7 @@
while (fragmentIndex < queryRange.end.queryIndex) {
++fragmentIndex;
- iteratorTargetAdvanceCount = (CFIndex)softLink_DataDetectorsCore_DDScanQueryGetFragmentMetaData(scanQuery.get(), fragmentIndex);
+ iteratorTargetAdvanceCount = (CFIndex)PAL::softLink_DataDetectorsCore_DDScanQueryGetFragmentMetaData(scanQuery.get(), fragmentIndex);
for (; iteratorCount < iteratorTargetAdvanceCount; ++iteratorCount)
iterator.advance();
@@ -534,7 +533,7 @@
CFIndex resultCount = allResults.size();
for (CFIndex resultIndex = 0; resultIndex < resultCount; ++resultIndex) {
DDResultRef coreResult = allResults[resultIndex].get();
- DDQueryRange queryRange = softLink_DataDetectorsCore_DDResultGetQueryRangeForURLification(coreResult);
+ DDQueryRange queryRange = PAL::softLink_DataDetectorsCore_DDResultGetQueryRangeForURLification(coreResult);
auto& resultRanges = allResultRanges[resultIndex];
// Compare the query offsets to make sure we don't go backwards
@@ -551,7 +550,7 @@
continue;
lastModifiedQueryOffset = queryRange.end;
- BOOL shouldUseLightLinks = softLink_DataDetectorsCore_DDShouldUseLightLinksForResult(coreResult, [indexPaths[resultIndex] length] > 1);
+ BOOL shouldUseLightLinks = PAL::softLink_DataDetectorsCore_DDShouldUseLightLinksForResult(coreResult, [indexPaths[resultIndex] length] > 1);
for (auto& range : resultRanges) {
auto* parentNode = range.start.container->parentNode();
@@ -616,7 +615,7 @@
// Add a special attribute to mark this URLification as the result of data detectors.
anchorElement->setAttributeWithoutSynchronization(x_apple_data_detectorsAttr, AtomString("true", AtomString::ConstructFromLiteral));
- anchorElement->setAttributeWithoutSynchronization(x_apple_data_detectors_typeAttr, dataDetectorTypeForCategory(softLink_DataDetectorsCore_DDResultGetCategory(coreResult)));
+ anchorElement->setAttributeWithoutSynchronization(x_apple_data_detectors_typeAttr, dataDetectorTypeForCategory(PAL::softLink_DataDetectorsCore_DDResultGetCategory(coreResult)));
anchorElement->setAttributeWithoutSynchronization(x_apple_data_detectors_resultAttr, identifier);
parentNode->insertBefore(WTFMove(anchorElement), ¤tTextNode);
@@ -631,7 +630,7 @@
if (lastTextNodeToUpdate)
lastTextNodeToUpdate->setData(lastNodeContent);
- return [getDDScannerResultClass() resultsFromCoreResults:scannerResults.get()];
+ return [PAL::getDDScannerResultClass() resultsFromCoreResults:scannerResults.get()];
}
#else
Modified: trunk/Source/WebCore/platform/ImageExtractionResult.h (277478 => 277479)
--- trunk/Source/WebCore/platform/ImageExtractionResult.h 2021-05-14 03:30:39 UTC (rev 277478)
+++ trunk/Source/WebCore/platform/ImageExtractionResult.h 2021-05-14 04:06:37 UTC (rev 277479)
@@ -27,8 +27,13 @@
#if ENABLE(IMAGE_EXTRACTION)
+#if ENABLE(DATA_DETECTION)
+OBJC_CLASS DDScannerResult;
+#endif
+
#include "FloatQuad.h"
#include <wtf/Optional.h>
+#include <wtf/RetainPtr.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -82,6 +87,22 @@
template<class Decoder> static Optional<ImageExtractionLineData> decode(Decoder&);
};
+#if ENABLE(DATA_DETECTION)
+
+struct ImageExtractionDataDetectorInfo {
+ ImageExtractionDataDetectorInfo() = default;
+ ImageExtractionDataDetectorInfo(DDScannerResult *scannerResult, Vector<FloatQuad>&& quads)
+ : result(scannerResult)
+ , normalizedQuads(WTFMove(quads))
+ {
+ }
+
+ RetainPtr<DDScannerResult> result;
+ Vector<FloatQuad> normalizedQuads;
+};
+
+#endif // ENABLE(DATA_DETECTION)
+
template<class Encoder> void ImageExtractionLineData::encode(Encoder& encoder) const
{
encoder << normalizedQuad;
@@ -106,8 +127,23 @@
struct ImageExtractionResult {
Vector<ImageExtractionLineData> lines;
- bool isEmpty() const { return lines.isEmpty(); }
+#if ENABLE(DATA_DETECTION)
+ Vector<ImageExtractionDataDetectorInfo> dataDetectors;
+#endif
+ bool isEmpty() const
+ {
+ if (!lines.isEmpty())
+ return false;
+
+#if ENABLE(DATA_DETECTION)
+ if (!dataDetectors.isEmpty())
+ return false;
+#endif
+
+ return true;
+ }
+
template<class Encoder> void encode(Encoder&) const;
template<class Decoder> static Optional<ImageExtractionResult> decode(Decoder&);
};
@@ -115,6 +151,9 @@
template<class Encoder> void ImageExtractionResult::encode(Encoder& encoder) const
{
encoder << lines;
+#if ENABLE(DATA_DETECTION)
+ encoder << dataDetectors;
+#endif
}
template<class Decoder> Optional<ImageExtractionResult> ImageExtractionResult::decode(Decoder& decoder)
@@ -124,7 +163,19 @@
if (!lines)
return WTF::nullopt;
- return {{ WTFMove(*lines) }};
+#if ENABLE(DATA_DETECTION)
+ Optional<Vector<ImageExtractionDataDetectorInfo>> dataDetectors;
+ decoder >> dataDetectors;
+ if (!dataDetectors)
+ return WTF::nullopt;
+#endif
+
+ return {{
+ WTFMove(*lines),
+#if ENABLE(DATA_DETECTION)
+ WTFMove(*dataDetectors),
+#endif
+ }};
}
} // namespace WebCore
Deleted: trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.h (277478 => 277479)
--- trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.h 2021-05-14 03:30:39 UTC (rev 277478)
+++ trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.h 2021-05-14 04:06:37 UTC (rev 277479)
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2016 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 ENABLE(DATA_DETECTION)
-
-#include <pal/spi/cocoa/DataDetectorsCoreSPI.h>
-#include <wtf/SoftLinking.h>
-
-#if PLATFORM(IOS_FAMILY)
-
-SOFT_LINK_CLASS_FOR_HEADER(WebCore, DDScannerResult)
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDScannerCreate, DDScannerRef, (DDScannerType type, DDScannerOptions options, CFErrorRef * errorRef), (type, options, errorRef))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDScannerScanQuery, Boolean, (DDScannerRef scanner, DDScanQueryRef query), (scanner, query))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDScanQueryCreate, DDScanQueryRef, (CFAllocatorRef allocator), (allocator))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDScannerCopyResultsWithOptions, CFArrayRef, (DDScannerRef scanner, DDScannerCopyResultsOptions options), (scanner, options))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDResultGetRange, CFRange, (DDResultRef result), (result))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDResultGetType, CFStringRef, (DDResultRef result), (result))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDResultGetCategory, DDResultCategory, (DDResultRef result), (result))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDResultIsPastDate, Boolean, (DDResultRef result, CFDateRef referenceDate, CFTimeZoneRef referenceTimeZone), (result, referenceDate, referenceTimeZone))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDScanQueryAddTextFragment, void, (DDScanQueryRef query, CFStringRef fragment, CFRange range, void *identifier, DDTextFragmentMode mode, DDTextCoalescingType type), (query, fragment, range, identifier, mode, type))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDScanQueryAddSeparator, void, (DDScanQueryRef query, DDTextCoalescingType type), (query, type))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDScanQueryAddLineBreak, void, (DDScanQueryRef query), (query))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDScanQueryGetFragmentMetaData, void *, (DDScanQueryRef query, CFIndex queryIndex), (query, queryIndex))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDResultHasProperties, bool, (DDResultRef result, CFIndex propertySet), (result, propertySet))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDResultGetSubResults, CFArrayRef, (DDResultRef result), (result))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDResultGetQueryRangeForURLification, DDQueryRange, (DDResultRef result), (result))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDURLStringForResult, NSString *, (DDResultRef currentResult, NSString * resultIdentifier, DDURLifierPhoneNumberDetectionTypes includingTelGroups, NSDate * referenceDate, NSTimeZone * referenceTimeZone), (currentResult, resultIdentifier, includingTelGroups, referenceDate, referenceTimeZone))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDURLTapAndHoldSchemes, NSArray *, (), ())
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForURL, BOOL, (NSURL *url), (url))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForResult, BOOL, (DDResultRef result), (result))
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDShouldUseLightLinksForResult, BOOL, (DDResultRef result, BOOL extractedFromSignature), (result, extractedFromSignature))
-SOFT_LINK_POINTER_FOR_HEADER(WebCore, DataDetectorsCore, DDBinderParsecSourceKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_HEADER(WebCore, DataDetectorsCore, DDBinderHttpURLKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_HEADER(WebCore, DataDetectorsCore, DDBinderWebURLKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_HEADER(WebCore, DataDetectorsCore, DDBinderMailURLKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_HEADER(WebCore, DataDetectorsCore, DDBinderGenericURLKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_HEADER(WebCore, DataDetectorsCore, DDBinderEmailKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_HEADER(WebCore, DataDetectorsCore, DDBinderTrackingNumberKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_HEADER(WebCore, DataDetectorsCore, DDBinderFlightInformationKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_HEADER(WebCore, DataDetectorsCore, DDBinderSignatureBlockKey, CFStringRef)
-SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, DataDetectorsCore, DDScannerCopyResultsOptionsForPassiveUse, DDScannerCopyResultsOptions)
-
-SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, DataDetectorsCore, DDScannerEnableOptionalSource, void, (DDScannerRef scanner, DDScannerSource source, Boolean enable), (scanner, source, enable))
-
-#endif // PLATFORM(IOS_FAMILY)
-
-#endif
Deleted: trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.mm (277478 => 277479)
--- trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.mm 2021-05-14 03:30:39 UTC (rev 277478)
+++ trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.mm 2021-05-14 04:06:37 UTC (rev 277479)
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2016 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"
-#import "DataDetectorsCoreSoftLink.h"
-
-#if PLATFORM(IOS_FAMILY) && ENABLE(DATA_DETECTION)
-
-SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE(WebCore, DataDetectorsCore)
-
-SOFT_LINK_CLASS_FOR_SOURCE(WebCore, DataDetectorsCore, DDScannerResult)
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDScannerCreate, DDScannerRef, (DDScannerType type, DDScannerOptions options, CFErrorRef * errorRef), (type, options, errorRef))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDScannerScanQuery, Boolean, (DDScannerRef scanner, DDScanQueryRef query), (scanner, query))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDScanQueryCreate, DDScanQueryRef, (CFAllocatorRef allocator), (allocator))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDScannerCopyResultsWithOptions, CFArrayRef, (DDScannerRef scanner, DDScannerCopyResultsOptions options), (scanner, options))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDResultGetRange, CFRange, (DDResultRef result), (result))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDResultGetType, CFStringRef, (DDResultRef result), (result))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDResultGetCategory, DDResultCategory, (DDResultRef result), (result))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDResultIsPastDate, Boolean, (DDResultRef result, CFDateRef referenceDate, CFTimeZoneRef referenceTimeZone), (result, referenceDate, referenceTimeZone))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDScanQueryAddTextFragment, void, (DDScanQueryRef query, CFStringRef fragment, CFRange range, void *identifier, DDTextFragmentMode mode, DDTextCoalescingType type), (query, fragment, range, identifier, mode, type))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDScanQueryAddSeparator, void, (DDScanQueryRef query, DDTextCoalescingType type), (query, type))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDScanQueryAddLineBreak, void, (DDScanQueryRef query), (query))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDScanQueryGetFragmentMetaData, void *, (DDScanQueryRef query, CFIndex queryIndex), (query, queryIndex))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDResultHasProperties, bool, (DDResultRef result, CFIndex propertySet), (result, propertySet))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDResultGetSubResults, CFArrayRef, (DDResultRef result), (result))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDResultGetQueryRangeForURLification, DDQueryRange, (DDResultRef result), (result))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDURLStringForResult, NSString *, (DDResultRef currentResult, NSString * resultIdentifier, DDURLifierPhoneNumberDetectionTypes includingTelGroups, NSDate * referenceDate, NSTimeZone * referenceTimeZone), (currentResult, resultIdentifier, includingTelGroups, referenceDate, referenceTimeZone))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDURLTapAndHoldSchemes, NSArray *, (), ())
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForURL, BOOL, (NSURL *url), (url))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDShouldImmediatelyShowActionSheetForResult, BOOL, (DDResultRef result), (result))
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDShouldUseLightLinksForResult, BOOL, (DDResultRef result, BOOL extractedFromSignature), (result, extractedFromSignature))
-SOFT_LINK_POINTER_FOR_SOURCE(WebCore, DataDetectorsCore, DDBinderParsecSourceKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_SOURCE(WebCore, DataDetectorsCore, DDBinderHttpURLKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_SOURCE(WebCore, DataDetectorsCore, DDBinderWebURLKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_SOURCE(WebCore, DataDetectorsCore, DDBinderMailURLKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_SOURCE(WebCore, DataDetectorsCore, DDBinderGenericURLKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_SOURCE(WebCore, DataDetectorsCore, DDBinderEmailKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_SOURCE(WebCore, DataDetectorsCore, DDBinderTrackingNumberKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_SOURCE(WebCore, DataDetectorsCore, DDBinderFlightInformationKey, CFStringRef)
-SOFT_LINK_POINTER_FOR_SOURCE(WebCore, DataDetectorsCore, DDBinderSignatureBlockKey, CFStringRef)
-SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, DataDetectorsCore, DDScannerCopyResultsOptionsForPassiveUse, DDScannerCopyResultsOptions)
-
-SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, DataDetectorsCore, DDScannerEnableOptionalSource, void, (DDScannerRef scanner, DDScannerSource source, Boolean enable), (scanner, source, enable))
-
-#endif // PLATFORM(IOS_FAMILY) && ENABLE(DATA_DETECTION)
Modified: trunk/Source/WebKit/ChangeLog (277478 => 277479)
--- trunk/Source/WebKit/ChangeLog 2021-05-14 03:30:39 UTC (rev 277478)
+++ trunk/Source/WebKit/ChangeLog 2021-05-14 04:06:37 UTC (rev 277479)
@@ -1,3 +1,21 @@
+2021-05-13 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [Cocoa] Plumb data detector results through some platform objects
+ https://bugs.webkit.org/show_bug.cgi?id=225775
+ Work towards rdar://75504956
+
+ Reviewed by Tim Horton and Devin Rousso.
+
+ Add IPC encoding and decoding support for the new struct.
+
+ * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
+ (IPC::ArgumentCoder<ImageExtractionDataDetectorInfo>::encodePlatformData):
+ (IPC::ArgumentCoder<ImageExtractionDataDetectorInfo>::decodePlatformData):
+ * Shared/WebCoreArgumentCoders.cpp:
+ (IPC::ArgumentCoder<ImageExtractionDataDetectorInfo>::encode):
+ (IPC::ArgumentCoder<ImageExtractionDataDetectorInfo>::decode):
+ * Shared/WebCoreArgumentCoders.h:
+
2021-05-13 Dean Jackson <d...@apple.com>
[WebXR] Allow WebXR to be tested on PLATFORM(COCOA)
Modified: trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm (277478 => 277479)
--- trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm 2021-05-14 03:30:39 UTC (rev 277478)
+++ trunk/Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm 2021-05-14 04:06:37 UTC (rev 277479)
@@ -50,6 +50,10 @@
#include <WebKitAdditions/WebCoreArgumentCodersCocoaAdditions.mm>
#endif
+#if ENABLE(IMAGE_EXTRACTION)
+#import <WebCore/ImageExtractionResult.h>
+#endif
+
#if ENABLE(APPLE_PAY)
#import "DataReference.h"
#import <WebCore/PaymentAuthorizationStatus.h>
@@ -60,6 +64,10 @@
#import <pal/cocoa/AVFoundationSoftLink.h>
#endif
+#if ENABLE(DATA_DETECTION)
+#import <pal/cocoa/DataDetectorsCoreSoftLink.h>
+#endif
+
namespace IPC {
using namespace WebCore;
@@ -651,4 +659,23 @@
}
#endif
+#if ENABLE(IMAGE_EXTRACTION) && ENABLE(DATA_DETECTION)
+
+void ArgumentCoder<ImageExtractionDataDetectorInfo>::encodePlatformData(Encoder& encoder, const ImageExtractionDataDetectorInfo& info)
+{
+ encoder << info.result.get();
+}
+
+bool ArgumentCoder<ImageExtractionDataDetectorInfo>::decodePlatformData(Decoder& decoder, ImageExtractionDataDetectorInfo& result)
+{
+ auto scannerResult = IPC::decode<DDScannerResult>(decoder, @[ PAL::getDDScannerResultClass() ]);
+ if (!scannerResult)
+ return false;
+
+ result.result = WTFMove(*scannerResult);
+ return true;
+}
+
+#endif // ENABLE(IMAGE_EXTRACTION) && ENABLE(DATA_DETECTION)
+
} // namespace IPC
Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp (277478 => 277479)
--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp 2021-05-14 03:30:39 UTC (rev 277478)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp 2021-05-14 04:06:37 UTC (rev 277479)
@@ -53,6 +53,7 @@
#include <WebCore/FileChooser.h>
#include <WebCore/FilterOperation.h>
#include <WebCore/FilterOperations.h>
+#include <WebCore/FloatQuad.h>
#include <WebCore/Font.h>
#include <WebCore/FontAttributes.h>
#include <WebCore/GraphicsContext.h>
@@ -102,7 +103,6 @@
#endif
#if PLATFORM(IOS_FAMILY)
-#include <WebCore/FloatQuad.h>
#include <WebCore/SelectionGeometry.h>
#include <WebCore/SharedBuffer.h>
#endif // PLATFORM(IOS_FAMILY)
@@ -116,6 +116,10 @@
#include <WebCore/MediaConstraints.h>
#endif
+#if ENABLE(IMAGE_EXTRACTION)
+#include <WebCore/ImageExtractionResult.h>
+#endif
+
// FIXME: Seems like we could use std::tuple to cut down the code below a lot!
namespace IPC {
@@ -3198,4 +3202,29 @@
#endif
+#if ENABLE(IMAGE_EXTRACTION) && ENABLE(DATA_DETECTION)
+
+void ArgumentCoder<ImageExtractionDataDetectorInfo>::encode(Encoder& encoder, const ImageExtractionDataDetectorInfo& info)
+{
+ encodePlatformData(encoder, info);
+ encoder << info.normalizedQuads;
+}
+
+Optional<ImageExtractionDataDetectorInfo> ArgumentCoder<ImageExtractionDataDetectorInfo>::decode(Decoder& decoder)
+{
+ ImageExtractionDataDetectorInfo result;
+ if (!decodePlatformData(decoder, result))
+ return WTF::nullopt;
+
+ Optional<Vector<FloatQuad>> normalizedQuads;
+ decoder >> normalizedQuads;
+ if (!normalizedQuads)
+ return WTF::nullopt;
+
+ result.normalizedQuads = WTFMove(*normalizedQuads);
+ return WTFMove(result);
+}
+
+#endif // ENABLE(IMAGE_EXTRACTION) && ENABLE(DATA_DETECTION)
+
} // namespace IPC
Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h (277478 => 277479)
--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h 2021-05-14 03:30:39 UTC (rev 277478)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h 2021-05-14 04:06:37 UTC (rev 277479)
@@ -147,6 +147,7 @@
struct ExceptionDetails;
struct FontAttributes;
struct FileChooserSettings;
+struct ImageExtractionDataDetectorInfo;
struct RawFile;
struct ShareData;
struct ShareDataWithParsedURL;
@@ -824,6 +825,17 @@
};
#endif
+#if ENABLE(IMAGE_EXTRACTION) && ENABLE(DATA_DETECTION)
+
+template<> struct ArgumentCoder<WebCore::ImageExtractionDataDetectorInfo> {
+ static void encode(Encoder&, const WebCore::ImageExtractionDataDetectorInfo&);
+ static WARN_UNUSED_RETURN Optional<WebCore::ImageExtractionDataDetectorInfo> decode(Decoder&);
+ static void encodePlatformData(Encoder&, const WebCore::ImageExtractionDataDetectorInfo&);
+ static WARN_UNUSED_RETURN bool decodePlatformData(Decoder&, WebCore::ImageExtractionDataDetectorInfo&);
+};
+
+#endif // ENABLE(IMAGE_EXTRACTION) && ENABLE(DATA_DETECTION)
+
} // namespace IPC
namespace WTF {