[webkit-changes] [WebKit/WebKit] 9a057d: Move off of UIKit SPI: `UIURLDragPreviewView`

Wenson Hsieh noreply at github.com
Mon Aug 21 12:36:47 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9a057d296f1ea27ce5cfea7db29905082a7fb3f6
      https://github.com/WebKit/WebKit/commit/9a057d296f1ea27ce5cfea7db29905082a7fb3f6
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2023-08-21 (Mon, 21 Aug 2023)

  Changed paths:
    M Source/WebKit/Platform/spi/ios/UIKitSPI.h
    M Source/WebKit/UIProcess/ios/DragDropInteractionState.h
    M Source/WebKit/UIProcess/ios/DragDropInteractionState.mm

  Log Message:
  -----------
  Move off of UIKit SPI: `UIURLDragPreviewView`
https://bugs.webkit.org/show_bug.cgi?id=260448
rdar://114165890

Reviewed by Aditya Keerthi and Tim Horton.

Replace usages of `UIURLDragPreviewView` in WebKit with `+[UIDragPreview previewForURL:title:]`.

* Source/WebKit/Platform/spi/ios/UIKitSPI.h:

Remove the (now-unused) SPI declaration and header include.

* Source/WebKit/UIProcess/ios/DragDropInteractionState.h:
* Source/WebKit/UIProcess/ios/DragDropInteractionState.mm:
(WebKit::DragDropInteractionState::stageDragItem):

We no longer need to plumb the `center` point into the preview provider block, so we can also remove
the `adjustedOrigin` member while we're here.

(WebKit::DragDropInteractionState::updatePreviewsForActiveDragSources):

Use `+[UIDragPreview previewForURL:title:]` instead of directly creating a `UIURLDragPreviewView`.
There is a caveat here, which is that on visionOS (where we need to override the background color of
the preview by setting `-backgroundColor` on the preview parameters), we need to first use
`+previewForURL:title:` to make UIKit instantiate a `UIURLDragPreviewView`, which we can then use to
initialize a `UIDragPreview`.

Canonical link: https://commits.webkit.org/267102@main




More information about the webkit-changes mailing list