Diff
Modified: trunk/Source/WebCore/ChangeLog (197975 => 197976)
--- trunk/Source/WebCore/ChangeLog 2016-03-11 01:03:38 UTC (rev 197975)
+++ trunk/Source/WebCore/ChangeLog 2016-03-11 01:06:48 UTC (rev 197976)
@@ -1,3 +1,22 @@
+2016-03-10 Enrica Casucci <[email protected]>
+
+ Expose additional WKDataDetectorTypes.
+ https://bugs.webkit.org/show_bug.cgi?id=155331
+ rdar://problem/24175813
+
+ Reviewed by Tim Horton.
+
+ Adding support for additional data detector types (tracking
+ numbers, flight information and spotlight suggestions).
+
+ * editing/cocoa/DataDetection.h:
+ * editing/cocoa/DataDetection.mm:
+ (WebCore::constructURLStringForResult):
+ (WebCore::DataDetection::detectContentInRange):
+ * platform/cocoa/DataDetectorsCoreSoftLink.h:
+ * platform/cocoa/DataDetectorsCoreSoftLink.mm:
+ * platform/spi/cocoa/DataDetectorsCoreSPI.h:
+
2016-03-10 Daniel Bates <[email protected]>
CSP: Implement frame-ancestors directive
Modified: trunk/Source/WebCore/editing/cocoa/DataDetection.h (197975 => 197976)
--- trunk/Source/WebCore/editing/cocoa/DataDetection.h 2016-03-11 01:03:38 UTC (rev 197975)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.h 2016-03-11 01:06:48 UTC (rev 197976)
@@ -46,8 +46,9 @@
DataDetectorTypeLink = 1 << 1,
DataDetectorTypeAddress = 1 << 2,
DataDetectorTypeCalendarEvent = 1 << 3,
- DataDetectorTypeTrackingNumber = 1 << 4, // Not individually selectable with the API
- DataDetectorTypeFlight = 1 << 5, // Not individually selectable with the API
+ DataDetectorTypeTrackingNumber = 1 << 4,
+ DataDetectorTypeFlightNumber = 1 << 5,
+ DataDetectorTypeSpotlightSuggestion = 1 << 6,
DataDetectorTypeAll = ULONG_MAX
};
Modified: trunk/Source/WebCore/editing/cocoa/DataDetection.mm (197975 => 197976)
--- trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2016-03-11 01:03:38 UTC (rev 197975)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2016-03-11 01:06:48 UTC (rev 197976)
@@ -44,6 +44,7 @@
#import "VisiblePosition.h"
#import "VisibleUnits.h"
#import "htmlediting.h"
+#import <WebKitAdditions/DataDetectorsAdditions.h>
const char *dataDetectorsURLScheme = "x-apple-data-detectors";
const char *dataDetectorsAttributeTypeKey = "x-apple-data-detectors-type";
@@ -199,7 +200,8 @@
if (((detectionTypes & DataDetectorTypeAddress) && (DDResultCategoryAddress == category))
|| ((detectionTypes & DataDetectorTypeTrackingNumber) && (CFStringCompare(get_DataDetectorsCore_DDBinderTrackingNumberKey(), type, 0) == kCFCompareEqualTo))
- || ((detectionTypes & DataDetectorTypeFlight) && (CFStringCompare(get_DataDetectorsCore_DDBinderFlightInformationKey(), type, 0) == kCFCompareEqualTo))
+ || ((detectionTypes & DataDetectorTypeFlightNumber) && (CFStringCompare(get_DataDetectorsCore_DDBinderFlightInformationKey(), type, 0) == kCFCompareEqualTo))
+ || ((detectionTypes & DataDetectorTypeSpotlightSuggestion) && (CFStringCompare(DDBinderSpotlightSourceKey, type, 0) == kCFCompareEqualTo))
|| ((detectionTypes & DataDetectorTypePhoneNumber) && (DDResultCategoryPhoneNumber == category))
|| ((detectionTypes & DataDetectorTypeLink) && resultIsURL(currentResult))) {
@@ -427,6 +429,9 @@
RetainPtr<DDScanQueryRef> scanQuery = adoptCF(softLink_DataDetectorsCore_DDScanQueryCreate(NULL));
buildQuery(scanQuery.get(), contextRange.get());
+ if (types & DataDetectorTypeSpotlightSuggestion)
+ 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()))
return nil;
Modified: trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.h (197975 => 197976)
--- trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.h 2016-03-11 01:03:38 UTC (rev 197975)
+++ trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.h 2016-03-11 01:06:48 UTC (rev 197976)
@@ -36,6 +36,7 @@
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, DDScannerEnableOptionalSource, void, (DDScannerRef scanner, DDScannerSource source, Boolean enable), (scanner, source, enable))
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))
Modified: trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.mm (197975 => 197976)
--- trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.mm 2016-03-11 01:03:38 UTC (rev 197975)
+++ trunk/Source/WebCore/platform/cocoa/DataDetectorsCoreSoftLink.mm 2016-03-11 01:06:48 UTC (rev 197976)
@@ -35,6 +35,7 @@
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, DDScannerEnableOptionalSource, void, (DDScannerRef scanner, DDScannerSource source, Boolean enable), (scanner, source, enable))
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))
Modified: trunk/Source/WebCore/platform/spi/cocoa/DataDetectorsCoreSPI.h (197975 => 197976)
--- trunk/Source/WebCore/platform/spi/cocoa/DataDetectorsCoreSPI.h 2016-03-11 01:03:38 UTC (rev 197975)
+++ trunk/Source/WebCore/platform/spi/cocoa/DataDetectorsCoreSPI.h 2016-03-11 01:06:48 UTC (rev 197976)
@@ -32,6 +32,7 @@
#import <DataDetectorsCore/DDScannerResult.h>
#import <DataDetectorsCore/DataDetectorsCore.h>
#if PLATFORM(IOS)
+#import <DataDetectorsCore/DDOptionalSource.h>
#import <DataDetectorsCore/DDURLifier.h>
#endif
#else // !USE(APPLE_INTERNAL_SDK)
@@ -48,6 +49,8 @@
DDScannerCopyResultsOptionsCoalesceSignatures = 1 << 1,
};
+typedef CFIndex DDScannerSource;
+
enum {
DDURLifierPhoneNumberDetectionNone = 0,
DDURLifierPhoneNumberDetectionRegular = 1 << 1,
@@ -113,6 +116,10 @@
typedef CFIndex DDScannerCopyResultsOptions;
typedef CFIndex DDScannerOptions;
+enum {
+ DDScannerSourceSpotlight = 1<<1,
+};
+
extern "C" {
extern const DDScannerCopyResultsOptions DDScannerCopyResultsOptionsForPassiveUse;
Modified: trunk/Source/WebKit2/ChangeLog (197975 => 197976)
--- trunk/Source/WebKit2/ChangeLog 2016-03-11 01:03:38 UTC (rev 197975)
+++ trunk/Source/WebKit2/ChangeLog 2016-03-11 01:06:48 UTC (rev 197976)
@@ -1,3 +1,18 @@
+2016-03-10 Enrica Casucci <[email protected]>
+
+ Expose additional WKDataDetectorTypes.
+ https://bugs.webkit.org/show_bug.cgi?id=155331
+ rdar://problem/24175813
+
+ Reviewed by Tim Horton.
+
+ Adding API to enable data detection of tracking numbers,
+ flight number and spotlight suggestions.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (fromWKDataDetectorTypes):
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
+
2016-03-10 Beth Dakin <[email protected]>
defaultActions in UIDelegate method
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (197975 => 197976)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-03-11 01:03:38 UTC (rev 197975)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-03-11 01:06:48 UTC (rev 197976)
@@ -333,7 +333,13 @@
value |= WebCore::DataDetectorTypeAddress;
if (types & WKDataDetectorTypeCalendarEvent)
value |= WebCore::DataDetectorTypeCalendarEvent;
-
+ if (types & WKDataDetectorTypeTrackingNumber)
+ value |= WebCore::DataDetectorTypeTrackingNumber;
+ if (types & WKDataDetectorTypeFlightNumber)
+ value |= WebCore::DataDetectorTypeFlightNumber;
+ if (types & WKDataDetectorTypeSpotlightSuggestion)
+ value |= WebCore::DataDetectorTypeSpotlightSuggestion;
+
return static_cast<WebCore::DataDetectorTypes>(value);
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h (197975 => 197976)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h 2016-03-11 01:03:38 UTC (rev 197975)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h 2016-03-11 01:06:48 UTC (rev 197976)
@@ -67,6 +67,9 @@
WKDataDetectorTypeLink = 1 << 1,
WKDataDetectorTypeAddress = 1 << 2,
WKDataDetectorTypeCalendarEvent = 1 << 3,
+ WKDataDetectorTypeTrackingNumber = 1 << 4,
+ WKDataDetectorTypeFlightNumber = 1 << 5,
+ WKDataDetectorTypeSpotlightSuggestion = 1 << 6,
WKDataDetectorTypeAll = NSUIntegerMax
} WK_ENUM_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);