Modified: trunk/Source/WebKit2/ChangeLog (200667 => 200668)
--- trunk/Source/WebKit2/ChangeLog 2016-05-11 02:04:19 UTC (rev 200667)
+++ trunk/Source/WebKit2/ChangeLog 2016-05-11 03:37:30 UTC (rev 200668)
@@ -1,5 +1,21 @@
2016-05-10 Sam Weinig <[email protected]>
+ Only expose WKDataDetectorTypes and -[WKWebViewConfiguration dataDetectorTypes] on iOS
+ for now, since we don't have it fully implemented on Mac.
+
+ Reviewed by Tim Horton.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (fromWKDataDetectorTypes):
+ (-[WKWebView _initializeWithConfiguration:]):
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+ (-[WKWebViewConfiguration encodeWithCoder:]):
+ (-[WKWebViewConfiguration initWithCoder:]):
+ (-[WKWebViewConfiguration copyWithZone:]):
+
+2016-05-10 Sam Weinig <[email protected]>
+
Add SPI for Data Detectors to get ranges of text around an existing range.
<rdar://problem/26009749>
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (200667 => 200668)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-05-11 02:04:19 UTC (rev 200667)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-05-11 03:37:30 UTC (rev 200668)
@@ -333,7 +333,7 @@
#endif
-#if ENABLE(DATA_DETECTION)
+#if ENABLE(DATA_DETECTION) && PLATFORM(IOS)
static WebCore::DataDetectorTypes fromWKDataDetectorTypes(uint64_t types)
{
if (static_cast<WKDataDetectorTypes>(types) == WKDataDetectorTypeNone)
@@ -471,7 +471,7 @@
pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::attachmentElementEnabledKey(), WebKit::WebPreferencesStore::Value(WebCore::MacApplication::isAppleMail() ? true : !![_configuration _attachmentElementEnabled]));
#endif
-#if ENABLE(DATA_DETECTION)
+#if ENABLE(DATA_DETECTION) && PLATFORM(IOS)
pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::dataDetectorTypesKey(), WebKit::WebPreferencesStore::Value(static_cast<uint32_t>(fromWKDataDetectorTypes([_configuration dataDetectorTypes]))));
#endif
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h (200667 => 200668)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h 2016-05-11 02:04:19 UTC (rev 200667)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h 2016-05-11 03:37:30 UTC (rev 200668)
@@ -51,26 +51,6 @@
WKSelectionGranularityCharacter,
} WK_ENUM_AVAILABLE_IOS(8_0);
-#else
-
-/*! @enum WKUserInterfaceDirectionPolicy
- @abstract The policy used to determine the directionality of user interface elements inside a web view.
- @constant WKUserInterfaceDirectionPolicyContent User interface directionality follows CSS / HTML / XHTML
- specifications.
- @constant WKUserInterfaceDirectionPolicySystem User interface directionality follows the view's
- userInterfaceLayoutDirection property
- @discussion When WKUserInterfaceDirectionPolicyContent is specified, the directionality of user interface
- elements is affected by the "dir" attribute or the "direction" CSS property. When
- WKUserInterfaceDirectionPolicySystem is specified, the directionaltiy of user interface elements is
- affected by the direction of the view.
-*/
-typedef NS_ENUM(NSInteger, WKUserInterfaceDirectionPolicy) {
- WKUserInterfaceDirectionPolicyContent,
- WKUserInterfaceDirectionPolicySystem,
-} WK_ENUM_AVAILABLE(WK_MAC_TBA, NA);
-
-#endif
-
/*! @enum WKDataDetectorTypes
@abstract The type of data detected.
@constant WKDataDetectorTypeNone No detection is performed.
@@ -91,8 +71,28 @@
WKDataDetectorTypeFlightNumber = 1 << 5,
WKDataDetectorTypeSpotlightSuggestion = 1 << 6,
WKDataDetectorTypeAll = NSUIntegerMax
-} WK_ENUM_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+} WK_ENUM_AVAILABLE(NA, WK_IOS_TBA);
+#else
+
+/*! @enum WKUserInterfaceDirectionPolicy
+ @abstract The policy used to determine the directionality of user interface elements inside a web view.
+ @constant WKUserInterfaceDirectionPolicyContent User interface directionality follows CSS / HTML / XHTML
+ specifications.
+ @constant WKUserInterfaceDirectionPolicySystem User interface directionality follows the view's
+ userInterfaceLayoutDirection property
+ @discussion When WKUserInterfaceDirectionPolicyContent is specified, the directionality of user interface
+ elements is affected by the "dir" attribute or the "direction" CSS property. When
+ WKUserInterfaceDirectionPolicySystem is specified, the directionaltiy of user interface elements is
+ affected by the direction of the view.
+*/
+typedef NS_ENUM(NSInteger, WKUserInterfaceDirectionPolicy) {
+ WKUserInterfaceDirectionPolicyContent,
+ WKUserInterfaceDirectionPolicySystem,
+} WK_ENUM_AVAILABLE(WK_MAC_TBA, NA);
+
+#endif
+
/*! A WKWebViewConfiguration object is a collection of properties with
which to initialize a web view.
@helps Contains properties used to configure a @link WKWebView @/link.
@@ -135,15 +135,6 @@
*/
@property (nonatomic) BOOL allowsAirPlayForMediaPlayback WK_AVAILABLE(10_11, 9_0);
-/*! @abstract An enum value indicating the type of data detection desired.
- @discussion The default value is WKDataDetectorTypeNone.
- An example of how this property may affect the content loaded in the WKWebView is that content like
- 'Visit apple.com on July 4th or call 1 800 555-5545' will be transformed to add links around 'apple.com', 'July 4th' and '1 800 555-5545'
- if the dataDetectorTypes property is set to WKDataDetectorTypePhoneNumber | WKDataDetectorTypeLink | WKDataDetectorTypeCalendarEvent.
-
- */
-@property (nonatomic) WKDataDetectorTypes dataDetectorTypes WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
-
#if TARGET_OS_IPHONE
/*! @abstract A Boolean value indicating whether HTML5 videos play inline
(YES) or use the native full-screen controller (NO).
@@ -170,6 +161,15 @@
*/
@property (nonatomic) BOOL allowsPictureInPictureMediaPlayback WK_AVAILABLE(NA, 9_0);
+/*! @abstract An enum value indicating the type of data detection desired.
+ @discussion The default value is WKDataDetectorTypeNone.
+ An example of how this property may affect the content loaded in the WKWebView is that content like
+ 'Visit apple.com on July 4th or call 1 800 555-5545' will be transformed to add links around 'apple.com', 'July 4th' and '1 800 555-5545'
+ if the dataDetectorTypes property is set to WKDataDetectorTypePhoneNumber | WKDataDetectorTypeLink | WKDataDetectorTypeCalendarEvent.
+
+ */
+@property (nonatomic) WKDataDetectorTypes dataDetectorTypes WK_AVAILABLE(NA, WK_IOS_TBA);
+
#else
/*! @abstract The directionality of user interface elements.
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (200667 => 200668)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2016-05-11 02:04:19 UTC (rev 200667)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2016-05-11 03:37:30 UTC (rev 200668)
@@ -198,9 +198,9 @@
[coder encodeBool:self.suppressesIncrementalRendering forKey:@"suppressesIncrementalRendering"];
[coder encodeObject:self.applicationNameForUserAgent forKey:@"applicationNameForUserAgent"];
[coder encodeBool:self.allowsAirPlayForMediaPlayback forKey:@"allowsAirPlayForMediaPlayback"];
- [coder encodeInteger:self.dataDetectorTypes forKey:@"dataDetectorTypes"];
#if PLATFORM(IOS)
+ [coder encodeInteger:self.dataDetectorTypes forKey:@"dataDetectorTypes"];
[coder encodeBool:self.allowsInlineMediaPlayback forKey:@"allowsInlineMediaPlayback"];
[coder encodeBool:self.requiresUserActionForMediaPlayback forKey:@"requiresUserActionForMediaPlayback"];
[coder encodeInteger:self.selectionGranularity forKey:@"selectionGranularity"];
@@ -223,9 +223,9 @@
self.suppressesIncrementalRendering = [coder decodeBoolForKey:@"suppressesIncrementalRendering"];
self.applicationNameForUserAgent = [coder decodeObjectForKey:@"applicationNameForUserAgent"];
self.allowsAirPlayForMediaPlayback = [coder decodeBoolForKey:@"allowsAirPlayForMediaPlayback"];
- self.dataDetectorTypes = [coder decodeIntegerForKey:@"dataDetectorTypes"];
#if PLATFORM(IOS)
+ self.dataDetectorTypes = [coder decodeIntegerForKey:@"dataDetectorTypes"];
self.allowsInlineMediaPlayback = [coder decodeBoolForKey:@"allowsInlineMediaPlayback"];
self.requiresUserActionForMediaPlayback = [coder decodeBoolForKey:@"requiresUserActionForMediaPlayback"];
self.selectionGranularity = static_cast<WKSelectionGranularity>([coder decodeIntegerForKey:@"selectionGranularity"]);
@@ -287,7 +287,7 @@
configuration->_serviceControlsEnabled = self->_serviceControlsEnabled;
configuration->_imageControlsEnabled = self->_imageControlsEnabled;
#endif
-#if ENABLE(DATA_DETECTION)
+#if ENABLE(DATA_DETECTION) && PLATFORM(IOS)
configuration->_dataDetectorTypes = self->_dataDetectorTypes;
#endif
#if ENABLE(WIRELESS_TARGET_PLAYBACK)