You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[iOS WK2] Add plumbing for WKContentView to ask the web process for additional drag items
https://bugs.webkit.org/show_bug.cgi?id=176348
Work towards <rdar://problem/31144674>
Reviewed by Tim Horton.
Source/WebKit:
Adds boilerplate plumbing to request additional items to an existing session. This implements some UI-side logic
in WKContentView to send an additional drag items request and handle a response from the web process.
To start, WebPageProxy::requestAdditionalItemsForDragSession is invoked by -_dragInteraction:
itemsForAddingToSession:withTouchAtPoint:completion: in WKContentView, and the response from the web process is
handled in -[WKContentView _didHandleAdditionalDragItemsRequest:].
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _simulateItemsForAddingToSession:atLocation:completion:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
Add SPI to simulate a request for additional drag items. See Tools/ChangeLog for more detail.
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
Add an IPC message handler for the additional drag items response from the web process.
* UIProcess/ios/DragDropInteractionState.h:
(WebKit::DragDropInteractionState::BlockPtr<void):
* UIProcess/ios/DragDropInteractionState.mm:
(WebKit::DragDropInteractionState::shouldRequestAdditionalItemForDragSession const):
(WebKit::DragDropInteractionState::dragSessionWillRequestAdditionalItem):
Invoke the new additional items completion handler when tearing down to avoid getting UIKit into a bad state.
(WebKit::DragDropInteractionState::dragAndDropSessionsDidEnd):
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didHandleAdditionalDragItemsRequest):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _didHandleAdditionalDragItemsRequest:]):
(-[WKContentView _itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:]):
Factors common logic to convert a staged WebItemProviderRegistrationInfoList and DragSourceState into a list of
drag items, invoking the private UI delegate in the process. This is called both when starting a drag session,
and adding items to an existing drag session.
(-[WKContentView _dragInteraction:itemsForAddingToSession:withTouchAtPoint:completion:]):
Implements a (proposed) additional drag item delegate that serves as an asynchronous alternative to the API
variant, -_dragInteraction:itemsForAddingToSession:withTouchAtPoint:. See <rdar://problem/33146803> for more
information.
(-[WKContentView dragInteraction:itemsForBeginningSession:]):
Refactored to use -_itemsForBeginningOrAddingToSessionWithRegistrationList:stagedDragSource:.
(-[WKContentView _simulateItemsForAddingToSession:atLocation:completion:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didHandleAdditionalDragItemsRequest):
(WebKit::WebPageProxy::requestAdditionalItemsForDragSession):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
Add an IPC message handler for the additional drag items request from the UI process.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::requestAdditionalItemsForDragSession):
Tools:
Introduces new test infrastructure to simulate tapping to add additional items to the current drag session. We
add -[DataInteractionSimulator runFrom:to:additionalItemRequestLocations:], for which the last argument is a
dictionary mapping progress (a double between 0 and 1) to NSValues representing the location from which the drag
and drop simulation will request an additional drag item. During the simulated drag and drop, when the progress
value exceeds a value in the map of remaining additional item request locations, we halt drag simulation
progress for that runloop and instead request additional items from the location specified.
The only (useful) passing test we can create using the new machinery is one that verifies that preventDefault()
on dragstart works as expected, preventing additional items from being added. While this trivially passes now,
since the web-process-side of the additional items flow is not yet implemented, it should continue to pass after
the web process portion is implemented.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/selected-text-image-link-and-editable.html: Added.
Add a new test page that contains some non-editable text, an image, a link, and a rich text editable area.
* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/ios/DataInteractionSimulator.h:
* TestWebKitAPI/ios/DataInteractionSimulator.mm:
(-[MockDragDropSession addItems:]):
Convenience method to add additional mock drag items to a drag or drop session.
(-[DataInteractionSimulator _resetSimulatedState]):
(-[DataInteractionSimulator runFrom:to:]):
Converted into a convenience wrapper around the latter version, passing in nil for the additional item request
locations dictionary.
(-[DataInteractionSimulator runFrom:to:additionalItemRequestLocations:]):
(-[DataInteractionSimulator _enqueuePendingAdditionalItemRequestLocations]):
(-[DataInteractionSimulator _sendQueuedAdditionalItemRequest]):
New helper methods to detect when and where additional items should be "added", and subsequently simulate adding
drag items at these given locations.
(-[DataInteractionSimulator _advanceProgress]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@221660 268f45cc-cd09-0410-ab3c-d52691b4dbfc
0 commit comments