-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop using delayedPreviewProviderForDroppingItem to update drop previ…
…ews asynchronously https://bugs.webkit.org/show_bug.cgi?id=263983 rdar://114331921 Reviewed by Aditya Keerthi. Stop relying on this private `UIDropInteraction` delegate method. Instead, adopt a new method, `-[UIDragItem _setNeedsDropPreviewUpdate]`, to inform UIKit that a given item's associated drop preview is changing. The drop session will then query the normal API again (`-[UIDropInteractionDelegate dropInteraction:previewForDroppingItem:withDefault:]`), and automatically retarget the drop animation based on the new result preview. See below for more details. * Source/WebKit/Platform/spi/ios/UIKitSPI.h: * Source/WebKit/UIProcess/ios/DragDropInteractionState.h: * Source/WebKit/UIProcess/ios/DragDropInteractionState.mm: (WebKit::createTargetedDragPreview): (WebKit::DragDropInteractionState::addDefaultDropPreview): (WebKit::DragDropInteractionState::defaultDropPreview const): (WebKit::DragDropInteractionState::finalDropPreview const): Refactor the drag and drop interaction state to accomodate the new way of updating previews on drop. In particular, replace `m_delayedItemPreviewProviders` with `m_finalDropPreviews` instead. We no longer need to save a list of preview-provider blocks, and can instead: 1. Stash away any incoming asynchronously-delivered previews on the interaction state… 2. Call `-_setNeedsDropPreviewUpdate` on the drag item, and finally… 3. Return the final drag preview in `-dropInteraction:previewForDroppingItem:withDefault:`, for that drag item. (WebKit::dragItemSupportsAsynchronousUpdates): (WebKit::DragDropInteractionState::deliverDelayedDropPreview): (WebKit::DragDropInteractionState::dragAndDropSessionsDidBecomeInactive): (WebKit::DragDropInteractionState::setDefaultDropPreview): Deleted. (WebKit::BlockPtr<void): Deleted. (WebKit::DragDropInteractionState::prepareForDelayedDropPreview): Deleted. (WebKit::DragDropInteractionState::clearAllDelayedItemPreviewProviders): Deleted. (WebKit::DragDropInteractionState::dragAndDropSessionsDidEnd): Deleted. * Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm: (-[WKContentView cleanUpDragSourceSessionState]): (-[WKContentView _handleDropByInsertingImagePlaceholders:session:]): (-[WKContentView dropInteraction:concludeDrop:]): (-[WKContentView dropInteraction:previewForDroppingItem:withDefault:]): Return the final drop preview, if available. See above for more details. (-[WKContentView _dropInteraction:delayedPreviewProviderForDroppingItem:previewProvider:]): Deleted. * Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm: (-[UIDragItem _dragAndDropSimulator]): (-[UIDragItem _setDragAndDropSimulator:]): (-[UIDragItem _setNeedsDropPreviewUpdate]): (-[DragAndDropSimulator _resetSimulatedState]): (-[DragAndDropSimulator runFrom:to:additionalItemRequestLocations:]): (-[DragAndDropSimulator defaultDropPreviewForItemAtIndex:]): (-[DragAndDropSimulator _setNeedsDropPreviewUpdate:]): (-[DragAndDropSimulator _concludeDropAndPerformOperationIfNecessary]): Update our drag and drop test infrastructure to handle calls to `-_setNeedsDropPreviewUpdate` by having the drop simulator query `-dropInteraction:previewForDroppingItem:withDefault:` again and save the result, which aligns with platform behavior support for this new API. Canonical link: https://commits.webkit.org/270290@main
- Loading branch information
Showing
5 changed files
with
101 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.