[iOS DnD] Allow the injected bundle to add client data when writing an image to the pasteboard
https://bugs.webkit.org/show_bug.cgi?id=173238
<rdar://problem/
31943370>
Reviewed by Ryosuke Niwa and Tim Horton.
Source/WebCore:
Add clientTypes and clientData to PasteboardImage, and call out to the injected bundle using
getClientPasteboardDataForRange when writing a PasteboardImage. When generating item providers for dragging in
the UI process in PlatformPasteboard, add any available client data as representations to the initialization
list used to set the WebItemProviderPasteboard.
Test: DataInteraction.InjectedBundleImageElementData
* editing/ios/EditorIOS.mm:
(WebCore::Editor::writeImageToPasteboard):
* platform/Pasteboard.h:
* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::PlatformPasteboard::writeObjectRepresentations):
Source/WebKit2:
Send PasteboardImage.clientTypes and PasteboardImage.clientData over IPC.
* Shared/WebCoreArgumentCoders.cpp:
(IPC::encodeClientTypesAndData):
(IPC::decodeClientTypesAndData):
Factor out common logic used to encode and decode client types and data into static helpers.
(IPC::ArgumentCoder<PasteboardWebContent>::encode):
(IPC::ArgumentCoder<PasteboardWebContent>::decode):
(IPC::ArgumentCoder<PasteboardImage>::encode):
(IPC::ArgumentCoder<PasteboardImage>::decode):
Tools:
Add a new unit test to verify that data inserted by the injected bundle when beginning a drag on an image
element is plumbed across to the UI delegate. Also refactors injected bundle unit tests to use the new version
of adjustedDataInteractionItemProvidersForItemProvider: that takes representing objects and additional data.
* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/ios/DataInteractionSimulator.h:
* TestWebKitAPI/ios/DataInteractionSimulator.mm:
(-[DataInteractionSimulator _webView:adjustedDataInteractionItemProvidersForItemProvider:representingObjects:additionalData:]):
(-[DataInteractionSimulator _webView:adjustedDataInteractionItemProviders:]): Deleted.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218128
268f45cc-cd09-0410-ab3c-
d52691b4dbfc