Title: [195722] trunk/Source
Revision
195722
Author
[email protected]
Date
2016-01-27 17:36:06 -0800 (Wed, 27 Jan 2016)

Log Message

Cache results of data detection in the UI process when load completes.
https://bugs.webkit.org/show_bug.cgi?id=153560

Reviewed by Tim Horton.

Source/WebCore:

Adding new FrameLoaderClient method to notify that data
detection is complete and provide the results.

* loader/EmptyClients.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
* loader/FrameLoaderClient.h:

Source/WebKit/mac:

Adding empty implementation for WK1.

* WebCoreSupport/WebFrameLoaderClient.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::dispatchDidFinishDataDetection):

Source/WebKit2:

This patch changes when the results of data detections are sent to the
UIProcess. Before this change, they were only provided as part of
InteractionInformationAtPosition, which is populated when long press
gesture is triggered.
We need to have the results available if the client wants to allow navigation
to a data detector link, in order to allow them to retrieve the full url.
With this change, we now send the results as soon as they are computed
and keep them in the WebPageProxy object so that they can be fetched when
necessary from a WKWebView private interface.

* Shared/Cocoa/DataDetectionResult.h: Added.
* Shared/Cocoa/DataDetectionResult.mm: Added.
(WebKit::DataDetectionResult::encode):
(WebKit::DataDetectionResult::decode):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _snapshotLayerContentsForBackForwardListItem:]):
(-[WKWebView _dataDetectionResults]):
(-[WKWebView _didRelaunchProcess]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::setDataDetectionResult):
(WebKit::WebPageProxy::saveRecentSearches):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::websiteDataStore):
(WebKit::WebPageProxy::dataDetectionResults):
(WebKit::WebPageProxy::scrollingCoordinatorProxy):
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView ensurePositionInformationIsUpToDate:]):
(-[WKContentView _dataDetectionResults]):
(-[WKContentView gestureRecognizerShouldBegin:]):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidReceiveContentLength):
(WebKit::WebFrameLoaderClient::dispatchDidFinishDataDetection):
(WebKit::WebFrameLoaderClient::dispatchDidFinishLoading):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
(WebKit::WebPage::setDataDetectionResults):
(WebKit::WebPage::willCommitLayerTree):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::shouldExtendIncrementalRenderingSuppression):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (195721 => 195722)


--- trunk/Source/WebCore/ChangeLog	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebCore/ChangeLog	2016-01-28 01:36:06 UTC (rev 195722)
@@ -1,3 +1,18 @@
+2016-01-27  Enrica Casucci  <[email protected]>
+
+        Cache results of data detection in the UI process when load completes.
+        https://bugs.webkit.org/show_bug.cgi?id=153560
+
+        Reviewed by Tim Horton.
+
+        Adding new FrameLoaderClient method to notify that data
+        detection is complete and provide the results.
+
+        * loader/EmptyClients.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
+        * loader/FrameLoaderClient.h:
+
 2016-01-27  Daniel Bates  <[email protected]>
 
         Move ContentSecurityPolicy.{cpp, h} to its own directory

Modified: trunk/Source/WebCore/loader/EmptyClients.h (195721 => 195722)


--- trunk/Source/WebCore/loader/EmptyClients.h	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebCore/loader/EmptyClients.h	2016-01-28 01:36:06 UTC (rev 195722)
@@ -268,6 +268,9 @@
     virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse&) override { }
     virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int) override { }
     virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long) override { }
+#if ENABLE(DATA_DETECTION)
+    virtual void dispatchDidFinishDataDetection(NSArray *) override { }
+#endif
     virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&) override { }
     virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int) override { return false; }
 

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (195721 => 195722)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2016-01-28 01:36:06 UTC (rev 195722)
@@ -2283,6 +2283,8 @@
                 if (m_frame.settings().dataDetectorTypes() != DataDetectorTypeNone) {
                     RefPtr<Range> documentRange = makeRange(firstPositionInNode(m_frame.document()->documentElement()), lastPositionInNode(m_frame.document()->documentElement()));
                     m_frame.setDataDetectionResults(DataDetection::detectContentInRange(documentRange, m_frame.settings().dataDetectorTypes()));
+                    if (m_frame.isMainFrame())
+                        m_client.dispatchDidFinishDataDetection(m_frame.dataDetectionResults());
                 }
 #endif
                 m_client.dispatchDidFinishLoad();

Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (195721 => 195722)


--- trunk/Source/WebCore/loader/FrameLoaderClient.h	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h	2016-01-28 01:36:06 UTC (rev 195722)
@@ -55,6 +55,7 @@
 typedef class _jobject* jobject;
 
 #if PLATFORM(COCOA)
+OBJC_CLASS NSArray;
 OBJC_CLASS NSCachedURLResponse;
 OBJC_CLASS NSView;
 #endif
@@ -173,6 +174,9 @@
         virtual void dispatchDidFailLoad(const ResourceError&) = 0;
         virtual void dispatchDidFinishDocumentLoad() = 0;
         virtual void dispatchDidFinishLoad() = 0;
+#if ENABLE(DATA_DETECTION)
+        virtual void dispatchDidFinishDataDetection(NSArray *detectionResults) = 0;
+#endif
 
         virtual void dispatchDidLayout() { }
         virtual void dispatchDidLayout(LayoutMilestones) { }

Modified: trunk/Source/WebKit/mac/ChangeLog (195721 => 195722)


--- trunk/Source/WebKit/mac/ChangeLog	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-01-28 01:36:06 UTC (rev 195722)
@@ -1,3 +1,16 @@
+2016-01-27  Enrica Casucci  <[email protected]>
+
+        Cache results of data detection in the UI process when load completes.
+        https://bugs.webkit.org/show_bug.cgi?id=153560
+
+        Reviewed by Tim Horton.
+
+        Adding empty implementation for WK1.
+
+        * WebCoreSupport/WebFrameLoaderClient.h:
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::dispatchDidFinishDataDetection):
+
 2016-01-27  Anders Carlsson  <[email protected]>
 
         Add WebKitAdditions extension points to WebCore, WebKit and WebKitLegacy

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h (195721 => 195722)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h	2016-01-28 01:36:06 UTC (rev 195722)
@@ -92,6 +92,9 @@
     virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&) override;
     virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength) override;
     virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier) override;
+#if ENABLE(DATA_DETECTION)
+    virtual void dispatchDidFinishDataDetection(NSArray *detectionResults) override;
+#endif
     virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&) override;
 
     virtual NSCachedURLResponse* willCacheResponse(WebCore::DocumentLoader*, unsigned long identifier, NSCachedURLResponse*) const override;

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (195721 => 195722)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm	2016-01-28 01:36:06 UTC (rev 195722)
@@ -528,6 +528,10 @@
     }
 }
 
+void WebFrameLoaderClient::dispatchDidFinishDataDetection(NSArray *)
+{
+}
+
 void WebFrameLoaderClient::dispatchDidFinishLoading(DocumentLoader* loader, unsigned long identifier)
 {
     WebView *webView = getWebView(m_webFrame.get());

Modified: trunk/Source/WebKit2/ChangeLog (195721 => 195722)


--- trunk/Source/WebKit2/ChangeLog	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit2/ChangeLog	2016-01-28 01:36:06 UTC (rev 195722)
@@ -1,3 +1,55 @@
+2016-01-27  Enrica Casucci  <[email protected]>
+
+        Cache results of data detection in the UI process when load completes.
+        https://bugs.webkit.org/show_bug.cgi?id=153560
+
+        Reviewed by Tim Horton.
+
+        This patch changes when the results of data detections are sent to the
+        UIProcess. Before this change, they were only provided as part of
+        InteractionInformationAtPosition, which is populated when long press
+        gesture is triggered.
+        We need to have the results available if the client wants to allow navigation
+        to a data detector link, in order to allow them to retrieve the full url.
+        With this change, we now send the results as soon as they are computed
+        and keep them in the WebPageProxy object so that they can be fetched when
+        necessary from a WKWebView private interface.
+
+        * Shared/Cocoa/DataDetectionResult.h: Added.
+        * Shared/Cocoa/DataDetectionResult.mm: Added.
+        (WebKit::DataDetectionResult::encode):
+        (WebKit::DataDetectionResult::decode):
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _snapshotLayerContentsForBackForwardListItem:]):
+        (-[WKWebView _dataDetectionResults]):
+        (-[WKWebView _didRelaunchProcess]):
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+        (WebKit::WebPageProxy::setDataDetectionResult):
+        (WebKit::WebPageProxy::saveRecentSearches):
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::websiteDataStore):
+        (WebKit::WebPageProxy::dataDetectionResults):
+        (WebKit::WebPageProxy::scrollingCoordinatorProxy):
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView ensurePositionInformationIsUpToDate:]):
+        (-[WKContentView _dataDetectionResults]):
+        (-[WKContentView gestureRecognizerShouldBegin:]):
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDidReceiveContentLength):
+        (WebKit::WebFrameLoaderClient::dispatchDidFinishDataDetection):
+        (WebKit::WebFrameLoaderClient::dispatchDidFinishLoading):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+        (WebKit::WebPage::setDataDetectionResults):
+        (WebKit::WebPage::willCommitLayerTree):
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::shouldExtendIncrementalRenderingSuppression):
+
 2016-01-27  Anders Carlsson  <[email protected]>
 
         Include the right WebKitAdditions files

Added: trunk/Source/WebKit2/Shared/Cocoa/DataDetectionResult.h (0 => 195722)


--- trunk/Source/WebKit2/Shared/Cocoa/DataDetectionResult.h	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/Cocoa/DataDetectionResult.h	2016-01-28 01:36:06 UTC (rev 195722)
@@ -0,0 +1,48 @@
+/*
+ * 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 DataDetectionResult_h
+#define DataDetectionResult_h
+
+#if ENABLE(DATA_DETECTION)
+
+#import "ArgumentCoders.h"
+
+#import <wtf/RetainPtr.h>
+
+namespace WebKit {
+
+struct DataDetectionResult {
+    RetainPtr<NSArray> results;
+
+    void encode(IPC::ArgumentEncoder&) const;
+    static bool decode(IPC::ArgumentDecoder&, DataDetectionResult&);
+};
+
+}
+
+#endif // ENABLE(DATA_DETECTION)
+
+#endif // DataDetectionResult_h

Added: trunk/Source/WebKit2/Shared/Cocoa/DataDetectionResult.mm (0 => 195722)


--- trunk/Source/WebKit2/Shared/Cocoa/DataDetectionResult.mm	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/Cocoa/DataDetectionResult.mm	2016-01-28 01:36:06 UTC (rev 195722)
@@ -0,0 +1,73 @@
+/*
+ * 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 "config.h"
+#import "DataDetectionResult.h"
+
+#import "ArgumentCodersCF.h"
+#import "Arguments.h"
+#import "WebCoreArgumentCoders.h"
+#import <WebCore/DataDetectorsCoreSPI.h>
+#import <WebCore/SoftLinking.h>
+
+SOFT_LINK_PRIVATE_FRAMEWORK(DataDetectorsCore)
+SOFT_LINK_CLASS(DataDetectorsCore, DDScannerResult)
+
+namespace WebKit {
+
+#if ENABLE(DATA_DETECTION)
+
+void DataDetectionResult::encode(IPC::ArgumentEncoder& encoder) const
+{
+    RetainPtr<NSMutableData> data = "" alloc] init]);
+    RetainPtr<NSKeyedArchiver> archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+    [archiver setRequiresSecureCoding:YES];
+    [archiver encodeObject:results.get() forKey:@"dataDetectorResults"];
+    [archiver finishEncoding];
+    
+    IPC::encode(encoder, reinterpret_cast<CFDataRef>(data.get()));        
+}
+
+bool DataDetectionResult::decode(IPC::ArgumentDecoder& decoder, DataDetectionResult& result)
+{
+    RetainPtr<CFDataRef> data;
+    if (!IPC::decode(decoder, data))
+        return false;
+    
+    RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]);
+    [unarchiver setRequiresSecureCoding:YES];
+    @try {
+        result.results = [unarchiver decodeObjectOfClasses:[NSSet setWithArray:@[ [NSArray class], getDDScannerResultClass()] ] forKey:@"dataDetectorResults"];
+    } @catch (NSException *exception) {
+        LOG_ERROR("Failed to decode NSArray of DDScanResult: %@", exception);
+        return false;
+    }
+    
+    [unarchiver finishDecoding];
+    return true;
+}
+#endif
+
+}

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (195721 => 195722)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2016-01-28 01:36:06 UTC (rev 195722)
@@ -3122,6 +3122,10 @@
     return nil;
 }
 
+- (NSArray *)_dataDetectionResults
+{
+    return [_contentView _dataDetectionResults];
+}
 #endif
 
 - (void)_didRelaunchProcess

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (195721 => 195722)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h	2016-01-28 01:36:06 UTC (rev 195722)
@@ -170,6 +170,7 @@
 - (void)_becomeFirstResponderWithSelectionMovingForward:(BOOL)selectingForward completionHandler:(void (^)(BOOL didBecomeFirstResponder))completionHandler WK_AVAILABLE(NA, 9_0);
 
 - (id)_snapshotLayerContentsForBackForwardListItem:(WKBackForwardListItem *)item WK_AVAILABLE(NA, 9_0);
+- (NSArray *)_dataDetectionResults;
 
 #else
 @property (readonly) NSColor *_pageExtendedBackgroundColor;

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebPageProxyCocoa.mm (195721 => 195722)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebPageProxyCocoa.mm	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebPageProxyCocoa.mm	2016-01-28 01:36:06 UTC (rev 195722)
@@ -26,11 +26,20 @@
 #import "config.h"
 #import "WebProcessProxy.h"
 
+#import "DataDetectionResult.h"
+
 #import <WebCore/SearchPopupMenuCocoa.h>
 #import <wtf/cf/TypeCastsCF.h>
 
 namespace WebKit {
 
+#if ENABLE(DATA_DETECTION)
+void WebPageProxy::setDataDetectionResult(const DataDetectionResult& dataDetectionResult)
+{
+    m_dataDetectionResults = dataDetectionResult.results;
+}
+#endif
+
 void WebPageProxy::saveRecentSearches(const String& name, const Vector<WebCore::RecentSearch>& searchItems)
 {
     if (!name) {

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (195721 => 195722)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-01-28 01:36:06 UTC (rev 195722)
@@ -296,6 +296,10 @@
 
     WebsiteDataStore& websiteDataStore() { return m_websiteDataStore; }
 
+#if ENABLE(DATA_DETECTION)
+    NSArray *dataDetectionResults() { return m_dataDetectionResults.get(); }
+#endif
+        
 #if ENABLE(ASYNC_SCROLLING)
     RemoteScrollingCoordinatorProxy* scrollingCoordinatorProxy() const { return m_scrollingCoordinatorProxy.get(); }
 #endif
@@ -517,7 +521,9 @@
     void contentSizeCategoryDidChange(const String& contentSizeCategory);
     void getLookupContextAtPoint(const WebCore::IntPoint&, std::function<void(const String&, CallbackBase::Error)>);
 #endif
-
+#if ENABLE(DATA_DETECTION)
+    void setDataDetectionResult(const DataDetectionResult&);
+#endif
     void didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&);
 
 #if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
@@ -1408,6 +1414,10 @@
     void disableInspectorNodeSearch();
 #endif // PLATFORM(IOS)
 
+#if ENABLE(DATA_DETECTION)
+    RetainPtr<NSArray> m_dataDetectionResults;
+#endif
+
     void clearLoadDependentCallbacks();
 
     void performDragControllerAction(DragControllerAction, WebCore::DragData&, const String& dragStorageName, const SandboxExtension::Handle&, const SandboxExtension::HandleArray&);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (195721 => 195722)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2016-01-28 01:36:06 UTC (rev 195722)
@@ -186,6 +186,9 @@
     DisableDoubleTapGesturesDuringTapIfNecessary(uint64_t requestID)
     DidFinishDrawingPagesToPDF(IPC::DataReference pdfData)
 #endif
+#if ENABLE(DATA_DETECTION)
+    SetDataDetectionResult(struct WebKit::DataDetectionResult dataDetectionResult)
+#endif
 #if PLATFORM(GTK)
     PrintFinishedCallback(WebCore::ResourceError error, uint64_t callbackID)
 #endif

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (195721 => 195722)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h	2016-01-28 01:36:06 UTC (rev 195722)
@@ -211,6 +211,7 @@
 - (void)_disableInspectorNodeSearch;
 - (void)_becomeFirstResponderWithSelectionMovingForward:(BOOL)selectingForward completionHandler:(void (^)(BOOL didBecomeFirstResponder))completionHandler;
 - (void)_setDoubleTapGesturesEnabled:(BOOL)enabled;
+- (NSArray *)_dataDetectionResults;
 @end
 
 #if HAVE(LINK_PREVIEW)

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (195721 => 195722)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2016-01-28 01:36:06 UTC (rev 195722)
@@ -1100,6 +1100,13 @@
     }
 }
 
+#if ENABLE(DATA_DETECTION)
+- (NSArray *)_dataDetectionResults
+{
+    return _page->dataDetectionResults();
+}
+#endif
+
 - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
 {
     CGPoint point = [gestureRecognizer locationInView:self];

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (195721 => 195722)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2016-01-28 01:36:06 UTC (rev 195722)
@@ -1692,6 +1692,8 @@
 		C54256BA18BEC18C00DE4179 /* WKFormSelectControl.h in Headers */ = {isa = PBXBuildFile; fileRef = C54256B418BEC18C00DE4179 /* WKFormSelectControl.h */; };
 		C55CB5B718C269CF00CA81E1 /* WKFormSelectPopover.mm in Sources */ = {isa = PBXBuildFile; fileRef = C57193BA18C149D0002D0F12 /* WKFormSelectPopover.mm */; };
 		C55CB5B818C2A5D600CA81E1 /* WKFormSelectPicker.mm in Sources */ = {isa = PBXBuildFile; fileRef = C57193B918C149D0002D0F12 /* WKFormSelectPicker.mm */; };
+		C55F91701C595F630029E92D /* DataDetectionResult.mm in Sources */ = {isa = PBXBuildFile; fileRef = C55F916D1C595E440029E92D /* DataDetectionResult.mm */; };
+		C55F91711C59676E0029E92D /* DataDetectionResult.h in Headers */ = {isa = PBXBuildFile; fileRef = C55F916C1C595E440029E92D /* DataDetectionResult.h */; };
 		C57193BE18C14A44002D0F12 /* WKFormSelectControl.mm in Sources */ = {isa = PBXBuildFile; fileRef = C57193BD18C14A43002D0F12 /* WKFormSelectControl.mm */; };
 		C574A37712E6099D002DFE98 /* WebDragClientMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C554FFA212E4E8EA002F22C0 /* WebDragClientMac.mm */; };
 		C574A58112E66681002DFE98 /* PasteboardTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = C574A57F12E66681002DFE98 /* PasteboardTypes.h */; };
@@ -3935,6 +3937,8 @@
 		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>"; };
 		C554FFA212E4E8EA002F22C0 /* WebDragClientMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDragClientMac.mm; sourceTree = "<group>"; };
+		C55F916C1C595E440029E92D /* DataDetectionResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataDetectionResult.h; sourceTree = "<group>"; };
+		C55F916D1C595E440029E92D /* DataDetectionResult.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataDetectionResult.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>"; };
 		C57193BD18C14A43002D0F12 /* WKFormSelectControl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFormSelectControl.mm; path = ios/forms/WKFormSelectControl.mm; sourceTree = "<group>"; };
@@ -5418,6 +5422,8 @@
 				378E1A3B181ED6FF0031007A /* APIObject.mm */,
 				37BEC4DF19491486008B4286 /* CompletionHandlerCallChecker.h */,
 				37BEC4DE19491486008B4286 /* CompletionHandlerCallChecker.mm */,
+				C55F916C1C595E440029E92D /* DataDetectionResult.h */,
+				C55F916D1C595E440029E92D /* DataDetectionResult.mm */,
 				1A781AE51C5714DA00FB96DD /* WebKitAdditions.mm */,
 				37C4C0921814B3AF003688B9 /* WKNSArray.h */,
 				37C4C0911814B3AF003688B9 /* WKNSArray.mm */,
@@ -8101,6 +8107,7 @@
 				BC5744F012638FB3006F0F12 /* WebPopupItem.h in Headers */,
 				D3B9484711FF4B6500032B39 /* WebPopupMenu.h in Headers */,
 				BC574E631267D080006F0F12 /* WebPopupMenuProxy.h in Headers */,
+				C55F91711C59676E0029E92D /* DataDetectionResult.h in Headers */,
 				BC5750971268F3C6006F0F12 /* WebPopupMenuProxyMac.h in Headers */,
 				BCD597FF112B57BE00EC8C23 /* WebPreferences.h in Headers */,
 				7C85FD7C193415A8000177C4 /* WebPreferencesDefinitions.h in Headers */,
@@ -9637,6 +9644,7 @@
 				37716A5A195B910500EE8B1B /* ProcessAssertion.cpp in Sources */,
 				86F9536418FF583C001DB2EF /* ProcessAssertionIOS.mm in Sources */,
 				9395E68C1BF2C35200F49BCE /* _WKPreviewElementInfo.mm in Sources */,
+				C55F91701C595F630029E92D /* DataDetectionResult.mm in Sources */,
 				1AE117F611DBB30900981615 /* ProcessLauncher.cpp in Sources */,
 				BC111B1D112F5FE600337BAB /* ProcessLauncherMac.mm in Sources */,
 				86E67A261910B9D900004AB7 /* ProcessThrottler.cpp in Sources */,

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (195721 => 195722)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2016-01-28 01:36:06 UTC (rev 195722)
@@ -236,6 +236,16 @@
     webPage->injectedBundleResourceLoadClient().didReceiveContentLengthForResource(webPage, m_frame, identifier, dataLength);
 }
 
+#if ENABLE(DATA_DETECTION)
+void WebFrameLoaderClient::dispatchDidFinishDataDetection(NSArray *detectionResults)
+{
+    WebPage* webPage = m_frame->page();
+    if (!webPage)
+        return;
+    webPage->setDataDetectionResults(detectionResults);
+}
+#endif
+
 void WebFrameLoaderClient::dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier)
 {
     WebPage* webPage = m_frame->page();

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (195721 => 195722)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h	2016-01-28 01:36:06 UTC (rev 195722)
@@ -81,6 +81,9 @@
     virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier) override;
     virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&) override;
     virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int length) override;
+#if ENABLE(DATA_DETECTION)
+    virtual void dispatchDidFinishDataDetection(NSArray *detectionResults) override;
+#endif
     
     virtual void dispatchDidDispatchOnloadEvents() override;
     virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() override;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (195721 => 195722)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-01-28 01:36:06 UTC (rev 195722)
@@ -170,6 +170,10 @@
 #include <wtf/RunLoop.h>
 #include <wtf/TemporaryChange.h>
 
+#if ENABLE(DATA_DETECTION)
+#include "DataDetectionResult.h"
+#endif
+
 #if ENABLE(MHTML)
 #include <WebCore/MHTMLArchive.h>
 #endif
@@ -2977,6 +2981,15 @@
 #endif
 }
 
+#if ENABLE(DATA_DETECTION)
+void WebPage::setDataDetectionResults(NSArray *detectionResults)
+{
+    DataDetectionResult dataDetectionResult;
+    dataDetectionResult.results = detectionResults;
+    send(Messages::WebPageProxy::SetDataDetectionResult(dataDetectionResult));
+}
+#endif
+
 #if PLATFORM(COCOA)
 void WebPage::willCommitLayerTree(RemoteLayerTreeTransaction& layerTransaction)
 {

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (195721 => 195722)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2016-01-28 01:34:33 UTC (rev 195721)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2016-01-28 01:36:06 UTC (rev 195722)
@@ -109,6 +109,7 @@
 #include "ViewGestureGeometryCollector.h"
 #include <wtf/RetainPtr.h>
 OBJC_CLASS CALayer;
+OBJC_CLASS NSArray;
 OBJC_CLASS NSDictionary;
 OBJC_CLASS NSObject;
 OBJC_CLASS WKAccessibilityWebPageObject;
@@ -866,6 +867,10 @@
     bool plugInIsPrimarySize(WebCore::HTMLPlugInImageElement& pluginImageElement, unsigned &pluginArea);
 #endif
 
+#if ENABLE(DATA_DETECTION)
+    void setDataDetectionResults(NSArray *);
+#endif
+
     unsigned extendIncrementalRenderingSuppression();
     void stopExtendingIncrementalRenderingSuppression(unsigned token);
     bool shouldExtendIncrementalRenderingSuppression() { return !m_activeRenderingSuppressionTokens.isEmpty(); }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to