Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7f2f5f6ce7b6d51e28e206770772e99478884c8a
https://github.com/WebKit/WebKit/commit/7f2f5f6ce7b6d51e28e206770772e99478884c8a
Author: Phipson Lee <[email protected]>
Date: 2026-06-24 (Wed, 24 Jun 2026)
Changed paths:
M Source/WebKit/UIProcess/ios/DragDropInteractionState.h
M Source/WebKit/UIProcess/ios/DragDropInteractionState.mm
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Log Message:
-----------
Image preview during drag and drop sometimes appear outside of webpage bounds
on visionOS
https://bugs.webkit.org/show_bug.cgi?id=316863
rdar://176508364
Reviewed by Wenson Hsieh.
Currently on visionOS, drag and drop previews are not bounded by the window or
scene that it's in.
As a result, it directly uses the center of the UITargetedPreview as its
anchor, which can exist
outside the bounds of the webpage if the preview overflows inside a scrollView.
This change
intends to clamp the center of the preview such that it is always anchored
within the viewport.
The clamping logic is shared via a small inline helper,
clampedDragPreviewCenterAxis, declared
in DragDropInteractionState.h and used from both the drag-and-drop preview
helper in
DragDropInteractionState and the context-menu-hint preview helper in
WKContentViewInteraction.
* Source/WebKit/UIProcess/ios/DragDropInteractionState.h:
* Source/WebKit/UIProcess/ios/DragDropInteractionState.mm:
(WebKit::clampedDragPreviewCenterAxis):
(WebKit::createTargetedDragPreview):
(WebKit::DragDropInteractionState::deliverDelayedDropPreview):
(WebKit::DragDropInteractionState::previewForLifting const):
(WebKit::DragDropInteractionState::previewForCancelling):
(WebKit::DragDropInteractionState::createDragPreviewInternal const):
Update calls to pass a scrollView for visionOS to clamp the UITargetedPreview
center point.
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dragInteraction:previewForLiftingItem:session:]):
(-[WKContentView dragInteraction:previewForCancellingItem:withDefault:]):
(createTargetedPreview):
(-[WKContentView _createTargetedPreviewFromTextIndicator:previewContainer:]):
(-[WKContentView _createTargetedContextMenuHintPreviewIfPossible]):
Update calls to pass a scrollView for visionOS to clamp the UITargetedPreview
center point.
Canonical link: https://commits.webkit.org/315791@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications