Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (195299 => 195300)
--- trunk/Source/_javascript_Core/ChangeLog 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-01-19 19:34:20 UTC (rev 195300)
@@ -1,3 +1,15 @@
+2016-01-19 Enrica Casucci <[email protected]>
+
+ Add support for DataDetectors in WK (iOS).
+ https://bugs.webkit.org/show_bug.cgi?id=152989
+ rdar://problem/22855960
+
+ Reviewed by Tim Horton.
+
+ Adding feature definition.
+
+ * Configurations/FeatureDefines.xcconfig:
+
2016-01-17 Filip Pizlo <[email protected]>
FTL B3 should be just as fast as FTL LLVM on Octane/crypto
Modified: trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig (195299 => 195300)
--- trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig 2016-01-19 19:34:20 UTC (rev 195300)
@@ -111,6 +111,7 @@
ENABLE_MAC_GESTURE_EVENTS_macosx_WITH_INTERNAL_SDK_YES = ENABLE_MAC_GESTURE_EVENTS;
ENABLE_IOS_TEXT_AUTOSIZING[sdk=iphone*] = ENABLE_IOS_TEXT_AUTOSIZING;
+ENABLE_DATA_DETECTION = ENABLE_DATA_DETECTION;
ENABLE_IOS_TOUCH_EVENTS[sdk=iphone*] = $(ENABLE_IOS_TOUCH_EVENTS_ios_WITH_INTERNAL_SDK_$(USE_INTERNAL_SDK));
ENABLE_IOS_TOUCH_EVENTS_ios_WITH_INTERNAL_SDK_YES = ENABLE_IOS_TOUCH_EVENTS;
Modified: trunk/Source/WTF/ChangeLog (195299 => 195300)
--- trunk/Source/WTF/ChangeLog 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WTF/ChangeLog 2016-01-19 19:34:20 UTC (rev 195300)
@@ -1,3 +1,15 @@
+2016-01-19 Enrica Casucci <[email protected]>
+
+ Add support for DataDetectors in WK (iOS).
+ https://bugs.webkit.org/show_bug.cgi?id=152989
+ rdar://problem/22855960
+
+ Reviewed by Tim Horton.
+
+ Adding feature definition for data detection.
+
+ * wtf/FeatureDefines.h:
+
2016-01-17 Filip Pizlo <[email protected]>
FTL B3 should be just as fast as FTL LLVM on Octane/crypto
Modified: trunk/Source/WTF/wtf/FeatureDefines.h (195299 => 195300)
--- trunk/Source/WTF/wtf/FeatureDefines.h 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WTF/wtf/FeatureDefines.h 2016-01-19 19:34:20 UTC (rev 195300)
@@ -272,6 +272,14 @@
#endif /* PLATFORM(MAC) */
+#if PLATFORM(COCOA)
+
+#if !defined(ENABLE_DATA_DETECTION)
+#define ENABLE_DATA_DETECTION 1
+#endif
+
+#endif /* PLATFORM(COCOA) */
+
/* --------- Apple Windows port --------- */
#if PLATFORM(WIN) && !PLATFORM(WIN_CAIRO)
Modified: trunk/Source/WebCore/ChangeLog (195299 => 195300)
--- trunk/Source/WebCore/ChangeLog 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebCore/ChangeLog 2016-01-19 19:34:20 UTC (rev 195300)
@@ -1,3 +1,32 @@
+2016-01-19 Enrica Casucci <[email protected]>
+
+ Add support for DataDetectors in WK (iOS).
+ https://bugs.webkit.org/show_bug.cgi?id=152989
+ rdar://problem/22855960
+
+ Reviewed by Tim Horton.
+
+ This is the first step toward implementing Data Detectors support
+ in WK2. The patch adds a new memeber to the Settings object
+ to retrieve the type of detection desired. The DataDetection files
+ have been moved under cocoa, since they are no longer OS X specific.
+
+ * Configurations/FeatureDefines.xcconfig:
+ * Configurations/WebCore.xcconfig:
+ * WebCore.xcodeproj/project.pbxproj:
+ * editing/cocoa/DataDetection.h: Copied from Source/WebCore/editing/mac/DataDetection.h.
+ * editing/cocoa/DataDetection.mm: Copied from Source/WebCore/editing/mac/DataDetection.mm.
+ (WebCore::detectItemAtPositionWithRange):
+ (WebCore::DataDetection::detectItemAroundHitTestResult):
+ (WebCore::DataDetection::detectContentInRange):
+ * editing/mac/DataDetection.h: Removed.
+ * editing/mac/DataDetection.mm: Removed.
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
+ * page/Settings.h:
+ * page/Settings.in:
+ * platform/spi/mac/DataDetectorsSPI.h:
+
2016-01-19 Chris Dumez <[email protected]>
Unreviewed, fix typo in comment added in r195157.
Modified: trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig (195299 => 195300)
--- trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig 2016-01-19 19:34:20 UTC (rev 195300)
@@ -111,6 +111,7 @@
ENABLE_MAC_GESTURE_EVENTS_macosx_WITH_INTERNAL_SDK_YES = ENABLE_MAC_GESTURE_EVENTS;
ENABLE_IOS_TEXT_AUTOSIZING[sdk=iphone*] = ENABLE_IOS_TEXT_AUTOSIZING;
+ENABLE_DATA_DETECTION = ENABLE_DATA_DETECTION;
ENABLE_IOS_TOUCH_EVENTS[sdk=iphone*] = $(ENABLE_IOS_TOUCH_EVENTS_ios_WITH_INTERNAL_SDK_$(USE_INTERNAL_SDK));
ENABLE_IOS_TOUCH_EVENTS_ios_WITH_INTERNAL_SDK_YES = ENABLE_IOS_TOUCH_EVENTS;
Modified: trunk/Source/WebCore/Configurations/WebCore.xcconfig (195299 => 195300)
--- trunk/Source/WebCore/Configurations/WebCore.xcconfig 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebCore/Configurations/WebCore.xcconfig 2016-01-19 19:34:20 UTC (rev 195300)
@@ -50,7 +50,7 @@
UNEXPORTED_SYMBOLS_FILE = Configurations/WebCore.unexp;
OTHER_LDFLAGS = $(inherited) $(OTHER_LDFLAGS_PLATFORM);
OTHER_LDFLAGS_BASE = -lsqlite3 -lobjc -lANGLE;
-OTHER_LDFLAGS_BASE_ios = $(OTHER_LDFLAGS_BASE) -framework CFNetwork -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -framework OpenGLES -lMobileGestalt;
+OTHER_LDFLAGS_BASE_ios = $(OTHER_LDFLAGS_BASE) -framework CFNetwork -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -framework OpenGLES -lMobileGestalt -framework DataDetectorsCore;
OTHER_LDFLAGS_PLATFORM[sdk=iphoneos*] = $(OTHER_LDFLAGS_BASE_ios) -framework IOSurface;
OTHER_LDFLAGS_PLATFORM[sdk=iphonesimulator*] = $(OTHER_LDFLAGS_BASE_ios);
OTHER_LDFLAGS_PLATFORM[sdk=macosx*] = $(OTHER_LDFLAGS_BASE) -sub_library libobjc -umbrella WebKit -allowable_client WebCoreTestSupport -allowable_client WebKit2 -allowable_client WebKitLegacy -framework ApplicationServices -framework AudioUnit -framework Carbon -framework Cocoa -framework DataDetectorsCore -framework IOSurface -framework OpenGL;
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (195299 => 195300)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-01-19 19:34:20 UTC (rev 195300)
@@ -1137,8 +1137,6 @@
2D5002FC1B56D7990020AAF7 /* PathUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D5002FA1B56D7990020AAF7 /* PathUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D5036681BCDDDC400E20BB3 /* GestureEvents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D5036671BCDDDC400E20BB3 /* GestureEvents.cpp */; };
2D5646B01B8F8493003C4994 /* DictionaryPopupInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D5646AF1B8F8493003C4994 /* DictionaryPopupInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 2D58D8551A15F65F00A5F726 /* DataDetection.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D58D8531A15F65F00A5F726 /* DataDetection.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 2D58D8561A15F65F00A5F726 /* DataDetection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D58D8541A15F65F00A5F726 /* DataDetection.mm */; };
2D59F1BF1A0044C6001F3D29 /* DataDetectorsSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D59F1BE1A0044C6001F3D29 /* DataDetectorsSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D5A592F152525230036EE51 /* ImageOrientation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8748D7412CC3F89001FBA41 /* ImageOrientation.cpp */; };
2D5A5931152525D00036EE51 /* ImageOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = A8748D6612CC3763001FBA41 /* ImageOrientation.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5882,6 +5880,8 @@
C50D0E830FF4272900AC2644 /* StorageNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = C50D0E810FF4272900AC2644 /* StorageNamespace.h */; settings = {ATTRIBUTES = (Private, ); }; };
C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5137CF011A58378004ADB99 /* JSDOMStringList.cpp */; };
C5137CF311A58378004ADB99 /* JSDOMStringList.h in Headers */ = {isa = PBXBuildFile; fileRef = C5137CF111A58378004ADB99 /* JSDOMStringList.h */; };
+ C5227DF11C3C6DF100F5ED54 /* DataDetection.h in Headers */ = {isa = PBXBuildFile; fileRef = C5227DEF1C3C6DD700F5ED54 /* DataDetection.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ C5227DF21C3C6DF900F5ED54 /* DataDetection.mm in Sources */ = {isa = PBXBuildFile; fileRef = C5227DF01C3C6DD700F5ED54 /* DataDetection.mm */; };
C5278B0C17F212EA003A2998 /* PlatformPasteboardIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = C5278B0B17F212EA003A2998 /* PlatformPasteboardIOS.mm */; };
C544274B11A57E7A0063A749 /* DOMStringList.h in Headers */ = {isa = PBXBuildFile; fileRef = C544274911A57E7A0063A749 /* DOMStringList.h */; settings = {ATTRIBUTES = (Private, ); }; };
C55610F111A704EB00B82D27 /* DOMStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C55610F011A704EB00B82D27 /* DOMStringList.cpp */; };
@@ -8512,8 +8512,6 @@
2D5002FA1B56D7990020AAF7 /* PathUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PathUtilities.h; sourceTree = "<group>"; };
2D5036671BCDDDC400E20BB3 /* GestureEvents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GestureEvents.cpp; sourceTree = "<group>"; };
2D5646AF1B8F8493003C4994 /* DictionaryPopupInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DictionaryPopupInfo.h; sourceTree = "<group>"; };
- 2D58D8531A15F65F00A5F726 /* DataDetection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataDetection.h; sourceTree = "<group>"; };
- 2D58D8541A15F65F00A5F726 /* DataDetection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataDetection.mm; sourceTree = "<group>"; };
2D59F1BE1A0044C6001F3D29 /* DataDetectorsSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataDetectorsSPI.h; sourceTree = "<group>"; };
2D5BC42516F882BE007048D0 /* SecurityPolicyViolationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecurityPolicyViolationEvent.h; sourceTree = "<group>"; };
2D5BC42616F882BE007048D0 /* SecurityPolicyViolationEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SecurityPolicyViolationEvent.idl; sourceTree = "<group>"; };
@@ -13711,6 +13709,8 @@
C50D0E810FF4272900AC2644 /* StorageNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageNamespace.h; sourceTree = "<group>"; };
C5137CF011A58378004ADB99 /* JSDOMStringList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMStringList.cpp; sourceTree = "<group>"; };
C5137CF111A58378004ADB99 /* JSDOMStringList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMStringList.h; sourceTree = "<group>"; };
+ C5227DEF1C3C6DD700F5ED54 /* DataDetection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataDetection.h; sourceTree = "<group>"; };
+ C5227DF01C3C6DD700F5ED54 /* DataDetection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataDetection.mm; sourceTree = "<group>"; };
C5278B0B17F212EA003A2998 /* PlatformPasteboardIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformPasteboardIOS.mm; sourceTree = "<group>"; };
C544274911A57E7A0063A749 /* DOMStringList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMStringList.h; sourceTree = "<group>"; };
C544274A11A57E7A0063A749 /* DOMStringList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMStringList.idl; sourceTree = "<group>"; };
@@ -17881,6 +17881,8 @@
7C3E510718DF8F1200C112F7 /* cocoa */ = {
isa = PBXGroup;
children = (
+ C5227DEF1C3C6DD700F5ED54 /* DataDetection.h */,
+ C5227DF01C3C6DD700F5ED54 /* DataDetection.mm */,
9B55EEEA1B3F3FEF005342BC /* EditorCocoa.h */,
9B55EEE81B3E8898005342BC /* EditorCocoa.mm */,
7C3E510818DF8F3500C112F7 /* HTMLConverter.h */,
@@ -23185,8 +23187,6 @@
children = (
CE7B2DAF1586ABAD0098B3FA /* AlternativeTextUIController.h */,
CE7B2DB01586ABAD0098B3FA /* AlternativeTextUIController.mm */,
- 2D58D8531A15F65F00A5F726 /* DataDetection.h */,
- 2D58D8541A15F65F00A5F726 /* DataDetection.mm */,
937FF3D41A1012D6008EBA31 /* DictionaryLookup.h */,
937FF3D61A10131B008EBA31 /* DictionaryLookup.mm */,
ED501DC50B249F2900AE18D9 /* EditorMac.mm */,
@@ -25062,7 +25062,6 @@
97BC6A301505F081001B74AC /* DatabaseThread.h in Headers */,
97BC6A321505F081001B74AC /* DatabaseTracker.h in Headers */,
BE23480D18A9871400E4B6E8 /* DataCue.h in Headers */,
- 2D58D8551A15F65F00A5F726 /* DataDetection.h in Headers */,
935E2B4E1AFF06CA00976F9F /* DataDetectorsCoreSPI.h in Headers */,
2D59F1BF1A0044C6001F3D29 /* DataDetectorsSPI.h in Headers */,
BC22746F0E83664500E7F975 /* DataRef.h in Headers */,
@@ -26034,6 +26033,7 @@
B27535750B053814002CE64F /* IntSize.h in Headers */,
B27535760B053814002CE64F /* IntSizeHash.h in Headers */,
CE12524D1A1A77DE00864480 /* IOPMLibSPI.h in Headers */,
+ C5227DF11C3C6DF100F5ED54 /* DataDetection.h in Headers */,
44DEF6431A6FF92700D45EEC /* IOReturnSPI.h in Headers */,
2D0B4AAB18DA1CCD00434DE1 /* IOSurface.h in Headers */,
1C21E57D183ED1FF001C289D /* IOSurfacePool.h in Headers */,
@@ -28740,6 +28740,7 @@
85031B3F0A44EFC700F992E0 /* ClipboardEvent.cpp in Sources */,
580371611A66F00A00BAF519 /* ClipRect.cpp in Sources */,
CDEA76351460B71A008B31F1 /* Clock.cpp in Sources */,
+ C5227DF21C3C6DF900F5ED54 /* DataDetection.mm in Sources */,
CDEA76341460B56F008B31F1 /* ClockGeneric.cpp in Sources */,
9BD8A95A18BEFC7600987E9A /* CollectionIndexCache.cpp in Sources */,
B27535660B053814002CE64F /* Color.cpp in Sources */,
@@ -28918,7 +28919,6 @@
97BC6A2F1505F081001B74AC /* DatabaseThread.cpp in Sources */,
97BC6A311505F081001B74AC /* DatabaseTracker.cpp in Sources */,
BE23480C18A9870B00E4B6E8 /* DataCue.cpp in Sources */,
- 2D58D8561A15F65F00A5F726 /* DataDetection.mm in Sources */,
BC64641D11D7F416006455B0 /* DatasetDOMStringMap.cpp in Sources */,
A784941B0B5FE507001E237A /* DataTransfer.cpp in Sources */,
93F19AFF08245E59001E9ABC /* DataTransferMac.mm in Sources */,
Copied: trunk/Source/WebCore/editing/cocoa/DataDetection.h (from rev 194591, trunk/Source/WebCore/editing/mac/DataDetection.h) (0 => 195300)
--- trunk/Source/WebCore/editing/cocoa/DataDetection.h (rev 0)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.h 2016-01-19 19:34:20 UTC (rev 195300)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2014 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.
+ */
+
+#ifndef DataDetection_h
+#define DataDetection_h
+
+#import <wtf/RefPtr.h>
+#import <wtf/RetainPtr.h>
+
+OBJC_CLASS DDActionContext;
+
+namespace WebCore {
+
+class FloatRect;
+class HitTestResult;
+class Range;
+
+enum DataDetectorTypes {
+ DataDetectorTypeNone = 0,
+ DataDetectorTypePhoneNumber = 1 << 0,
+ DataDetectorTypeLink = 1 << 1,
+ DataDetectorTypeAddress = 1 << 2,
+ DataDetectorTypeCalendarEvent = 1 << 3,
+ DataDetectorTypeAll = ULONG_MAX
+};
+
+class DataDetection {
+public:
+#if PLATFORM(MAC)
+ WEBCORE_EXPORT static RetainPtr<DDActionContext> detectItemAroundHitTestResult(const HitTestResult&, FloatRect& detectedDataBoundingBox, RefPtr<Range>& detectedDataRange);
+#endif
+ WEBCORE_EXPORT static void detectContentInRange(RefPtr<Range>& contextRange, DataDetectorTypes);
+};
+
+} // namespace WebCore
+
+#endif // DataDetection_h
Copied: trunk/Source/WebCore/editing/cocoa/DataDetection.mm (from rev 194591, trunk/Source/WebCore/editing/mac/DataDetection.mm) (0 => 195300)
--- trunk/Source/WebCore/editing/cocoa/DataDetection.mm (rev 0)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2016-01-19 19:34:20 UTC (rev 195300)
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2014 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. ``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
+ * 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 "DataDetection.h"
+
+#import "Attr.h"
+#import "CSSStyleDeclaration.h"
+#import "DataDetectorsSPI.h"
+#import "FrameView.h"
+#import "HTMLAnchorElement.h"
+#import "HTMLTextFormControlElement.h"
+#import "HitTestResult.h"
+#import "Node.h"
+#import "NodeList.h"
+#import "NodeTraversal.h"
+#import "Range.h"
+#import "RenderObject.h"
+#import "Text.h"
+#import "TextIterator.h"
+#import "VisiblePosition.h"
+#import "VisibleUnits.h"
+#import "htmlediting.h"
+
+namespace WebCore {
+
+#if PLATFORM(MAC)
+
+static RetainPtr<DDActionContext> detectItemAtPositionWithRange(VisiblePosition position, RefPtr<Range> contextRange, FloatRect& detectedDataBoundingBox, RefPtr<Range>& detectedDataRange)
+{
+ String fullPlainTextString = plainText(contextRange.get());
+ int hitLocation = TextIterator::rangeLength(makeRange(contextRange->startPosition(), position).get());
+
+ RetainPtr<DDScannerRef> scanner = adoptCF(DDScannerCreate(DDScannerTypeStandard, 0, nullptr));
+ RetainPtr<DDScanQueryRef> scanQuery = adoptCF(DDScanQueryCreateFromString(kCFAllocatorDefault, fullPlainTextString.createCFString().get(), CFRangeMake(0, fullPlainTextString.length())));
+
+ if (!DDScannerScanQuery(scanner.get(), scanQuery.get()))
+ return nullptr;
+
+ RetainPtr<CFArrayRef> results = adoptCF(DDScannerCopyResultsWithOptions(scanner.get(), DDScannerCopyResultsOptionsNoOverlap));
+
+ // Find the DDResultRef that intersects the hitTestResult's VisiblePosition.
+ DDResultRef mainResult = nullptr;
+ RefPtr<Range> mainResultRange;
+ CFIndex resultCount = CFArrayGetCount(results.get());
+ for (CFIndex i = 0; i < resultCount; i++) {
+ DDResultRef result = (DDResultRef)CFArrayGetValueAtIndex(results.get(), i);
+ CFRange resultRangeInContext = DDResultGetRange(result);
+ if (hitLocation >= resultRangeInContext.location && (hitLocation - resultRangeInContext.location) < resultRangeInContext.length) {
+ mainResult = result;
+ mainResultRange = TextIterator::subrange(contextRange.get(), resultRangeInContext.location, resultRangeInContext.length);
+ break;
+ }
+ }
+
+ if (!mainResult)
+ return nullptr;
+
+ RetainPtr<DDActionContext> actionContext = adoptNS([allocDDActionContextInstance() init]);
+ [actionContext setAllResults:@[ (id)mainResult ]];
+ [actionContext setMainResult:mainResult];
+
+ Vector<FloatQuad> quads;
+ mainResultRange->absoluteTextQuads(quads);
+ detectedDataBoundingBox = FloatRect();
+ FrameView* frameView = mainResultRange->ownerDocument().view();
+ for (const auto& quad : quads)
+ detectedDataBoundingBox.unite(frameView->contentsToWindow(quad.enclosingBoundingBox()));
+
+ detectedDataRange = mainResultRange;
+
+ return actionContext;
+}
+
+RetainPtr<DDActionContext> DataDetection::detectItemAroundHitTestResult(const HitTestResult& hitTestResult, FloatRect& detectedDataBoundingBox, RefPtr<Range>& detectedDataRange)
+{
+ if (!DataDetectorsLibrary())
+ return nullptr;
+
+ Node* node = hitTestResult.innerNonSharedNode();
+ if (!node)
+ return nullptr;
+ auto renderer = node->renderer();
+ if (!renderer)
+ return nullptr;
+
+ VisiblePosition position;
+ RefPtr<Range> contextRange;
+
+ if (!is<HTMLTextFormControlElement>(*node)) {
+ position = renderer->positionForPoint(hitTestResult.localPoint(), nullptr);
+ if (position.isNull())
+ position = firstPositionInOrBeforeNode(node);
+
+ contextRange = rangeExpandedAroundPositionByCharacters(position, 250);
+ if (!contextRange)
+ return nullptr;
+ } else {
+ Frame* frame = node->document().frame();
+ if (!frame)
+ return nullptr;
+
+ IntPoint framePoint = hitTestResult.roundedPointInInnerNodeFrame();
+ if (!frame->rangeForPoint(framePoint))
+ return nullptr;
+
+ VisiblePosition position = frame->visiblePositionForPoint(framePoint);
+ if (position.isNull())
+ return nullptr;
+
+ contextRange = enclosingTextUnitOfGranularity(position, LineGranularity, DirectionForward);
+ if (!contextRange)
+ return nullptr;
+ }
+
+ return detectItemAtPositionWithRange(position, contextRange, detectedDataBoundingBox, detectedDataRange);
+}
+#endif // PLATFORM(MAC)
+
+void DataDetection::detectContentInRange(RefPtr<Range>&, DataDetectorTypes)
+{
+}
+
+} // namespace WebCore
Deleted: trunk/Source/WebCore/editing/mac/DataDetection.h (195299 => 195300)
--- trunk/Source/WebCore/editing/mac/DataDetection.h 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebCore/editing/mac/DataDetection.h 2016-01-19 19:34:20 UTC (rev 195300)
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2014 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.
- */
-
-#ifndef DataDetection_h
-#define DataDetection_h
-
-#if PLATFORM(MAC)
-
-#import <wtf/RefPtr.h>
-#import <wtf/RetainPtr.h>
-
-OBJC_CLASS DDActionContext;
-
-namespace WebCore {
-
-class FloatRect;
-class HitTestResult;
-class Range;
-
-class DataDetection {
-public:
- WEBCORE_EXPORT static RetainPtr<DDActionContext> detectItemAroundHitTestResult(const HitTestResult&, FloatRect& detectedDataBoundingBox, RefPtr<Range>& detectedDataRange);
-};
-
-} // namespace WebCore
-
-#endif // PLATFORM(MAC)
-
-#endif // DataDetection_h
Deleted: trunk/Source/WebCore/editing/mac/DataDetection.mm (195299 => 195300)
--- trunk/Source/WebCore/editing/mac/DataDetection.mm 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebCore/editing/mac/DataDetection.mm 2016-01-19 19:34:20 UTC (rev 195300)
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2014 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. ``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
- * 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 "DataDetection.h"
-
-#if PLATFORM(MAC)
-
-#import "DataDetectorsSPI.h"
-#import "FrameView.h"
-#import "HTMLTextFormControlElement.h"
-#import "HitTestResult.h"
-#import "Node.h"
-#import "Range.h"
-#import "RenderObject.h"
-#import "TextIterator.h"
-#import "VisiblePosition.h"
-#import "VisibleUnits.h"
-#import "htmlediting.h"
-
-namespace WebCore {
-
-static RetainPtr<DDActionContext> detectItemAtPositionWithRange(VisiblePosition position, RefPtr<Range> contextRange, FloatRect& detectedDataBoundingBox, RefPtr<Range>& detectedDataRange)
-{
- String fullPlainTextString = plainText(contextRange.get());
- int hitLocation = TextIterator::rangeLength(makeRange(contextRange->startPosition(), position).get());
-
- RetainPtr<DDScannerRef> scanner = adoptCF(DDScannerCreate(DDScannerTypeStandard, 0, nullptr));
- RetainPtr<DDScanQueryRef> scanQuery = adoptCF(DDScanQueryCreateFromString(kCFAllocatorDefault, fullPlainTextString.createCFString().get(), CFRangeMake(0, fullPlainTextString.length())));
-
- if (!DDScannerScanQuery(scanner.get(), scanQuery.get()))
- return nullptr;
-
- RetainPtr<CFArrayRef> results = adoptCF(DDScannerCopyResultsWithOptions(scanner.get(), DDScannerCopyResultsOptionsNoOverlap));
-
- // Find the DDResultRef that intersects the hitTestResult's VisiblePosition.
- DDResultRef mainResult = nullptr;
- RefPtr<Range> mainResultRange;
- CFIndex resultCount = CFArrayGetCount(results.get());
- for (CFIndex i = 0; i < resultCount; i++) {
- DDResultRef result = (DDResultRef)CFArrayGetValueAtIndex(results.get(), i);
- CFRange resultRangeInContext = DDResultGetRange(result);
- if (hitLocation >= resultRangeInContext.location && (hitLocation - resultRangeInContext.location) < resultRangeInContext.length) {
- mainResult = result;
- mainResultRange = TextIterator::subrange(contextRange.get(), resultRangeInContext.location, resultRangeInContext.length);
- break;
- }
- }
-
- if (!mainResult)
- return nullptr;
-
- RetainPtr<DDActionContext> actionContext = adoptNS([allocDDActionContextInstance() init]);
- [actionContext setAllResults:@[ (id)mainResult ]];
- [actionContext setMainResult:mainResult];
-
- Vector<FloatQuad> quads;
- mainResultRange->absoluteTextQuads(quads);
- detectedDataBoundingBox = FloatRect();
- FrameView* frameView = mainResultRange->ownerDocument().view();
- for (const auto& quad : quads)
- detectedDataBoundingBox.unite(frameView->contentsToWindow(quad.enclosingBoundingBox()));
-
- detectedDataRange = mainResultRange;
-
- return actionContext;
-}
-
-RetainPtr<DDActionContext> DataDetection::detectItemAroundHitTestResult(const HitTestResult& hitTestResult, FloatRect& detectedDataBoundingBox, RefPtr<Range>& detectedDataRange)
-{
- if (!DataDetectorsLibrary())
- return nullptr;
-
- Node* node = hitTestResult.innerNonSharedNode();
- if (!node)
- return nullptr;
- auto renderer = node->renderer();
- if (!renderer)
- return nullptr;
-
- VisiblePosition position;
- RefPtr<Range> contextRange;
-
- if (!is<HTMLTextFormControlElement>(*node)) {
- position = renderer->positionForPoint(hitTestResult.localPoint(), nullptr);
- if (position.isNull())
- position = firstPositionInOrBeforeNode(node);
-
- contextRange = rangeExpandedAroundPositionByCharacters(position, 250);
- if (!contextRange)
- return nullptr;
- } else {
- Frame* frame = node->document().frame();
- if (!frame)
- return nullptr;
-
- IntPoint framePoint = hitTestResult.roundedPointInInnerNodeFrame();
- if (!frame->rangeForPoint(framePoint))
- return nullptr;
-
- VisiblePosition position = frame->visiblePositionForPoint(framePoint);
- if (position.isNull())
- return nullptr;
-
- contextRange = enclosingTextUnitOfGranularity(position, LineGranularity, DirectionForward);
- if (!contextRange)
- return nullptr;
- }
-
- return detectItemAtPositionWithRange(position, contextRange, detectedDataBoundingBox, detectedDataRange);
-}
-
-} // namespace WebCore
-
-#endif // PLATFORM(MAC)
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (195299 => 195300)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2016-01-19 19:34:20 UTC (rev 195300)
@@ -125,6 +125,10 @@
#include "Archive.h"
#endif
+#if ENABLE(DATA_DETECTION)
+#include "DataDetection.h"
+#endif
+
#if PLATFORM(IOS)
#include "DocumentType.h"
#include "MemoryPressureHandler.h"
@@ -2277,6 +2281,12 @@
} else {
m_client.dispatchDidFinishLoad();
loadingEvent = AXObjectCache::AXLoadingFinished;
+#if ENABLE(DATA_DETECTION)
+ if (m_frame.settings().dataDetectorTypes() != DataDetectorTypeNone) {
+ RefPtr<Range> documentRange = makeRange(firstPositionInNode(m_frame.document()->documentElement()), lastPositionInNode(m_frame.document()->documentElement()));
+ DataDetection::detectContentInRange(documentRange, m_frame.settings().dataDetectorTypes());
+ }
+#endif
}
// Notify accessibility.
Modified: trunk/Source/WebCore/page/Settings.h (195299 => 195300)
--- trunk/Source/WebCore/page/Settings.h 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebCore/page/Settings.h 2016-01-19 19:34:20 UTC (rev 195300)
@@ -42,6 +42,10 @@
#include <wtf/text/AtomicString.h>
#include <wtf/text/AtomicStringHash.h>
+#if ENABLE(DATA_DETECTION)
+#include "DataDetection.h"
+#endif
+
namespace WebCore {
class FontGenericFamilies;
Modified: trunk/Source/WebCore/page/Settings.in (195299 => 195300)
--- trunk/Source/WebCore/page/Settings.in 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebCore/page/Settings.in 2016-01-19 19:34:20 UTC (rev 195300)
@@ -228,6 +228,7 @@
temporaryTileCohortRetentionEnabled initial=true
useImageDocumentForSubframePDF initial=false
+dataDetectorTypes type=DataDetectorTypes, initial=DataDetectorTypeNone, conditional=DATA_DETECTION
# Allow SourceBuffers to store up to 304MB each, enough for approximately five minutes
# of 1080p video and stereo audio.
Modified: trunk/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h (195299 => 195300)
--- trunk/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h 2016-01-19 19:34:20 UTC (rev 195300)
@@ -25,11 +25,12 @@
#import <wtf/Platform.h>
-#if PLATFORM(MAC)
#import <WebCore/DataDetectorsCoreSPI.h>
#import <WebCore/SoftLinking.h>
+#if PLATFORM(MAC)
+
#if USE(APPLE_INTERNAL_SDK)
// Can't include DDAction.h because as of this writing it is a private header that includes a non-private header with an "" include.
Modified: trunk/Source/WebKit/mac/ChangeLog (195299 => 195300)
--- trunk/Source/WebKit/mac/ChangeLog 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebKit/mac/ChangeLog 2016-01-19 19:34:20 UTC (rev 195300)
@@ -1,3 +1,15 @@
+2016-01-19 Enrica Casucci <[email protected]>
+
+ Add support for DataDetectors in WK (iOS).
+ https://bugs.webkit.org/show_bug.cgi?id=152989
+ rdar://problem/22855960
+
+ Reviewed by Tim Horton.
+
+ Adding feature definition for data detection.
+
+ * Configurations/FeatureDefines.xcconfig:
+
2016-01-16 Myles C. Maxfield <[email protected]>
Remove TextRun::allowsRoundingHacks()
Modified: trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig (195299 => 195300)
--- trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig 2016-01-19 19:34:20 UTC (rev 195300)
@@ -111,6 +111,7 @@
ENABLE_MAC_GESTURE_EVENTS_macosx_WITH_INTERNAL_SDK_YES = ENABLE_MAC_GESTURE_EVENTS;
ENABLE_IOS_TEXT_AUTOSIZING[sdk=iphone*] = ENABLE_IOS_TEXT_AUTOSIZING;
+ENABLE_DATA_DETECTION = ENABLE_DATA_DETECTION;
ENABLE_IOS_TOUCH_EVENTS[sdk=iphone*] = $(ENABLE_IOS_TOUCH_EVENTS_ios_WITH_INTERNAL_SDK_$(USE_INTERNAL_SDK));
ENABLE_IOS_TOUCH_EVENTS_ios_WITH_INTERNAL_SDK_YES = ENABLE_IOS_TOUCH_EVENTS;
Modified: trunk/Source/WebKit2/ChangeLog (195299 => 195300)
--- trunk/Source/WebKit2/ChangeLog 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebKit2/ChangeLog 2016-01-19 19:34:20 UTC (rev 195300)
@@ -1,3 +1,30 @@
+2016-01-19 Enrica Casucci <[email protected]>
+
+ Add support for DataDetectors in WK (iOS).
+ https://bugs.webkit.org/show_bug.cgi?id=152989
+ rdar://problem/22855960
+
+ Reviewed by Tim Horton.
+
+ This is the first step toward implementing Data Detectors support
+ in WK2. The patch adds a new property to the configuration
+ object to indicate the type of detection desired and propagates
+ to the WebProcess.
+
+ * Configurations/FeatureDefines.xcconfig:
+ * Shared/WebPreferencesDefinitions.h:
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView initWithFrame:configuration:]):
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.h:
+ * UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
+ (-[WKWebViewConfiguration copyWithZone:]):
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/WebPage/Cocoa/WebPageCocoa.mm: Added.
+ (WebKit::WebPage::fromWKDataDetectorTypes):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::updatePreferences):
+ * WebProcess/WebPage/WebPage.h:
+
2016-01-19 Commit Queue <[email protected]>
Unreviewed, rolling out r187471.
Modified: trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig (195299 => 195300)
--- trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebKit2/Configurations/FeatureDefines.xcconfig 2016-01-19 19:34:20 UTC (rev 195300)
@@ -111,6 +111,7 @@
ENABLE_MAC_GESTURE_EVENTS_macosx_WITH_INTERNAL_SDK_YES = ENABLE_MAC_GESTURE_EVENTS;
ENABLE_IOS_TEXT_AUTOSIZING[sdk=iphone*] = ENABLE_IOS_TEXT_AUTOSIZING;
+ENABLE_DATA_DETECTION = ENABLE_DATA_DETECTION;
ENABLE_IOS_TOUCH_EVENTS[sdk=iphone*] = $(ENABLE_IOS_TOUCH_EVENTS_ios_WITH_INTERNAL_SDK_$(USE_INTERNAL_SDK));
ENABLE_IOS_TOUCH_EVENTS_ios_WITH_INTERNAL_SDK_YES = ENABLE_IOS_TOUCH_EVENTS;
Modified: trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h (195299 => 195300)
--- trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h 2016-01-19 19:34:20 UTC (rev 195300)
@@ -239,6 +239,7 @@
macro(InspectorAttachmentSide, inspectorAttachmentSide, UInt32, uint32_t, 0) \
macro(StorageBlockingPolicy, storageBlockingPolicy, UInt32, uint32_t, WebCore::SecurityOrigin::BlockThirdPartyStorage) \
macro(_javascript_RuntimeFlags, _javascript_RuntimeFlags, UInt32, uint32_t, 0) \
+ macro(DataDetectorTypes, dataDetectorTypes, UInt32, uint32_t, 0) \
\
#define FOR_EACH_WEBKIT_DEBUG_BOOL_PREFERENCE(macro) \
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (195299 => 195300)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-01-19 19:34:20 UTC (rev 195300)
@@ -383,6 +383,9 @@
pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::invisibleAutoplayNotPermittedKey(), WebKit::WebPreferencesStore::Value(!![_configuration _invisibleAutoplayNotPermitted]));
pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::mediaDataLoadsAutomaticallyKey(), WebKit::WebPreferencesStore::Value(!![_configuration _mediaDataLoadsAutomatically]));
#endif
+#if ENABLE(DATA_DETECTION)
+ pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::dataDetectorTypesKey(), WebKit::WebPreferencesStore::Value(static_cast<uint32_t>([_configuration dataDetectorTypes])));
+#endif
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::allowsAirPlayForMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration allowsAirPlayForMediaPlayback]));
#endif
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h (195299 => 195300)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.h 2016-01-19 19:34:20 UTC (rev 195300)
@@ -51,6 +51,25 @@
} WK_ENUM_AVAILABLE_IOS(8_0);
#endif
+/*! @enum WKDataDetectorTypes
+ @abstract The type of detection desired.
+ @constant WKDataDetectorTypeNone No detection is performed.
+ @constant WKDataDetectorTypePhoneNumber Phone numbers are detected and turned into links.
+ @constant WKDataDetectorTypeLink URLs in text are detected and turned into links.
+ @constant WKDataDetectorTypeAddress Addresses are detected and turned into links.
+ @constant WKDataDetectorTypeCalendarEvent Dates and times that are in the future are detected and turned into links.
+ @constant WKDataDetectorTypeAll All of the above data types are turned into links when detected. Choosing this value will
+ automatically include any new detection type that is added.
+ */
+typedef NS_OPTIONS(NSUInteger, WKDataDetectorTypes) {
+ WKDataDetectorTypeNone = 0,
+ WKDataDetectorTypePhoneNumber = 1 << 0,
+ WKDataDetectorTypeLink = 1 << 1,
+ WKDataDetectorTypeAddress = 1 << 2,
+ WKDataDetectorTypeCalendarEvent = 1 << 3,
+ WKDataDetectorTypeAll = NSUIntegerMax
+} WK_ENUM_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+
/*! 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.
@@ -93,6 +112,15 @@
*/
@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).
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm (195299 => 195300)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm 2016-01-19 19:34:20 UTC (rev 195300)
@@ -198,6 +198,9 @@
configuration->_serviceControlsEnabled = self->_serviceControlsEnabled;
configuration->_imageControlsEnabled = self->_imageControlsEnabled;
#endif
+#if ENABLE(DATA_DETECTION)
+ configuration->_dataDetectorTypes = self->_dataDetectorTypes;
+#endif
#if ENABLE(WIRELESS_TARGET_PLAYBACK)
configuration->_allowsAirPlayForMediaPlayback = self->_allowsAirPlayForMediaPlayback;
#endif
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (195299 => 195300)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2016-01-19 19:34:20 UTC (rev 195300)
@@ -1689,6 +1689,7 @@
C54256B818BEC18C00DE4179 /* WKFormPopover.h in Headers */ = {isa = PBXBuildFile; fileRef = C54256B218BEC18B00DE4179 /* WKFormPopover.h */; };
C54256B918BEC18C00DE4179 /* WKFormPopover.mm in Sources */ = {isa = PBXBuildFile; fileRef = C54256B318BEC18B00DE4179 /* WKFormPopover.mm */; };
C54256BA18BEC18C00DE4179 /* WKFormSelectControl.h in Headers */ = {isa = PBXBuildFile; fileRef = C54256B418BEC18C00DE4179 /* WKFormSelectControl.h */; };
+ C554A3131C49C36400A388FE /* WebPageCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = C554A3111C49BCCB00A388FE /* WebPageCocoa.mm */; };
C55CB5B718C269CF00CA81E1 /* WKFormSelectPopover.mm in Sources */ = {isa = PBXBuildFile; fileRef = C57193BA18C149D0002D0F12 /* WKFormSelectPopover.mm */; };
C55CB5B818C2A5D600CA81E1 /* WKFormSelectPicker.mm in Sources */ = {isa = PBXBuildFile; fileRef = C57193B918C149D0002D0F12 /* WKFormSelectPicker.mm */; };
C57193BE18C14A44002D0F12 /* WKFormSelectControl.mm in Sources */ = {isa = PBXBuildFile; fileRef = C57193BD18C14A43002D0F12 /* WKFormSelectControl.mm */; };
@@ -3932,6 +3933,7 @@
C54256B218BEC18B00DE4179 /* WKFormPopover.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKFormPopover.h; path = ios/forms/WKFormPopover.h; sourceTree = "<group>"; };
C54256B318BEC18B00DE4179 /* WKFormPopover.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFormPopover.mm; path = ios/forms/WKFormPopover.mm; sourceTree = "<group>"; };
C54256B418BEC18C00DE4179 /* WKFormSelectControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKFormSelectControl.h; path = ios/forms/WKFormSelectControl.h; sourceTree = "<group>"; };
+ C554A3111C49BCCB00A388FE /* WebPageCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPageCocoa.mm; sourceTree = "<group>"; };
C554FFA212E4E8EA002F22C0 /* WebDragClientMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDragClientMac.mm; sourceTree = "<group>"; };
C57193B918C149D0002D0F12 /* WKFormSelectPicker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFormSelectPicker.mm; path = ios/forms/WKFormSelectPicker.mm; sourceTree = "<group>"; };
C57193BA18C149D0002D0F12 /* WKFormSelectPopover.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFormSelectPopover.mm; path = ios/forms/WKFormSelectPopover.mm; sourceTree = "<group>"; };
@@ -5088,6 +5090,7 @@
children = (
2D29ECCE192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.h */,
2D29ECCF192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.mm */,
+ C554A3111C49BCCB00A388FE /* WebPageCocoa.mm */,
);
path = Cocoa;
sourceTree = "<group>";
@@ -9392,6 +9395,7 @@
2D8786231BDB58FF00D02ABB /* APIUserStyleSheet.cpp in Sources */,
C5E1AFEC16B21012006CC1F2 /* APIWebArchive.mm in Sources */,
C5E1AFEE16B21025006CC1F2 /* APIWebArchiveResource.mm in Sources */,
+ C554A3131C49C36400A388FE /* WebPageCocoa.mm in Sources */,
1A4832C71A9BC13C008B4DFE /* APIWebsiteDataRecord.cpp in Sources */,
1A3635A91A3144A300ED6197 /* APIWebsiteDataStore.cpp in Sources */,
1A3635AD1A3145E500ED6197 /* APIWebsiteDataStoreCocoa.mm in Sources */,
Added: trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (0 => 195300)
--- trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2016-01-19 19:34:20 UTC (rev 195300)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010, 2011, 2012, 2015 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 "WebPage.h"
+
+#import "WKWebViewConfiguration.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+#if ENABLE(DATA_DETECTION)
+DataDetectorTypes WebPage::fromWKDataDetectorTypes(uint32_t types)
+{
+ if (static_cast<WKDataDetectorTypes>(types) == WKDataDetectorTypeNone)
+ return DataDetectorTypeNone;
+ if (static_cast<WKDataDetectorTypes>(types) == WKDataDetectorTypeAll)
+ return DataDetectorTypeAll;
+
+ uint32_t value = DataDetectorTypeNone;
+ if (types & WKDataDetectorTypePhoneNumber)
+ value |= DataDetectorTypePhoneNumber;
+ if (types & WKDataDetectorTypeLink)
+ value |= DataDetectorTypeLink;
+ if (types & WKDataDetectorTypeAddress)
+ value |= DataDetectorTypeAddress;
+ if (types & WKDataDetectorTypeCalendarEvent)
+ value |= DataDetectorTypeCalendarEvent;
+
+ return static_cast<DataDetectorTypes>(value);
+}
+#endif
+
+} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (195299 => 195300)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-01-19 19:34:20 UTC (rev 195300)
@@ -219,6 +219,10 @@
#include "CoordinatedLayerTreeHostMessages.h"
#endif
+#if ENABLE(DATA_DETECTION)
+#include <WebCore/DataDetection.h>
+#endif
+
#if ENABLE(VIDEO) && USE(GSTREAMER)
#include <WebCore/MediaPlayerRequestInstallMissingPluginsCallback.h>
#endif
@@ -2935,6 +2939,9 @@
settings.setUseImageDocumentForSubframePDF(true);
#endif
+#if ENABLE(DATA_DETECTION)
+ settings.setDataDetectorTypes(fromWKDataDetectorTypes(store.getUInt32ValueForKey(WebPreferencesKey::dataDetectorTypesKey())));
+#endif
#if ENABLE(GAMEPAD)
RuntimeEnabledFeatures::sharedFeatures().setGamepadsEnabled(store.getBoolValueForKey(WebPreferencesKey::gamepadsEnabledKey()));
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (195299 => 195300)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-01-19 19:32:06 UTC (rev 195299)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-01-19 19:34:20 UTC (rev 195300)
@@ -91,6 +91,10 @@
#import "WebPageMessages.h"
#endif
+#if ENABLE(DATA_DETECTION)
+#include <WebCore/DataDetection.h>
+#endif
+
#if ENABLE(IOS_TOUCH_EVENTS)
#include <WebKitAdditions/PlatformTouchEventIOS.h>
#elif ENABLE(TOUCH_EVENTS)
@@ -1062,6 +1066,9 @@
void drawPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, const WebCore::IntRect&);
void drawPagesToPDFFromPDFDocument(CGContextRef, PDFDocument *, const PrintInfo&, uint32_t first, uint32_t count);
#endif
+#if ENABLE(DATA_DETECTION)
+ WebCore::DataDetectorTypes fromWKDataDetectorTypes(uint32_t types);
+#endif
void setMainFrameIsScrollable(bool);