Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a50da550f7f0ce762c4259852a2cb28d32f556b2
      
https://github.com/WebKit/WebKit/commit/a50da550f7f0ce762c4259852a2cb28d32f556b2
  Author: Abrar Rahman Protyasha <[email protected]>
  Date:   2026-04-28 (Tue, 28 Apr 2026)

  Changed paths:
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/DragAndDropTestsMac.mm

  Log Message:
  -----------
  REGRESSION(309943@main): Drag-and-drop preview does not lift from correct 
image location
https://bugs.webkit.org/show_bug.cgi?id=313371
rdar://175267103

Reviewed by Richard Robinson.

The drag image offset computed in DragController compensates for flipped
coordinates elsewhere in Cocoa, and as such points to the bottom-left of
where the drag preview should be.

Later, in WebViewImpl::startDrag(), we fail to convert back from
bottom-left to top-left by subtracting the image height for the two new
drag paths (image drag with file promise and the generic fallback path).

This patch undoes the regression. We also make the mistake less easy to
do by computing the drag frame, correctly, once and using the same value
in each of the setDraggingFrame: calls.

Test: TestWebKitAPI.DragAndDropTests.DragPreviewOriginForImage

* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::startDrag):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::(SiteIsolation, DragImageLocation)):
  The expected origin is the top-left of the draggable element rather
  than the bottom-left.

* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/DragAndDropTestsMac.mm:
(TEST(DragAndDropTests, DragLocationForImageInScrolledSubframe)):
  The origin should be near the image's top-left (close to the viewport
  origin), not necessarily within the webview bounds. A pre-existing
  coordinate conversion issue (noted in rdar://165119210) causes a small
  offset in the test environment.

(TEST(DragAndDropTests, DragPreviewOriginForImage)):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to