Provide a prototype for AR QuickLook to trigger processing in the originating page
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Sep 2019 21:43:18 +0000 (21:43 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Sep 2019 21:43:18 +0000 (21:43 +0000)
commitdc59ddbe6a6c964c4d0f54d0d3f9a8d6dec88f4d
treee5ca273589b3470e2dbc56e4a71f7739bdb8a6c3
parent88e53c4edf10f2d7ddfde1e9511f99b04427d168
Provide a prototype for AR QuickLook to trigger processing in the originating page
https://bugs.webkit.org/show_bug.cgi?id=201371
<rdar://54904781>

Reviewed by Simon Fraser.

Source/WebCore:

* dom/Document.cpp:
(WebCore::Document::dispatchSystemPreviewActionEvent): Create and dispatch a MessageEvent.
* dom/Document.h:

* html/HTMLAnchorElement.cpp: Send along the page and frame identifiers for this
object to ensure that any reply goes to the correct place.
(WebCore::HTMLAnchorElement::handleClick):

* loader/FrameLoadRequest.h: Use the new SystemPreviewInfo type.
(WebCore::FrameLoadRequest::isSystemPreview const):
(WebCore::FrameLoadRequest::systemPreviewInfo const):
(WebCore::FrameLoadRequest::systemPreviewRect const): Deleted.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadURL):

* loader/FrameLoaderTypes.h: Provide encoders for the type.
(WebCore::SystemPreviewInfo::encode const):
(WebCore::SystemPreviewInfo::decode):

* platform/network/ResourceRequestBase.cpp: Use the new type.
(WebCore::ResourceRequestBase::isSystemPreview const):
(WebCore::ResourceRequestBase::systemPreviewInfo const):
(WebCore::ResourceRequestBase::setSystemPreviewInfo):
(WebCore::ResourceRequestBase::setSystemPreview): Deleted.
(WebCore::ResourceRequestBase::systemPreviewRect const): Deleted.
(WebCore::ResourceRequestBase::setSystemPreviewRect): Deleted.
* platform/network/ResourceRequestBase.h:

* testing/Internals.cpp: Expose the frame and page identifiers to testing.
(WebCore::Internals::frameIdentifier const):
(WebCore::Internals::pageIdentifier const):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

Provide a way for a Web page to know if an action in the AR scene
was performed, if and only if the system AR library calls a delegate with
particular parameters. Post a message to the originating frame so
the page can detect the action.

* Scripts/webkit/messages.py: Include the right header for SystemPreviewInfo.

* Shared/WebCoreArgumentCoders.cpp: Use SystemPreviewInfo.
(IPC::ArgumentCoder<ResourceRequest>::encode):
(IPC::ArgumentCoder<ResourceRequest>::decode):

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _triggerSystemPreviewActionOnFrame:page:]): New helper/test function
to trigger the system preview action.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:

* UIProcess/Cocoa/DownloadClient.mm: Use new type.
(WebKit::DownloadClient::didStart):

* UIProcess/Cocoa/SystemPreviewControllerCocoa.mm: Implement the delegate so that
we can detect an action. When it happens, tell the WebPageProxy to send a message.

* UIProcess/Downloads/DownloadProxy.h: Use SystemPreviewInfo type.
(WebKit::DownloadProxy::systemPreviewDownloadInfo const):
(WebKit::DownloadProxy::systemPreviewDownloadRect const): Deleted.

* UIProcess/SystemPreviewController.h:
(WebKit::SystemPreviewController::previewInfo const):

* UIProcess/WebPageProxy.cpp: Send it over to the Web Process.
(WebKit::WebPageProxy::systemPreviewActionTriggered const):
* UIProcess/WebPageProxy.h:

* WebProcess/WebPage/WebPage.cpp: Check the destination still exists, and then talk
to the Document.
(WebKit::WebPage::systemPreviewActionTriggered):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Tools:

* TestWebKitAPI/Tools/TestWebKitAPI/Tests/WebKitCocoa/SystemPreview.mm:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/system-preview-trigger.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249855 268f45cc-cd09-0410-ab3c-d52691b4dbfc
31 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/html/HTMLAnchorElement.cpp
Source/WebCore/loader/FrameLoadRequest.h
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/FrameLoaderTypes.h
Source/WebCore/platform/network/ResourceRequestBase.cpp
Source/WebCore/platform/network/ResourceRequestBase.h
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit/ChangeLog
Source/WebKit/Scripts/webkit/messages.py
Source/WebKit/Shared/WebCoreArgumentCoders.cpp
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit/UIProcess/Cocoa/DownloadClient.mm
Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm
Source/WebKit/UIProcess/Downloads/DownloadProxy.h
Source/WebKit/UIProcess/SystemPreviewController.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKitCocoa/SystemPreview.mm [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKitCocoa/system-preview-trigger.html [new file with mode: 0644]