Cache results of data detection in the UI process when load completes.
authorenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jan 2016 01:36:06 +0000 (01:36 +0000)
committerenrica@apple.com <enrica@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jan 2016 01:36:06 +0000 (01:36 +0000)
commitb373cb0c91b74ea879329d0bbac4168a1d603062
tree2c4131fbf665493f03e2cc2835bd979bf5f611e7
parent9f44b7ab1f857a5a18710e702f305d35523306d6
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195722 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
Source/WebCore/ChangeLog
Source/WebCore/loader/EmptyClients.h
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/FrameLoaderClient.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/Cocoa/DataDetectionResult.h [new file with mode: 0644]
Source/WebKit2/Shared/Cocoa/DataDetectionResult.mm [new file with mode: 0644]
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit2/UIProcess/Cocoa/WebPageProxyCocoa.mm
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h