Diff
Modified: trunk/Source/WebCore/ChangeLog (202888 => 202889)
--- trunk/Source/WebCore/ChangeLog 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebCore/ChangeLog 2016-07-07 03:03:42 UTC (rev 202889)
@@ -1,3 +1,24 @@
+2016-07-06 Tim Horton <[email protected]>
+
+ Email from June 1st containing text 'Today @ 7:10PM' is linkified, but shouldn't be
+ https://bugs.webkit.org/show_bug.cgi?id=159498
+ <rdar://problem/26719903>
+
+ Reviewed by Sam Weinig.
+
+ New API test: WebKit2.DataDetectionReferenceDate
+
+ * editing/cocoa/DataDetection.h:
+ * editing/cocoa/DataDetection.mm:
+ (WebCore::DataDetection::detectContentInRange):
+ Extract the reference date from the DataDetectors context dictionary if it exists,
+ and pass it along to DataDetectors.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
+ * loader/FrameLoaderClient.h:
+ Plumb the DataDetectors context dictionary through from WebPage.
+
2016-07-06 Chris Dumez <[email protected]>
[WK2][Cocoa] Disable ResourceResponse lazy initialization
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (202888 => 202889)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-07-07 03:03:42 UTC (rev 202889)
@@ -1244,6 +1244,7 @@
2D97F04819DD4140001EE9C3 /* MockPageOverlayClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DAAE32D19DCAF6000E002D2 /* MockPageOverlayClient.h */; };
2D9F0E1314FF1CBF00BA0FF7 /* linearSRGB.icc in Resources */ = {isa = PBXBuildFile; fileRef = 2D9F0E1214FF1CBF00BA0FF7 /* linearSRGB.icc */; };
2DB9C4AA1B3231F40070F27F /* NSEventSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DB9C4A91B3231F40070F27F /* NSEventSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 2DC4CF791D2DD98900ECCC94 /* DataDetectorsUISPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DC4CF781D2DD98900ECCC94 /* DataDetectorsUISPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
2DCB837919F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
2DCB837A19F99BBA00A7FBE4 /* NSSharingServiceSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DCB837819F99BBA00A7FBE4 /* NSSharingServiceSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
2DDB97F419F9AECA002025D8 /* NSExtensionSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DDB97F319F9AECA002025D8 /* NSExtensionSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8812,6 +8813,7 @@
2DAAE32C19DCAF6000E002D2 /* MockPageOverlayClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockPageOverlayClient.cpp; sourceTree = "<group>"; };
2DAAE32D19DCAF6000E002D2 /* MockPageOverlayClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockPageOverlayClient.h; sourceTree = "<group>"; };
2DB9C4A91B3231F40070F27F /* NSEventSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSEventSPI.h; sourceTree = "<group>"; };
+ 2DC4CF781D2DD98900ECCC94 /* DataDetectorsUISPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataDetectorsUISPI.h; sourceTree = "<group>"; };
2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSSharingServicePickerSPI.h; sourceTree = "<group>"; };
2DCB837819F99BBA00A7FBE4 /* NSSharingServiceSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSSharingServiceSPI.h; sourceTree = "<group>"; };
2DDB97F319F9AECA002025D8 /* NSExtensionSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSExtensionSPI.h; sourceTree = "<group>"; };
@@ -20171,6 +20173,7 @@
isa = PBXGroup;
children = (
CE1252421A16C01A00864480 /* CoreUISPI.h */,
+ 2DC4CF781D2DD98900ECCC94 /* DataDetectorsUISPI.h */,
CEC337AE1A46086D009B8523 /* GraphicsServicesSPI.h */,
7C4C96E21AD44ABF00365A50 /* LaunchServicesSPI.h */,
CE1252401A16B1B600864480 /* MediaPlayerSPI.h */,
@@ -26922,6 +26925,7 @@
7C9DBFEE1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h in Headers */,
E44614380CD689C500FADA75 /* JSHTMLAudioElement.h in Headers */,
A80E7B110A19D606007FB8C5 /* JSHTMLBaseElement.h in Headers */,
+ 2DC4CF791D2DD98900ECCC94 /* DataDetectorsUISPI.h in Headers */,
1AE2AA230A1CDAB400B42B25 /* JSHTMLBodyElement.h in Headers */,
1AE2AA250A1CDAB400B42B25 /* JSHTMLBRElement.h in Headers */,
A80E7E9F0A1A83E3007FB8C5 /* JSHTMLButtonElement.h in Headers */,
Modified: trunk/Source/WebCore/editing/cocoa/DataDetection.h (202888 => 202889)
--- trunk/Source/WebCore/editing/cocoa/DataDetection.h 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.h 2016-07-07 03:03:42 UTC (rev 202889)
@@ -32,6 +32,7 @@
OBJC_CLASS DDActionContext;
OBJC_CLASS NSArray;
+OBJC_CLASS NSDictionary;
namespace WebCore {
@@ -57,7 +58,7 @@
#if PLATFORM(MAC)
WEBCORE_EXPORT static RetainPtr<DDActionContext> detectItemAroundHitTestResult(const HitTestResult&, FloatRect& detectedDataBoundingBox, RefPtr<Range>& detectedDataRange);
#endif
- WEBCORE_EXPORT static NSArray *detectContentInRange(RefPtr<Range>& contextRange, DataDetectorTypes);
+ WEBCORE_EXPORT static NSArray *detectContentInRange(RefPtr<Range>& contextRange, DataDetectorTypes, NSDictionary *context);
#if PLATFORM(IOS)
WEBCORE_EXPORT static bool isDataDetectorLink(Element&);
WEBCORE_EXPORT static String dataDetectorIdentifier(Element&);
Modified: trunk/Source/WebCore/editing/cocoa/DataDetection.mm (202888 => 202889)
--- trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebCore/editing/cocoa/DataDetection.mm 2016-07-07 03:03:42 UTC (rev 202889)
@@ -29,6 +29,7 @@
#import "Attr.h"
#import "CSSStyleDeclaration.h"
#import "DataDetectorsSPI.h"
+#import "DataDetectorsUISPI.h"
#import "ElementAncestorIterator.h"
#import "ElementTraversal.h"
#import "FrameView.h"
@@ -429,7 +430,7 @@
return kCFCompareEqualTo;
}
-NSArray *DataDetection::detectContentInRange(RefPtr<Range>& contextRange, DataDetectorTypes types)
+NSArray *DataDetection::detectContentInRange(RefPtr<Range>& contextRange, DataDetectorTypes types, NSDictionary *context)
{
RetainPtr<DDScannerRef> scanner = adoptCF(softLink_DataDetectorsCore_DDScannerCreate(DDScannerTypeStandard, 0, nullptr));
RetainPtr<DDScanQueryRef> scanQuery = adoptCF(softLink_DataDetectorsCore_DDScanQueryCreate(NULL));
@@ -443,15 +444,15 @@
// 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;
-
+
RetainPtr<CFArrayRef> scannerResults = adoptCF(softLink_DataDetectorsCore_DDScannerCopyResultsWithOptions(scanner.get(), get_DataDetectorsCore_DDScannerCopyResultsOptionsForPassiveUse() | DDScannerCopyResultsOptionsCoalesceSignatures));
if (!scannerResults)
return nil;
-
+
CFIndex resultCount = CFArrayGetCount(scannerResults.get());
if (!resultCount)
return nil;
-
+
Vector<RetainPtr<DDResultRef>> allResults;
Vector<RetainPtr<NSIndexPath>> indexPaths;
NSInteger currentTopLevelIndex = 0;
@@ -519,7 +520,7 @@
}
auto tz = adoptCF(CFTimeZoneCopyDefault());
- NSDate *referenceDate = [NSDate date];
+ NSDate *referenceDate = [context objectForKey:getkDataDetectorsReferenceDateKey()] ?: [NSDate date];
Text* lastTextNodeToUpdate = nullptr;
String lastNodeContent;
size_t contentOffset = 0;
@@ -652,7 +653,7 @@
}
#else
-NSArray *DataDetection::detectContentInRange(RefPtr<Range>&, DataDetectorTypes)
+NSArray *DataDetection::detectContentInRange(RefPtr<Range>&, DataDetectorTypes, NSDictionary *)
{
return nil;
}
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (202888 => 202889)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2016-07-07 03:03:42 UTC (rev 202889)
@@ -2310,7 +2310,7 @@
if (m_frame.settings().dataDetectorTypes() != DataDetectorTypeNone && document) {
if (auto* documentElement = document->documentElement()) {
RefPtr<Range> documentRange = makeRange(firstPositionInNode(documentElement), lastPositionInNode(documentElement));
- m_frame.setDataDetectionResults(DataDetection::detectContentInRange(documentRange, m_frame.settings().dataDetectorTypes()));
+ m_frame.setDataDetectionResults(DataDetection::detectContentInRange(documentRange, m_frame.settings().dataDetectorTypes(), m_client.dataDetectionContext()));
if (m_frame.isMainFrame())
m_client.dispatchDidFinishDataDetection(m_frame.dataDetectionResults());
}
Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (202888 => 202889)
--- trunk/Source/WebCore/loader/FrameLoaderClient.h 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h 2016-07-07 03:03:42 UTC (rev 202889)
@@ -54,6 +54,7 @@
#if PLATFORM(COCOA)
OBJC_CLASS NSArray;
OBJC_CLASS NSCachedURLResponse;
+OBJC_CLASS NSDictionary;
OBJC_CLASS NSView;
#endif
@@ -292,6 +293,7 @@
// Allow an accessibility object to retrieve a Frame parent if there's no PlatformWidget.
virtual RemoteAXObjectRef accessibilityRemoteObject() = 0;
virtual NSCachedURLResponse* willCacheResponse(DocumentLoader*, unsigned long identifier, NSCachedURLResponse*) const = 0;
+ virtual NSDictionary *dataDetectionContext() { return nullptr; }
#endif
#if PLATFORM(WIN) && USE(CFNETWORK)
// FIXME: Windows should use willCacheResponse - <https://bugs.webkit.org/show_bug.cgi?id=57257>.
Copied: trunk/Source/WebCore/platform/spi/ios/DataDetectorsUISPI.h (from rev 202888, trunk/Source/WebKit2/Platform/spi/ios/DataDetectorsUISPI.h) (0 => 202889)
--- trunk/Source/WebCore/platform/spi/ios/DataDetectorsUISPI.h (rev 0)
+++ trunk/Source/WebCore/platform/spi/ios/DataDetectorsUISPI.h 2016-07-07 03:03:42 UTC (rev 202889)
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+#if PLATFORM(IOS)
+
+#import <UIKit/UIKit.h>
+#import <WebCore/SoftLinking.h>
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <DataDetectorsUI/DDAction.h>
+#import <DataDetectorsUI/DDDetectionController.h>
+
+#else
+
+@interface DDAction : NSObject
+@end
+
+@interface DDAction ()
+- (BOOL)hasUserInterface;
+- (NSString *)localizedName;
+@property (readonly) NSString *actionUTI;
+@end
+
+@protocol DDDetectionControllerInteractionDelegate <NSObject>
+@end
+
+@interface DDDetectionController : NSObject <UIActionSheetDelegate>
+@end
+
+@interface DDDetectionController ()
++ (DDDetectionController *)sharedController;
++ (NSArray *)tapAndHoldSchemes;
+- (void)performAction:(DDAction *)action fromAlertController:(UIAlertController *)alertController interactionDelegate:(id <DDDetectionControllerInteractionDelegate>)interactionDelegate;
+@end
+
+#endif
+
+@interface DDDetectionController (DetailsToBeRemoved)
+// FIXME: This will be removed as soon as <rdar://problem/16346913> is fixed.
+- (NSArray *)actionsForAnchor:(id)anchor url:(NSURL *)targetURL forFrame:(id)frame;
+@end
+
+SOFT_LINK_PRIVATE_FRAMEWORK(DataDetectorsUI)
+SOFT_LINK_CLASS(DataDetectorsUI, DDDetectionController)
+SOFT_LINK_CONSTANT(DataDetectorsUI, kDataDetectorsLeadingText, const NSString *)
+SOFT_LINK_CONSTANT(DataDetectorsUI, kDataDetectorsTrailingText, const NSString *)
+SOFT_LINK_CONSTANT(DataDetectorsUI, kDataDetectorsReferenceDateKey, const NSString *)
+
+#endif
Modified: trunk/Source/WebKit2/CMakeLists.txt (202888 => 202889)
--- trunk/Source/WebKit2/CMakeLists.txt 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/CMakeLists.txt 2016-07-07 03:03:42 UTC (rev 202889)
@@ -239,6 +239,7 @@
Shared/EditorState.cpp
Shared/FontInfo.cpp
Shared/LayerTreeContext.cpp
+ Shared/LoadParameters.cpp
Shared/NavigationActionData.cpp
Shared/PlatformPopupMenuData.cpp
Shared/PrintInfo.cpp
Modified: trunk/Source/WebKit2/ChangeLog (202888 => 202889)
--- trunk/Source/WebKit2/ChangeLog 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/ChangeLog 2016-07-07 03:03:42 UTC (rev 202889)
@@ -1,3 +1,73 @@
+2016-07-06 Tim Horton <[email protected]>
+
+ Email from June 1st containing text 'Today @ 7:10PM' is linkified, but shouldn't be
+ https://bugs.webkit.org/show_bug.cgi?id=159498
+ <rdar://problem/26719903>
+
+ Reviewed by Sam Weinig.
+
+ * Shared/Cocoa/LoadParametersCocoa.mm: Added.
+ (WebKit::LoadParameters::platformEncode):
+ (WebKit::LoadParameters::platformDecode):
+ * Shared/LoadParameters.cpp: Added.
+ (WebKit::LoadParameters::encode):
+ (WebKit::LoadParameters::decode):
+ * Shared/LoadParameters.h: Added.
+ Add a struct that knows how to encode all of the different parameters
+ to all of the Load* messages, including the platform-specific DataDetectors parameters.
+
+ * Shared/mac/ArgumentCodersMac.h:
+ * Shared/mac/ArgumentCodersMac.mm:
+ (IPC::typeFromObject):
+ (IPC::encode):
+ (IPC::decode):
+ Add NSURL coders that defer to the CFURL coders.
+
+ * UIProcess/API/APIUIClient.h:
+ (API::UIClient::dataDetectionContext):
+ * UIProcess/Cocoa/UIDelegate.h:
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::setDelegate):
+ (WebKit::UIDelegate::UIClient::dataDetectionContext):
+ Add APIUIClient methods to retrieve the DataDetectors context dictionary.
+
+ * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+ (WebKit::WebPageProxy::addPlatformLoadParameters):
+ Add the DataDetectors context dictionary to the given LoadParameters.
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dataDetectionContext):
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+ * WebProcess/WebPage/WebPage.h:
+ (WebKit::WebPage::dataDetectionContext):
+ Store the dataDetectionContext on WebPage, and make it accessible to WebCore
+ via the FrameLoaderClient (it is used in FrameLoader when the load completes).
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::loadRequest):
+ (WebKit::WebPageProxy::loadFile):
+ (WebKit::WebPageProxy::loadData):
+ (WebKit::WebPageProxy::loadHTMLString):
+ (WebKit::WebPageProxy::loadAlternateHTMLString):
+ (WebKit::WebPageProxy::loadPlainTextString):
+ (WebKit::WebPageProxy::loadWebArchiveData):
+ * UIProcess/WebPageProxy.h:
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::loadRequest):
+ (WebKit::WebPage::loadStringImpl):
+ (WebKit::WebPage::loadData):
+ (WebKit::WebPage::loadString):
+ (WebKit::WebPage::loadAlternateHTMLString):
+ (WebKit::WebPage::loadHTMLString): Deleted.
+ (WebKit::WebPage::loadPlainTextString): Deleted.
+ (WebKit::WebPage::loadWebArchiveData): Deleted.
+ * WebProcess/WebPage/WebPage.messages.in:
+ Adopt LoadParameters, taking this opportunity to reduce the number of very similar messages.
+ We can take this further (we should be able to get it down to just LoadRequest
+ and LoadData) in the future. When any load occurs, grab the client's DataDetectorse
+ context dictionary and send it along with the load request, storing it in WebPage.
+
2016-07-06 Chris Dumez <[email protected]>
[WK2][Cocoa] Disable ResourceResponse lazy initialization
Deleted: trunk/Source/WebKit2/Platform/spi/ios/DataDetectorsUISPI.h (202888 => 202889)
--- trunk/Source/WebKit2/Platform/spi/ios/DataDetectorsUISPI.h 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/Platform/spi/ios/DataDetectorsUISPI.h 2016-07-07 03:03:42 UTC (rev 202889)
@@ -1,67 +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.
- */
-
-#import <UIKit/UIKit.h>
-#import <WebCore/SoftLinking.h>
-
-#if USE(APPLE_INTERNAL_SDK)
-
-#import <DataDetectorsUI/DDAction.h>
-#import <DataDetectorsUI/DDDetectionController.h>
-
-#else
-
-@interface DDAction : NSObject
-@end
-
-@interface DDAction ()
-- (BOOL)hasUserInterface;
-- (NSString *)localizedName;
-@property (readonly) NSString *actionUTI;
-@end
-
-@protocol DDDetectionControllerInteractionDelegate <NSObject>
-@end
-
-@interface DDDetectionController : NSObject <UIActionSheetDelegate>
-@end
-
-@interface DDDetectionController ()
-+ (DDDetectionController *)sharedController;
-+ (NSArray *)tapAndHoldSchemes;
-- (void)performAction:(DDAction *)action fromAlertController:(UIAlertController *)alertController interactionDelegate:(id <DDDetectionControllerInteractionDelegate>)interactionDelegate;
-@end
-
-#endif
-
-@interface DDDetectionController (DetailsToBeRemoved)
-// FIXME: This will be removed as soon as <rdar://problem/16346913> is fixed.
-- (NSArray *)actionsForAnchor:(id)anchor url:(NSURL *)targetURL forFrame:(id)frame;
-@end
-
-SOFT_LINK_PRIVATE_FRAMEWORK(DataDetectorsUI)
-SOFT_LINK_CLASS(DataDetectorsUI, DDDetectionController)
-SOFT_LINK_CONSTANT(DataDetectorsUI, kDataDetectorsLeadingText, const NSString *)
-SOFT_LINK_CONSTANT(DataDetectorsUI, kDataDetectorsTrailingText, const NSString *)
Copied: trunk/Source/WebKit2/Shared/Cocoa/LoadParametersCocoa.mm (from rev 202888, trunk/Source/WebKit2/UIProcess/Cocoa/WebPageProxyCocoa.mm) (0 => 202889)
--- trunk/Source/WebKit2/Shared/Cocoa/LoadParametersCocoa.mm (rev 0)
+++ trunk/Source/WebKit2/Shared/Cocoa/LoadParametersCocoa.mm 2016-07-07 03:03:42 UTC (rev 202889)
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "LoadParameters.h"
+
+#if PLATFORM(COCOA)
+
+#include "ArgumentCodersMac.h"
+#include "WebCoreArgumentCoders.h"
+
+namespace WebKit {
+
+void LoadParameters::platformEncode(IPC::ArgumentEncoder& encoder) const
+{
+ IPC::encode(encoder, dataDetectionContext.get());
+}
+
+bool LoadParameters::platformDecode(IPC::ArgumentDecoder& decoder, LoadParameters& data)
+{
+ if (!IPC::decode(decoder, data.dataDetectionContext))
+ return false;
+
+ return true;
+}
+
+} // namespace WebKit
+
+#endif
Added: trunk/Source/WebKit2/Shared/LoadParameters.cpp (0 => 202889)
--- trunk/Source/WebKit2/Shared/LoadParameters.cpp (rev 0)
+++ trunk/Source/WebKit2/Shared/LoadParameters.cpp 2016-07-07 03:03:42 UTC (rev 202889)
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "LoadParameters.h"
+
+#include "WebCoreArgumentCoders.h"
+
+namespace WebKit {
+
+void LoadParameters::encode(IPC::ArgumentEncoder& encoder) const
+{
+ encoder << navigationID;
+ encoder << request;
+ encoder << sandboxExtensionHandle;
+ encoder << data;
+ encoder << string;
+ encoder << MIMEType;
+ encoder << encodingName;
+ encoder << baseURLString;
+ encoder << unreachableURLString;
+ encoder << provisionalLoadErrorURLString;
+ encoder << shouldOpenExternalURLsPolicy;
+ encoder << userData;
+
+ platformEncode(encoder);
+}
+
+bool LoadParameters::decode(IPC::ArgumentDecoder& decoder, LoadParameters& data)
+{
+ if (!decoder.decode(data.navigationID))
+ return false;
+
+ if (!decoder.decode(data.request))
+ return false;
+
+ if (!decoder.decode(data.sandboxExtensionHandle))
+ return false;
+
+ if (!decoder.decode(data.data))
+ return false;
+
+ if (!decoder.decode(data.string))
+ return false;
+
+ if (!decoder.decode(data.MIMEType))
+ return false;
+
+ if (!decoder.decode(data.encodingName))
+ return false;
+
+ if (!decoder.decode(data.baseURLString))
+ return false;
+
+ if (!decoder.decode(data.unreachableURLString))
+ return false;
+
+ if (!decoder.decode(data.provisionalLoadErrorURLString))
+ return false;
+
+ if (!decoder.decode(data.shouldOpenExternalURLsPolicy))
+ return false;
+
+ if (!decoder.decode(data.userData))
+ return false;
+
+ if (!platformDecode(decoder, data))
+ return false;
+
+ return true;
+}
+
+#if !PLATFORM(COCOA)
+
+void LoadParameters::platformEncode(IPC::ArgumentEncoder&) const
+{
+}
+
+bool LoadParameters::platformDecode(IPC::ArgumentDecoder&, LoadParameters&)
+{
+ return true;
+}
+
+#endif // !PLATFORM(COCOA)
+
+
+} // namespace WebKit
Copied: trunk/Source/WebKit2/Shared/LoadParameters.h (from rev 202888, trunk/Source/WebKit2/UIProcess/Cocoa/WebPageProxyCocoa.mm) (0 => 202889)
--- trunk/Source/WebKit2/Shared/LoadParameters.h (rev 0)
+++ trunk/Source/WebKit2/Shared/LoadParameters.h 2016-07-07 03:03:42 UTC (rev 202889)
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+#ifndef LoadParameters_h
+#define LoadParameters_h
+
+#include "DataReference.h"
+#include "SandboxExtension.h"
+#include "UserData.h"
+#include <WebCore/ResourceRequest.h>
+
+OBJC_CLASS NSDictionary;
+
+namespace IPC {
+class ArgumentDecoder;
+class ArgumentEncoder;
+}
+
+namespace WebKit {
+
+struct LoadParameters {
+ void encode(IPC::ArgumentEncoder&) const;
+ static bool decode(IPC::ArgumentDecoder&, LoadParameters&);
+
+ void platformEncode(IPC::ArgumentEncoder&) const;
+ static bool platformDecode(IPC::ArgumentDecoder&, LoadParameters&);
+
+ uint64_t navigationID;
+
+ WebCore::ResourceRequest request;
+ SandboxExtension::Handle sandboxExtensionHandle;
+
+ IPC::DataReference data;
+ String string;
+ String MIMEType;
+ String encodingName;
+
+ String baseURLString;
+ String unreachableURLString;
+ String provisionalLoadErrorURLString;
+
+ uint64_t shouldOpenExternalURLsPolicy;
+ UserData userData;
+
+#if PLATFORM(COCOA)
+ RetainPtr<NSDictionary> dataDetectionContext;
+#endif
+};
+
+} // namespace WebKit
+
+#endif // LoadParameters_h
Modified: trunk/Source/WebKit2/Shared/mac/ArgumentCodersMac.h (202888 => 202889)
--- trunk/Source/WebKit2/Shared/mac/ArgumentCodersMac.h 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/Shared/mac/ArgumentCodersMac.h 2016-07-07 03:03:42 UTC (rev 202889)
@@ -37,6 +37,7 @@
OBJC_CLASS NSFont;
OBJC_CLASS NSNumber;
OBJC_CLASS NSString;
+OBJC_CLASS NSURL;
namespace IPC {
@@ -87,6 +88,10 @@
void encode(ArgumentEncoder&, NSData *);
bool decode(ArgumentDecoder&, RetainPtr<NSData>&);
+// NSURL
+void encode(ArgumentEncoder&, NSURL *);
+bool decode(ArgumentDecoder&, RetainPtr<NSURL>&);
+
} // namespace IPC
#endif // ArgumentCodersMac_h
Modified: trunk/Source/WebKit2/Shared/mac/ArgumentCodersMac.mm (202888 => 202889)
--- trunk/Source/WebKit2/Shared/mac/ArgumentCodersMac.mm 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/Shared/mac/ArgumentCodersMac.mm 2016-07-07 03:03:42 UTC (rev 202889)
@@ -55,6 +55,7 @@
NSStringType,
NSDateType,
NSDataType,
+ NSURLType,
Unknown,
};
@@ -84,6 +85,8 @@
return NSDateType;
if ([object isKindOfClass:[NSData class]])
return NSDataType;
+ if ([object isKindOfClass:[NSURL class]])
+ return NSURLType;
ASSERT_NOT_REACHED();
return Unknown;
@@ -126,6 +129,9 @@
case NSDataType:
encode(encoder, static_cast<NSData *>(object));
return;
+ case NSURLType:
+ encode(encoder, static_cast<NSURL *>(object));
+ return;
case Unknown:
break;
}
@@ -207,6 +213,13 @@
result = data;
return true;
}
+ case NSURLType: {
+ RetainPtr<NSURL> URL;
+ if (!decode(decoder, URL))
+ return false;
+ result = URL;
+ return true;
+ }
case Unknown:
ASSERT_NOT_REACHED();
return false;
@@ -505,4 +518,19 @@
return true;
}
+void encode(ArgumentEncoder& encoder, NSURL *URL)
+{
+ encode(encoder, (CFURLRef)URL);
+}
+
+bool decode(ArgumentDecoder& decoder, RetainPtr<NSURL>& result)
+{
+ RetainPtr<CFURLRef> URL;
+ if (!decode(decoder, URL))
+ return false;
+
+ result = adoptNS((NSURL *)URL.leakRef());
+ return true;
+}
+
} // namespace IPC
Modified: trunk/Source/WebKit2/UIProcess/API/APIUIClient.h (202888 => 202889)
--- trunk/Source/WebKit2/UIProcess/API/APIUIClient.h 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/UIProcess/API/APIUIClient.h 2016-07-07 03:03:42 UTC (rev 202889)
@@ -164,6 +164,9 @@
virtual void didNotHandleTapAsClick(const WebCore::IntPoint&) { }
virtual UIViewController *presentingViewController() { return nullptr; }
#endif
+#if PLATFORM(COCOA)
+ virtual NSDictionary *dataDetectionContext() { return nullptr; }
+#endif
virtual void didClickAutoFillButton(WebKit::WebPageProxy&, API::Object*) { }
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h (202888 => 202889)
--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h 2016-07-07 03:03:42 UTC (rev 202889)
@@ -97,7 +97,10 @@
RetainPtr<NSArray> actionsForElement(_WKActivatedElementInfo *, RetainPtr<NSArray> defaultActions) override;
void didNotHandleTapAsClick(const WebCore::IntPoint&) override;
UIViewController *presentingViewController() override;
-#endif
+#endif // PLATFORM(IOS)
+
+ NSDictionary *dataDetectionContext() override;
+
void imageOrMediaDocumentSizeChanged(const WebCore::IntSize&) override;
UIDelegate& m_uiDelegate;
@@ -130,6 +133,7 @@
bool webViewDidNotHandleTapAsClickAtPoint : 1;
bool presentingViewControllerForWebView : 1;
#endif
+ bool dataDetectionContextForWebView : 1;
bool webViewImageOrMediaDocumentSizeChanged : 1;
#if ENABLE(CONTEXT_MENUS)
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm (202888 => 202889)
--- trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm 2016-07-07 03:03:42 UTC (rev 202889)
@@ -101,6 +101,7 @@
m_delegateMethods.webViewDidNotHandleTapAsClickAtPoint = [delegate respondsToSelector:@selector(_webView:didNotHandleTapAsClickAtPoint:)];
m_delegateMethods.presentingViewControllerForWebView = [delegate respondsToSelector:@selector(_presentingViewControllerForWebView:)];
#endif
+ m_delegateMethods.dataDetectionContextForWebView = [delegate respondsToSelector:@selector(_dataDetectionContextForWebView:)];
m_delegateMethods.webViewImageOrMediaDocumentSizeChanged = [delegate respondsToSelector:@selector(_webView:imageOrMediaDocumentSizeChanged:)];
#if ENABLE(CONTEXT_MENUS)
@@ -441,6 +442,18 @@
#endif
+NSDictionary *UIDelegate::UIClient::dataDetectionContext()
+{
+ if (!m_uiDelegate.m_delegateMethods.dataDetectionContextForWebView)
+ return nullptr;
+
+ auto delegate = m_uiDelegate.m_delegate.get();
+ if (!delegate)
+ return nullptr;
+
+ return [static_cast<id <WKUIDelegatePrivate>>(delegate) _dataDetectionContextForWebView:m_uiDelegate.m_webView];
+}
+
void UIDelegate::UIClient::imageOrMediaDocumentSizeChanged(const WebCore::IntSize& newSize)
{
if (!m_uiDelegate.m_delegateMethods.webViewImageOrMediaDocumentSizeChanged)
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebPageProxyCocoa.mm (202888 => 202889)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebPageProxyCocoa.mm 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebPageProxyCocoa.mm 2016-07-07 03:03:42 UTC (rev 202889)
@@ -24,9 +24,12 @@
*/
#import "config.h"
-#import "WebProcessProxy.h"
+#import "WebPageProxy.h"
+#import "APIUIClient.h"
#import "DataDetectionResult.h"
+#import "LoadParameters.h"
+#import "WebProcessProxy.h"
#import <WebCore/SearchPopupMenuCocoa.h>
#import <wtf/cf/TypeCastsCF.h>
@@ -68,4 +71,9 @@
}
#endif
+void WebPageProxy::addPlatformLoadParameters(LoadParameters& loadParameters)
+{
+ loadParameters.dataDetectionContext = m_uiClient->dataDetectionContext();
}
+
+}
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (202888 => 202889)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-07-07 03:03:42 UTC (rev 202889)
@@ -55,6 +55,7 @@
#include "DrawingAreaProxy.h"
#include "DrawingAreaProxyMessages.h"
#include "EventDispatcherMessages.h"
+#include "LoadParameters.h"
#include "Logging.h"
#include "NativeWebGestureEvent.h"
#include "NativeWebKeyboardEvent.h"
@@ -906,6 +907,12 @@
return true;
}
+#if !PLATFORM(COCOA)
+void WebPageProxy::addPlatformLoadParameters(LoadParameters&)
+{
+}
+#endif
+
RefPtr<API::Navigation> WebPageProxy::loadRequest(const ResourceRequest& request, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, API::Object* userData)
{
if (m_isClosed)
@@ -920,11 +927,17 @@
if (!isValid())
reattachToWebProcess();
- SandboxExtension::Handle sandboxExtensionHandle;
- bool createdExtension = maybeInitializeSandboxExtensionHandle(request.url(), sandboxExtensionHandle);
+ LoadParameters loadParameters;
+ loadParameters.navigationID = navigation->navigationID();
+ loadParameters.request = request;
+ loadParameters.shouldOpenExternalURLsPolicy = (uint64_t)shouldOpenExternalURLsPolicy;
+ loadParameters.userData = UserData(process().transformObjectsToHandles(userData).get());
+ bool createdExtension = maybeInitializeSandboxExtensionHandle(request.url(), loadParameters.sandboxExtensionHandle);
if (createdExtension)
m_process->willAcquireUniversalFileReadSandboxExtension();
- m_process->send(Messages::WebPage::LoadRequest(navigation->navigationID(), request, sandboxExtensionHandle, (uint64_t)shouldOpenExternalURLsPolicy, UserData(process().transformObjectsToHandles(userData).get())), m_pageID);
+ addPlatformLoadParameters(loadParameters);
+
+ m_process->send(Messages::WebPage::LoadRequest(loadParameters), m_pageID);
m_process->responsivenessTimer().start();
return WTFMove(navigation);
@@ -959,10 +972,16 @@
String resourceDirectoryPath = resourceDirectoryURL.fileSystemPath();
- SandboxExtension::Handle sandboxExtensionHandle;
- SandboxExtension::createHandle(resourceDirectoryPath, SandboxExtension::ReadOnly, sandboxExtensionHandle);
+ LoadParameters loadParameters;
+ loadParameters.navigationID = navigation->navigationID();
+ loadParameters.request = fileURL;
+ loadParameters.shouldOpenExternalURLsPolicy = (uint64_t)ShouldOpenExternalURLsPolicy::ShouldNotAllow;
+ loadParameters.userData = UserData(process().transformObjectsToHandles(userData).get());
+ SandboxExtension::createHandle(resourceDirectoryPath, SandboxExtension::ReadOnly, loadParameters.sandboxExtensionHandle);
+ addPlatformLoadParameters(loadParameters);
+
m_process->assumeReadAccessToBaseURL(resourceDirectoryURL);
- m_process->send(Messages::WebPage::LoadRequest(navigation->navigationID(), fileURL, sandboxExtensionHandle, (uint64_t)ShouldOpenExternalURLsPolicy::ShouldNotAllow, UserData(process().transformObjectsToHandles(userData).get())), m_pageID);
+ m_process->send(Messages::WebPage::LoadRequest(loadParameters), m_pageID);
m_process->responsivenessTimer().start();
return WTFMove(navigation);
@@ -982,8 +1001,17 @@
if (!isValid())
reattachToWebProcess();
+ LoadParameters loadParameters;
+ loadParameters.navigationID = navigation->navigationID();
+ loadParameters.data = ""
+ loadParameters.MIMEType = MIMEType;
+ loadParameters.encodingName = encoding;
+ loadParameters.baseURLString = baseURL;
+ loadParameters.userData = UserData(process().transformObjectsToHandles(userData).get());
+ addPlatformLoadParameters(loadParameters);
+
m_process->assumeReadAccessToBaseURL(baseURL);
- m_process->send(Messages::WebPage::LoadData(navigation->navigationID(), data->dataReference(), MIMEType, encoding, baseURL, UserData(process().transformObjectsToHandles(userData).get())), m_pageID);
+ m_process->send(Messages::WebPage::LoadData(loadParameters), m_pageID);
m_process->responsivenessTimer().start();
return WTFMove(navigation);
@@ -1004,8 +1032,16 @@
if (!isValid())
reattachToWebProcess();
+ LoadParameters loadParameters;
+ loadParameters.navigationID = navigation->navigationID();
+ loadParameters.string = htmlString;
+ loadParameters.encodingName = ASCIILiteral("text/html");
+ loadParameters.baseURLString = baseURL;
+ loadParameters.userData = UserData(process().transformObjectsToHandles(userData).get());
+ addPlatformLoadParameters(loadParameters);
+
m_process->assumeReadAccessToBaseURL(baseURL);
- m_process->send(Messages::WebPage::LoadHTMLString(navigation->navigationID(), htmlString, baseURL, UserData(process().transformObjectsToHandles(userData).get())), m_pageID);
+ m_process->send(Messages::WebPage::LoadString(loadParameters), m_pageID);
m_process->responsivenessTimer().start();
return WTFMove(navigation);
@@ -1033,9 +1069,18 @@
if (m_mainFrame)
m_mainFrame->setUnreachableURL(unreachableURL);
+ LoadParameters loadParameters;
+ loadParameters.navigationID = 0;
+ loadParameters.string = htmlString;
+ loadParameters.baseURLString = baseURL;
+ loadParameters.unreachableURLString = unreachableURL;
+ loadParameters.provisionalLoadErrorURLString = m_failingProvisionalLoadURL;
+ loadParameters.userData = UserData(process().transformObjectsToHandles(userData).get());
+ addPlatformLoadParameters(loadParameters);
+
m_process->assumeReadAccessToBaseURL(baseURL);
m_process->assumeReadAccessToBaseURL(unreachableURL);
- m_process->send(Messages::WebPage::LoadAlternateHTMLString(htmlString, baseURL, unreachableURL, m_failingProvisionalLoadURL, UserData(process().transformObjectsToHandles(userData).get())), m_pageID);
+ m_process->send(Messages::WebPage::LoadAlternateHTMLString(loadParameters), m_pageID);
m_process->responsivenessTimer().start();
}
@@ -1050,7 +1095,14 @@
auto transaction = m_pageLoadState.transaction();
m_pageLoadState.setPendingAPIRequestURL(transaction, blankURL().string());
- m_process->send(Messages::WebPage::LoadPlainTextString(string, UserData(process().transformObjectsToHandles(userData).get())), m_pageID);
+ LoadParameters loadParameters;
+ loadParameters.navigationID = 0;
+ loadParameters.string = string;
+ loadParameters.MIMEType = ASCIILiteral("text/plain");
+ loadParameters.userData = UserData(process().transformObjectsToHandles(userData).get());
+ addPlatformLoadParameters(loadParameters);
+
+ m_process->send(Messages::WebPage::LoadString(loadParameters), m_pageID);
m_process->responsivenessTimer().start();
}
@@ -1065,7 +1117,15 @@
auto transaction = m_pageLoadState.transaction();
m_pageLoadState.setPendingAPIRequestURL(transaction, blankURL().string());
- m_process->send(Messages::WebPage::LoadWebArchiveData(webArchiveData->dataReference(), UserData(process().transformObjectsToHandles(userData).get())), m_pageID);
+ LoadParameters loadParameters;
+ loadParameters.navigationID = 0;
+ loadParameters.data = ""
+ loadParameters.MIMEType = ASCIILiteral("application/x-webarchive");
+ loadParameters.encodingName = ASCIILiteral("utf-16");
+ loadParameters.userData = UserData(process().transformObjectsToHandles(userData).get());
+ addPlatformLoadParameters(loadParameters);
+
+ m_process->send(Messages::WebPage::LoadData(loadParameters), m_pageID);
m_process->responsivenessTimer().start();
}
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (202888 => 202889)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-07-07 03:03:42 UTC (rev 202889)
@@ -205,6 +205,7 @@
struct ColorSpaceData;
struct EditingRange;
struct EditorState;
+struct LoadParameters;
struct PlatformPopupMenuData;
struct PrintInfo;
struct WebPopupItem;
@@ -367,6 +368,7 @@
void closePage(bool stopResponsivenessTimer);
+ void addPlatformLoadParameters(LoadParameters&);
RefPtr<API::Navigation> loadRequest(const WebCore::ResourceRequest&, WebCore::ShouldOpenExternalURLsPolicy = WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes, API::Object* userData = nullptr);
RefPtr<API::Navigation> loadFile(const String& fileURL, const String& resourceDirectoryURL, API::Object* userData = nullptr);
RefPtr<API::Navigation> loadData(API::Data*, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData = nullptr);
Modified: trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.h (202888 => 202889)
--- trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.h 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.h 2016-07-07 03:03:42 UTC (rev 202889)
@@ -25,10 +25,10 @@
#if PLATFORM(IOS)
-#import "DataDetectorsUISPI.h"
#import "GestureTypes.h"
#import "WKActionSheet.h"
#import <UIKit/UIPopoverController.h>
+#import <WebCore/DataDetectorsUISPI.h>
#import <wtf/RetainPtr.h>
namespace WebKit {
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (202888 => 202889)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2016-07-07 03:03:42 UTC (rev 202889)
@@ -29,7 +29,6 @@
#if PLATFORM(IOS)
#import "APIUIClient.h"
-#import "DataDetectorsUISPI.h"
#import "EditingRange.h"
#import "ManagedConfigurationSPI.h"
#import "NativeWebKeyboardEvent.h"
@@ -65,6 +64,7 @@
#import <WebCore/Color.h>
#import <WebCore/CoreGraphicsSPI.h>
#import <WebCore/DataDetectorsCoreSPI.h>
+#import <WebCore/DataDetectorsUISPI.h>
#import <WebCore/FloatQuad.h>
#import <WebCore/Pasteboard.h>
#import <WebCore/Path.h>
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (202888 => 202889)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2016-07-07 03:03:42 UTC (rev 202889)
@@ -596,6 +596,9 @@
29AD3096164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29AD3095164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm */; };
29CD55AA128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CD55A8128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h */; };
29CD55AB128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm */; };
+ 2D1087601D2C573E00B85F82 /* LoadParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D10875E1D2C573E00B85F82 /* LoadParameters.cpp */; };
+ 2D1087611D2C573E00B85F82 /* LoadParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D10875F1D2C573E00B85F82 /* LoadParameters.h */; };
+ 2D1087631D2C641B00B85F82 /* LoadParametersCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D1087621D2C641B00B85F82 /* LoadParametersCocoa.mm */; };
2D125C5E1857EA05003BA3CB /* ViewGestureController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D125C5C1857EA05003BA3CB /* ViewGestureController.h */; };
2D125C5F1857EA05003BA3CB /* ViewGestureControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D125C5D1857EA05003BA3CB /* ViewGestureControllerMac.mm */; };
2D1B5D5D185869C8006C6596 /* ViewGestureControllerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D1B5D5B185869C8006C6596 /* ViewGestureControllerMessageReceiver.cpp */; };
@@ -687,6 +690,7 @@
2DAF06D618BD1A470081CEB1 /* SmartMagnificationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DAF06D418BD1A470081CEB1 /* SmartMagnificationController.h */; };
2DAF06D718BD1A470081CEB1 /* SmartMagnificationController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DAF06D518BD1A470081CEB1 /* SmartMagnificationController.mm */; };
2DAF4FFB1B636181006013D6 /* ViewGestureController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DAF4FFA1B636181006013D6 /* ViewGestureController.cpp */; };
+ 2DC4CF7B1D2DE24B00ECCC94 /* WebPageCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DC4CF7A1D2DE24B00ECCC94 /* WebPageCocoa.mm */; };
2DC6D9C318C44A610043BAD4 /* WKWebViewContentProviderRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DC6D9C118C44A610043BAD4 /* WKWebViewContentProviderRegistry.h */; };
2DC6D9C418C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DC6D9C218C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm */; };
2DD12A081A8177F3002C74E6 /* WKPageRenderingProgressEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DD12A071A8177F3002C74E6 /* WKPageRenderingProgressEvents.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1735,7 +1739,6 @@
CE11AD521CBC482F00681EE5 /* CodeSigning.h in Headers */ = {isa = PBXBuildFile; fileRef = CE11AD511CBC482F00681EE5 /* CodeSigning.h */; };
CE1A0BD21A48E6C60054EF74 /* AssertionServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BCC1A48E6C60054EF74 /* AssertionServicesSPI.h */; };
CE1A0BD31A48E6C60054EF74 /* CorePDFSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BCD1A48E6C60054EF74 /* CorePDFSPI.h */; };
- CE1A0BD41A48E6C60054EF74 /* DataDetectorsUISPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BCE1A48E6C60054EF74 /* DataDetectorsUISPI.h */; };
CE1A0BD51A48E6C60054EF74 /* ManagedConfigurationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BCF1A48E6C60054EF74 /* ManagedConfigurationSPI.h */; };
CE1A0BD61A48E6C60054EF74 /* TCCSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BD01A48E6C60054EF74 /* TCCSPI.h */; };
CE1A0BD71A48E6C60054EF74 /* TextInputSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BD11A48E6C60054EF74 /* TextInputSPI.h */; };
@@ -2600,6 +2603,9 @@
29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKAccessibilityWebPageObjectBase.mm; sourceTree = "<group>"; };
2D0035221BC7414800DA8716 /* DeprecatedPDFPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DeprecatedPDFPlugin.h; path = PDF/DeprecatedPDFPlugin.h; sourceTree = "<group>"; };
2D0035231BC7414800DA8716 /* DeprecatedPDFPlugin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DeprecatedPDFPlugin.mm; path = PDF/DeprecatedPDFPlugin.mm; sourceTree = "<group>"; };
+ 2D10875E1D2C573E00B85F82 /* LoadParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadParameters.cpp; sourceTree = "<group>"; };
+ 2D10875F1D2C573E00B85F82 /* LoadParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadParameters.h; sourceTree = "<group>"; };
+ 2D1087621D2C641B00B85F82 /* LoadParametersCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LoadParametersCocoa.mm; sourceTree = "<group>"; };
2D125C5C1857EA05003BA3CB /* ViewGestureController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewGestureController.h; sourceTree = "<group>"; };
2D125C5D1857EA05003BA3CB /* ViewGestureControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewGestureControllerMac.mm; sourceTree = "<group>"; };
2D1B5D5A18586599006C6596 /* ViewGestureController.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = ViewGestureController.messages.in; sourceTree = "<group>"; };
@@ -2702,6 +2708,7 @@
2DAF06D518BD1A470081CEB1 /* SmartMagnificationController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = SmartMagnificationController.mm; path = ios/SmartMagnificationController.mm; sourceTree = "<group>"; };
2DAF06D818BD23BA0081CEB1 /* SmartMagnificationController.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = SmartMagnificationController.messages.in; path = ios/SmartMagnificationController.messages.in; sourceTree = "<group>"; };
2DAF4FFA1B636181006013D6 /* ViewGestureController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ViewGestureController.cpp; sourceTree = "<group>"; };
+ 2DC4CF7A1D2DE24B00ECCC94 /* WebPageCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPageCocoa.mm; sourceTree = "<group>"; };
2DC6D9C118C44A610043BAD4 /* WKWebViewContentProviderRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebViewContentProviderRegistry.h; sourceTree = "<group>"; };
2DC6D9C218C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewContentProviderRegistry.mm; sourceTree = "<group>"; };
2DD12A071A8177F3002C74E6 /* WKPageRenderingProgressEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageRenderingProgressEvents.h; sourceTree = "<group>"; };
@@ -3840,7 +3847,6 @@
CE11AD511CBC482F00681EE5 /* CodeSigning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeSigning.h; sourceTree = "<group>"; };
CE1A0BCC1A48E6C60054EF74 /* AssertionServicesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssertionServicesSPI.h; sourceTree = "<group>"; };
CE1A0BCD1A48E6C60054EF74 /* CorePDFSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CorePDFSPI.h; sourceTree = "<group>"; };
- CE1A0BCE1A48E6C60054EF74 /* DataDetectorsUISPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataDetectorsUISPI.h; sourceTree = "<group>"; };
CE1A0BCF1A48E6C60054EF74 /* ManagedConfigurationSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ManagedConfigurationSPI.h; sourceTree = "<group>"; };
CE1A0BD01A48E6C60054EF74 /* TCCSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCCSPI.h; sourceTree = "<group>"; };
CE1A0BD11A48E6C60054EF74 /* TextInputSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextInputSPI.h; sourceTree = "<group>"; };
@@ -4482,6 +4488,8 @@
BCCF6B2312C93E7A008F9C35 /* ImageOptions.h */,
1A92DC1212F8BAB90017AF65 /* LayerTreeContext.cpp */,
1A92DC1012F8BA460017AF65 /* LayerTreeContext.h */,
+ 2D10875E1D2C573E00B85F82 /* LoadParameters.cpp */,
+ 2D10875F1D2C573E00B85F82 /* LoadParameters.h */,
2D50366A1BCDE17900E20BB3 /* NativeWebGestureEvent.h */,
C02BFF1512514FD8009CCBEA /* NativeWebKeyboardEvent.h */,
31EA25D3134F78D6005B1452 /* NativeWebMouseEvent.h */,
@@ -4897,6 +4905,7 @@
children = (
2D29ECCE192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.h */,
2D29ECCF192F2C2E00984B78 /* RemoteLayerTreeDisplayRefreshMonitor.mm */,
+ 2DC4CF7A1D2DE24B00ECCC94 /* WebPageCocoa.mm */,
);
path = Cocoa;
sourceTree = "<group>";
@@ -5236,6 +5245,7 @@
37BEC4DE19491486008B4286 /* CompletionHandlerCallChecker.mm */,
C55F916C1C595E440029E92D /* DataDetectionResult.h */,
C55F916D1C595E440029E92D /* DataDetectionResult.mm */,
+ 2D1087621D2C641B00B85F82 /* LoadParametersCocoa.mm */,
1AB1F78E1D1B34A6007C9BD1 /* WebCoreArgumentCodersCocoa.mm */,
37C4C0921814B3AF003688B9 /* WKNSArray.h */,
37C4C0911814B3AF003688B9 /* WKNSArray.mm */,
@@ -7157,7 +7167,6 @@
CE1A0BCC1A48E6C60054EF74 /* AssertionServicesSPI.h */,
CDA041F31ACE2105004A13EC /* BackBoardServicesSPI.h */,
CE1A0BCD1A48E6C60054EF74 /* CorePDFSPI.h */,
- CE1A0BCE1A48E6C60054EF74 /* DataDetectorsUISPI.h */,
CE1A0BCF1A48E6C60054EF74 /* ManagedConfigurationSPI.h */,
579D18B71CCFE34B00B1974C /* PhotosSPI.h */,
CE1A0BD01A48E6C60054EF74 /* TCCSPI.h */,
@@ -7460,7 +7469,6 @@
512A976A180E09B80039A149 /* DatabaseProcessProxyMessages.h in Headers */,
51032F1E180F791700961BB7 /* DatabaseToWebProcessConnectionMessages.h in Headers */,
C55F91711C59676E0029E92D /* DataDetectionResult.h in Headers */,
- CE1A0BD41A48E6C60054EF74 /* DataDetectorsUISPI.h in Headers */,
1AC75380183BE50F0072CB15 /* DataReference.h in Headers */,
83891B6C1A68C30B0030F386 /* DiagnosticLoggingClient.h in Headers */,
5C1427021C23F84C00D41183 /* Download.h in Headers */,
@@ -7852,6 +7860,7 @@
7C85FD7C193415A8000177C4 /* WebPreferencesDefinitions.h in Headers */,
7C85FD8019341665000177C4 /* WebPreferencesKeys.h in Headers */,
BCD598AC112B7FDF00EC8C23 /* WebPreferencesStore.h in Headers */,
+ 2D1087611D2C573E00B85F82 /* LoadParameters.h in Headers */,
BC032D9710F437AF0058C15A /* WebProcess.h in Headers */,
1A043A09124D11A900FFBFB5 /* WebProcessConnection.h in Headers */,
1A043F6A12514D8B00FFBFB5 /* WebProcessConnectionMessages.h in Headers */,
@@ -8877,6 +8886,7 @@
C59C4A5818B81174007BDCB6 /* AssistedNodeInformation.cpp in Sources */,
515E7727183DD6F60007203F /* AsyncRequest.cpp in Sources */,
BCEE966C112FAF57006BCC24 /* Attachment.cpp in Sources */,
+ 2D1087631D2C641B00B85F82 /* LoadParametersCocoa.mm in Sources */,
E1A31735134CEA80007C9A4F /* AttributedString.mm in Sources */,
512F589612A8838800629530 /* AuthenticationChallengeProxy.cpp in Sources */,
512F589812A8838800629530 /* AuthenticationDecisionListener.cpp in Sources */,
@@ -8937,6 +8947,7 @@
1A64229912DD029200CAAE2C /* DrawingAreaMessageReceiver.cpp in Sources */,
BC2652161182608100243E12 /* DrawingAreaProxy.cpp in Sources */,
1A64230812DD09EB00CAAE2C /* DrawingAreaProxyMessageReceiver.cpp in Sources */,
+ 2DC4CF7B1D2DE24B00ECCC94 /* WebPageCocoa.mm in Sources */,
8CFECE941490F140002AAA32 /* EditorState.cpp in Sources */,
51B15A8413843A3900321AD8 /* EnvironmentUtilities.cpp in Sources */,
1AA575FA1496B52600A4EE06 /* EventDispatcher.cpp in Sources */,
@@ -9059,6 +9070,7 @@
1A2D82A6127F4EAB001EB962 /* NPObjectProxy.cpp in Sources */,
1A2D82A8127F4EAB001EB962 /* NPRemoteObjectMap.cpp in Sources */,
1A2161B111F37664008AD0F5 /* NPRuntimeObjectMap.cpp in Sources */,
+ 2D1087601D2C573E00B85F82 /* LoadParameters.cpp in Sources */,
1A2162B011F38971008AD0F5 /* NPRuntimeUtilities.cpp in Sources */,
1A2D84A4127F6AD1001EB962 /* NPVariantData.cpp in Sources */,
BC8ACA1416670D89004C1941 /* ObjCObjectGraph.mm in Sources */,
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (202888 => 202889)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2016-07-07 03:03:42 UTC (rev 202889)
@@ -1629,7 +1629,7 @@
return webPage->accessibilityRemoteObject();
}
-NSCachedURLResponse* WebFrameLoaderClient::willCacheResponse(DocumentLoader*, unsigned long identifier, NSCachedURLResponse* response) const
+NSCachedURLResponse *WebFrameLoaderClient::willCacheResponse(DocumentLoader*, unsigned long identifier, NSCachedURLResponse* response) const
{
WebPage* webPage = m_frame->page();
if (!webPage)
@@ -1638,6 +1638,15 @@
return webPage->injectedBundleResourceLoadClient().shouldCacheResponse(webPage, m_frame, identifier) ? response : nil;
}
+NSDictionary *WebFrameLoaderClient::dataDetectionContext()
+{
+ WebPage* webPage = m_frame->page();
+ if (!webPage)
+ return nil;
+
+ return webPage->dataDetectionContext();
+}
+
#endif // PLATFORM(COCOA)
bool WebFrameLoaderClient::shouldAlwaysUsePluginDocument(const String& /*mimeType*/) const
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (202888 => 202889)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2016-07-07 03:03:42 UTC (rev 202889)
@@ -221,6 +221,8 @@
RemoteAXObjectRef accessibilityRemoteObject() override;
NSCachedURLResponse* willCacheResponse(WebCore::DocumentLoader*, unsigned long identifier, NSCachedURLResponse*) const override;
+
+ NSDictionary *dataDetectionContext() override;
#endif
bool shouldAlwaysUsePluginDocument(const String& /*mimeType*/) const override;
Copied: trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (from rev 202888, trunk/Source/WebKit2/UIProcess/Cocoa/WebPageProxyCocoa.mm) (0 => 202889)
--- trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2016-07-07 03:03:42 UTC (rev 202889)
@@ -0,0 +1,44 @@
+/*
+ * 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 "WebPage.h"
+
+#import "LoadParameters.h"
+
+#if PLATFORM(COCOA)
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void WebPage::platformDidReceiveLoadParameters(const LoadParameters& loadParameters)
+{
+ m_dataDetectionContext = loadParameters.dataDetectionContext;
+}
+
+} // namespace WebKit
+
+#endif // PLATFORM(COCOA)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (202888 => 202889)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-07-07 03:03:42 UTC (rev 202889)
@@ -41,6 +41,7 @@
#include "InjectedBundle.h"
#include "InjectedBundleBackForwardList.h"
#include "InjectedBundleScriptWorld.h"
+#include "LoadParameters.h"
#include "Logging.h"
#include "NetscapePlugin.h"
#include "NotificationPermissionRequestManager.h"
@@ -1139,21 +1140,29 @@
frame->coreFrame()->loader().load(FrameLoadRequest(frame->coreFrame(), ResourceRequest(URL(URL(), url)), ShouldOpenExternalURLsPolicy::ShouldNotAllow));
}
-void WebPage::loadRequest(uint64_t navigationID, const ResourceRequest& request, const SandboxExtension::Handle& sandboxExtensionHandle, uint64_t shouldOpenExternalURLsPolicy, const UserData& userData)
+#if !PLATFORM(COCOA)
+void WebPage::platformDidReceiveLoadParameters(const LoadParameters& loadParameters)
{
+}
+#endif
+
+void WebPage::loadRequest(const LoadParameters& loadParameters)
+{
SendStopResponsivenessTimer stopper(this);
- m_pendingNavigationID = navigationID;
+ m_pendingNavigationID = loadParameters.navigationID;
- m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), sandboxExtensionHandle);
+ m_sandboxExtensionTracker.beginLoad(m_mainFrame.get(), loadParameters.sandboxExtensionHandle);
// Let the InjectedBundle know we are about to start the load, passing the user data from the UIProcess
// to all the client to set up any needed state.
- m_loaderClient.willLoadURLRequest(this, request, WebProcess::singleton().transformHandlesToObjects(userData.object()).get());
+ m_loaderClient.willLoadURLRequest(this, loadParameters.request, WebProcess::singleton().transformHandlesToObjects(loadParameters.userData.object()).get());
+ platformDidReceiveLoadParameters(loadParameters);
+
// Initate the load in WebCore.
- FrameLoadRequest frameLoadRequest(m_mainFrame->coreFrame(), request, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
- ShouldOpenExternalURLsPolicy externalURLsPolicy = static_cast<ShouldOpenExternalURLsPolicy>(shouldOpenExternalURLsPolicy);
+ FrameLoadRequest frameLoadRequest(m_mainFrame->coreFrame(), loadParameters.request, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
+ ShouldOpenExternalURLsPolicy externalURLsPolicy = static_cast<ShouldOpenExternalURLsPolicy>(loadParameters.shouldOpenExternalURLsPolicy);
frameLoadRequest.setShouldOpenExternalURLsPolicy(externalURLsPolicy);
corePage()->userInputBridge().loadRequest(frameLoadRequest);
@@ -1179,7 +1188,7 @@
m_mainFrame->coreFrame()->loader().load(FrameLoadRequest(m_mainFrame->coreFrame(), request, ShouldOpenExternalURLsPolicy::ShouldNotAllow, substituteData));
}
-void WebPage::loadString(uint64_t navigationID, const String& htmlString, const String& MIMEType, const URL& baseURL, const URL& unreachableURL, const UserData& userData)
+void WebPage::loadStringImpl(uint64_t navigationID, const String& htmlString, const String& MIMEType, const URL& baseURL, const URL& unreachableURL, const UserData& userData)
{
if (!htmlString.isNull() && htmlString.is8Bit()) {
RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(htmlString.characters8()), htmlString.length() * sizeof(LChar));
@@ -1190,40 +1199,35 @@
}
}
-void WebPage::loadData(uint64_t navigationID, const IPC::DataReference& data, const String& MIMEType, const String& encodingName, const String& baseURLString, const UserData& userData)
+void WebPage::loadData(const LoadParameters& loadParameters)
{
- RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(data.data()), data.size());
- URL baseURL = baseURLString.isEmpty() ? blankURL() : URL(URL(), baseURLString);
- loadDataImpl(navigationID, sharedBuffer, MIMEType, encodingName, baseURL, URL(), userData);
+ platformDidReceiveLoadParameters(loadParameters);
+
+ RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(loadParameters.data.data()), loadParameters.data.size());
+ URL baseURL = loadParameters.baseURLString.isEmpty() ? blankURL() : URL(URL(), loadParameters.baseURLString);
+ loadDataImpl(loadParameters.navigationID, sharedBuffer, loadParameters.MIMEType, loadParameters.encodingName, baseURL, URL(), loadParameters.userData);
}
-void WebPage::loadHTMLString(uint64_t navigationID, const String& htmlString, const String& baseURLString, const UserData& userData)
+void WebPage::loadString(const LoadParameters& loadParameters)
{
- URL baseURL = baseURLString.isEmpty() ? blankURL() : URL(URL(), baseURLString);
- loadString(navigationID, htmlString, ASCIILiteral("text/html"), baseURL, URL(), userData);
+ platformDidReceiveLoadParameters(loadParameters);
+
+ URL baseURL = loadParameters.baseURLString.isEmpty() ? blankURL() : URL(URL(), loadParameters.baseURLString);
+ loadStringImpl(loadParameters.navigationID, loadParameters.string, loadParameters.MIMEType, baseURL, URL(), loadParameters.userData);
}
-void WebPage::loadAlternateHTMLString(const String& htmlString, const String& baseURLString, const String& unreachableURLString, const String& provisionalLoadErrorURLString, const UserData& userData)
+void WebPage::loadAlternateHTMLString(const LoadParameters& loadParameters)
{
- URL baseURL = baseURLString.isEmpty() ? blankURL() : URL(URL(), baseURLString);
- URL unreachableURL = unreachableURLString.isEmpty() ? URL() : URL(URL(), unreachableURLString);
- URL provisionalLoadErrorURL = provisionalLoadErrorURLString.isEmpty() ? URL() : URL(URL(), provisionalLoadErrorURLString);
+ platformDidReceiveLoadParameters(loadParameters);
+
+ URL baseURL = loadParameters.baseURLString.isEmpty() ? blankURL() : URL(URL(), loadParameters.baseURLString);
+ URL unreachableURL = loadParameters.unreachableURLString.isEmpty() ? URL() : URL(URL(), loadParameters.unreachableURLString);
+ URL provisionalLoadErrorURL = loadParameters.provisionalLoadErrorURLString.isEmpty() ? URL() : URL(URL(), loadParameters.provisionalLoadErrorURLString);
m_mainFrame->coreFrame()->loader().setProvisionalLoadErrorBeingHandledURL(provisionalLoadErrorURL);
- loadString(0, htmlString, ASCIILiteral("text/html"), baseURL, unreachableURL, userData);
+ loadStringImpl(0, loadParameters.string, ASCIILiteral("text/html"), baseURL, unreachableURL, loadParameters.userData);
m_mainFrame->coreFrame()->loader().setProvisionalLoadErrorBeingHandledURL({ });
}
-void WebPage::loadPlainTextString(const String& string, const UserData& userData)
-{
- loadString(0, string, ASCIILiteral("text/plain"), blankURL(), URL(), userData);
-}
-
-void WebPage::loadWebArchiveData(const IPC::DataReference& webArchiveData, const UserData& userData)
-{
- RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(webArchiveData.data()), webArchiveData.size() * sizeof(uint8_t));
- loadDataImpl(0, sharedBuffer, ASCIILiteral("application/x-webarchive"), ASCIILiteral("utf-16"), blankURL(), URL(), userData);
-}
-
void WebPage::navigateToPDFLinkWithSimulatedClick(const String& url, IntPoint documentPoint, IntPoint screenPoint)
{
Frame* mainFrame = m_mainFrame->coreFrame();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (202888 => 202889)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-07-07 03:03:42 UTC (rev 202889)
@@ -192,6 +192,7 @@
struct EditingRange;
struct EditorState;
struct InteractionInformationAtPosition;
+struct LoadParameters;
struct PrintInfo;
struct WebPageCreationParameters;
struct WebPreferencesStore;
@@ -853,6 +854,8 @@
bool shouldUsePDFPlugin() const;
bool pdfPluginEnabled() const { return m_pdfPluginEnabled; }
void setPDFPluginEnabled(bool enabled) { m_pdfPluginEnabled = enabled; }
+
+ NSDictionary *dataDetectionContext() const { return m_dataDetectionContext.get(); }
#endif
void savePDFToFileInDownloadsFolder(const String& suggestedFilename, const String& originatingURLString, const uint8_t* data, unsigned long size);
@@ -998,18 +1001,17 @@
String sourceForFrame(WebFrame*);
void loadDataImpl(uint64_t navigationID, PassRefPtr<WebCore::SharedBuffer>, const String& MIMEType, const String& encodingName, const WebCore::URL& baseURL, const WebCore::URL& failingURL, const UserData&);
- void loadString(uint64_t navigationID, const String&, const String& MIMEType, const WebCore::URL& baseURL, const WebCore::URL& failingURL, const UserData&);
+ void loadStringImpl(uint64_t navigationID, const String&, const String& MIMEType, const WebCore::URL& baseURL, const WebCore::URL& failingURL, const UserData&);
bool platformHasLocalDataForURL(const WebCore::URL&);
// Actions
void tryClose();
- void loadRequest(uint64_t navigationID, const WebCore::ResourceRequest&, const SandboxExtension::Handle&, uint64_t shouldOpenExternalURLsPolicy, const UserData&);
- void loadData(uint64_t navigationID, const IPC::DataReference&, const String& MIMEType, const String& encodingName, const String& baseURL, const UserData&);
- void loadHTMLString(uint64_t navigationID, const String& htmlString, const String& baseURL, const UserData&);
- void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL, const String& provisionalLoadErrorURL, const UserData&);
- void loadPlainTextString(const String&, const UserData&);
- void loadWebArchiveData(const IPC::DataReference&, const UserData&);
+ void platformDidReceiveLoadParameters(const LoadParameters&);
+ void loadRequest(const LoadParameters&);
+ void loadData(const LoadParameters&);
+ void loadString(const LoadParameters&);
+ void loadAlternateHTMLString(const LoadParameters&);
void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
void reload(uint64_t navigationID, bool reloadFromOrigin, bool contentBlockersEnabled, const SandboxExtension::Handle&);
void goForward(uint64_t navigationID, uint64_t);
@@ -1280,6 +1282,8 @@
ViewGestureGeometryCollector m_viewGestureGeometryCollector;
+ RetainPtr<NSDictionary> m_dataDetectionContext;
+
#elif HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
GRefPtr<WebPageAccessibilityObject> m_accessibilityObject;
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (202888 => 202889)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2016-07-07 03:03:42 UTC (rev 202889)
@@ -132,12 +132,11 @@
TryRestoreScrollPosition()
LoadURLInFrame(String url, uint64_t frameID)
- LoadRequest(uint64_t navigationID, WebCore::ResourceRequest request, WebKit::SandboxExtension::Handle sandboxExtensionHandle, uint64_t shouldOpenExternalURLsPolicy, WebKit::UserData userData)
- LoadData(uint64_t navigationID, IPC::DataReference data, String MIMEType, String encoding, String baseURL, WebKit::UserData userData)
- LoadHTMLString(uint64_t navigationID, String htmlString, String baseURL, WebKit::UserData userData)
- LoadAlternateHTMLString(String htmlString, String baseURL, String unreachableURL, String provisionalLoadErrorURL, WebKit::UserData userData)
- LoadPlainTextString(String string, WebKit::UserData userData)
- LoadWebArchiveData(IPC::DataReference webArchiveData, WebKit::UserData userData)
+ LoadRequest(struct WebKit::LoadParameters loadParameters)
+ LoadData(struct WebKit::LoadParameters loadParameters)
+ LoadString(struct WebKit::LoadParameters loadParameters)
+ LoadAlternateHTMLString(struct WebKit::LoadParameters loadParameters)
+
NavigateToPDFLinkWithSimulatedClick(String url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint)
Reload(uint64_t navigationID, bool reloadFromOrigin, bool contentBlockersEnabled, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
Modified: trunk/Tools/ChangeLog (202888 => 202889)
--- trunk/Tools/ChangeLog 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Tools/ChangeLog 2016-07-07 03:03:42 UTC (rev 202889)
@@ -1,3 +1,20 @@
+2016-07-06 Tim Horton <[email protected]>
+
+ Email from June 1st containing text 'Today @ 7:10PM' is linkified, but shouldn't be
+ https://bugs.webkit.org/show_bug.cgi?id=159498
+ <rdar://problem/26719903>
+
+ Reviewed by Sam Weinig.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/DataDetection.mm: Added.
+ (-[DataDetectionNavigationDelegate webView:didFinishNavigation:]):
+ (-[DataDetectionUIDelegate _dataDetectionContextForWebView:]):
+ (expectLinkCount):
+ (TEST):
+ Add a test ensuring that ReferenceDate in the DataDetectors context is respected
+ when deciding what to linkify.
+
2016-07-06 Alexey Proskuryakov <[email protected]>
Build fix - work around rdar://problem/27196668.
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (202888 => 202889)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-07-07 01:32:43 UTC (rev 202888)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-07-07 03:03:42 UTC (rev 202889)
@@ -49,6 +49,7 @@
2D00065F1C1F589A0088E6A7 /* WKPDFViewResizeCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */; };
2D1646E21D1862CD00015A1A /* DeferredViewInWindowStateChange.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D1646E11D1862CD00015A1A /* DeferredViewInWindowStateChange.mm */; };
2D51A0C71C8BF00C00765C45 /* DOMHTMLVideoElementWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D51A0C51C8BF00400765C45 /* DOMHTMLVideoElementWrapper.mm */; };
+ 2DC4CF771D2D9DD800ECCC94 /* DataDetection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DC4CF761D2D9DD800ECCC94 /* DataDetection.mm */; };
2DD7D3AF178227B30026E1E3 /* lots-of-text-vertical-lr.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 2DD7D3AE178227AC0026E1E3 /* lots-of-text-vertical-lr.html */; };
2E7765CD16C4D80A00BA2BB1 /* mainIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E7765CC16C4D80A00BA2BB1 /* mainIOS.mm */; };
2E7765CF16C4D81100BA2BB1 /* mainMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2E7765CE16C4D81100BA2BB1 /* mainMac.mm */; };
@@ -660,6 +661,7 @@
2D640B5417875DFF00BFAF99 /* ScrollPinningBehaviors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollPinningBehaviors.cpp; sourceTree = "<group>"; };
2D8104CB1BEC13E70020DA46 /* FindInPage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FindInPage.mm; sourceTree = "<group>"; };
2D9A53AE1B31FA8D0074D5AA /* ShrinkToFit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ShrinkToFit.mm; sourceTree = "<group>"; };
+ 2DC4CF761D2D9DD800ECCC94 /* DataDetection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataDetection.mm; sourceTree = "<group>"; };
2DD355351BD08378005DF4A7 /* AutoLayoutIntegration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AutoLayoutIntegration.mm; sourceTree = "<group>"; };
2DD7D3A9178205D00026E1E3 /* ResizeReversePaginatedWebView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResizeReversePaginatedWebView.cpp; sourceTree = "<group>"; };
2DD7D3AE178227AC0026E1E3 /* lots-of-text-vertical-lr.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "lots-of-text-vertical-lr.html"; sourceTree = "<group>"; };
@@ -1166,6 +1168,7 @@
A14FC5861B8991B600D107EB /* ContentFiltering.mm */,
A14FC5891B89927100D107EB /* ContentFilteringPlugIn.mm */,
1AAD19F51C7CE20300831E47 /* Coding.mm */,
+ 2DC4CF761D2D9DD800ECCC94 /* DataDetection.mm */,
A1A4FE5D18DD3DB700B5EA8A /* Download.mm */,
2D8104CB1BEC13E70020DA46 /* FindInPage.mm */,
2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */,
@@ -2128,6 +2131,7 @@
764322D71B61CCC30024F801 /* WordBoundaryTypingAttributes.mm in Sources */,
7CCE7F051A411AE600447C4C /* NewFirstVisuallyNonEmptyLayoutFrames.cpp in Sources */,
7CCE7F251A411AF600447C4C /* OpenAndCloseWindow.mm in Sources */,
+ 2DC4CF771D2D9DD800ECCC94 /* DataDetection.mm in Sources */,
7CCE7F071A411AE600447C4C /* PageLoadBasic.cpp in Sources */,
7C83E0C11D0A652F00FEBCF3 /* ProvisionalURLNotChange.mm in Sources */,
7CCE7F081A411AE600447C4C /* PageLoadDidChangeLocationWithinPageForFrame.cpp in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DataDetection.mm (0 => 202889)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DataDetection.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DataDetection.mm 2016-07-07 03:03:42 UTC (rev 202889)
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import <WebKit/WebKit.h>
+#import <wtf/RetainPtr.h>
+
+#if WK_API_ENABLED && PLATFORM(IOS)
+
+static bool finishedLoading;
+static bool ranScript;
+
+@interface DataDetectionNavigationDelegate : NSObject <WKNavigationDelegate>
+@end
+
+@implementation DataDetectionNavigationDelegate
+
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
+{
+ finishedLoading = true;
+}
+
+@end
+
+@interface DataDetectionUIDelegate : NSObject <WKUIDelegate>
+
+@property (nonatomic, retain) NSDate *referenceDate;
+
+@end
+
+@implementation DataDetectionUIDelegate
+
+- (NSDictionary *)_dataDetectionContextForWebView:(WKWebView *)webView
+{
+ if (!_referenceDate)
+ return nil;
+
+ return @{
+ @"ReferenceDate": _referenceDate
+ };
+}
+
+@end
+
+void expectLinkCount(WKWebView *webView, NSString *HTMLString, unsigned linkCount)
+{
+ [webView loadHTMLString:HTMLString baseURL:nil];
+
+ TestWebKitAPI::Util::run(&finishedLoading);
+ finishedLoading = false;
+
+ [webView evaluateJavaScript:@"document.getElementsByTagName('a').length" completionHandler:^(id value, NSError *error) {
+ EXPECT_EQ(linkCount, [value unsignedIntValue]);
+ ranScript = true;
+ }];
+
+ TestWebKitAPI::Util::run(&ranScript);
+ ranScript = false;
+}
+
+TEST(WebKit2, DataDetectionReferenceDate)
+{
+ RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ [configuration setDataDetectorTypes:WKDataDetectorTypeCalendarEvent];
+
+ RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+
+ RetainPtr<DataDetectionNavigationDelegate> navigationDelegate = adoptNS([[DataDetectionNavigationDelegate alloc] init]);
+ [webView setNavigationDelegate:navigationDelegate.get()];
+
+ RetainPtr<DataDetectionUIDelegate> UIDelegate = adoptNS([[DataDetectionUIDelegate alloc] init]);
+ [webView setUIDelegate:UIDelegate.get()];
+
+ expectLinkCount(webView.get(), @"tomorrow at 6PM", 1);
+ expectLinkCount(webView.get(), @"yesterday at 6PM", 0);
+
+ NSTimeInterval week = 60 * 60 * 24 * 7;
+
+ [UIDelegate setReferenceDate:[NSDate dateWithTimeIntervalSinceNow:-week]];
+ expectLinkCount(webView.get(), @"tomorrow at 6PM", 0);
+ expectLinkCount(webView.get(), @"yesterday at 6PM", 0);
+
+ [UIDelegate setReferenceDate:[NSDate dateWithTimeIntervalSinceNow:week]];
+ expectLinkCount(webView.get(), @"tomorrow at 6PM", 1);
+ expectLinkCount(webView.get(), @"yesterday at 6PM", 1);
+}
+
+#endif