Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5f66068c26516317052b0a33fd4311a194fccae7
      
https://github.com/WebKit/WebKit/commit/5f66068c26516317052b0a33fd4311a194fccae7
  Author: Ryosuke Niwa <[email protected]>
  Date:   2026-09-24 (Thu, 24 Sep 2026)

  Changed paths:
    M Source/WebCore/page/DragController.cpp
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm

  Log Message:
  -----------
  [Site Isolation] Dragged selection in a scrolled cross-origin iframe appears 
at the top of the page
https://bugs.webkit.org/show_bug.cgi?id=325211
rdar://187222890

Reviewed by Tim Nguyen.

When a drag started inside a scrolled cross-origin iframe, the drag image was 
offset upward by the
iframe's scroll position. DragController::doSystemDrag() computed the drag 
location with
contentsToRootView(), which in a site-isolated iframe is relative to the 
iframe's local root view
with the iframe's scroll already subtracted. WebViewImpl::startDrag() then 
passed that point to
convertPointToMainFrameCoordinates(), which treats its input as the local 
root's contents
coordinates, so the parent process's RemoteFrameView subtracted the iframe's 
scroll position again.

Compute the event position and drag location with contentsToMainFrameView() in 
the web process
instead, which follows the frame tree across process boundaries and applies 
each ancestor's scroll
position and transform exactly once, and is equivalent to contentsToRootView() 
when the main frame
is in the same process. WebViewImpl::startDrag() can then use the drag location 
directly, so remove
the asynchronous conversion. This also makes the location passed to the 
drag-source customization
delegate relative to the main frame's view in site-isolated iframes.

Tests: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm

* Source/WebCore/page/DragController.cpp:
(WebCore::DragController::doSystemDrag):
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::startDrag):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::selectionDragImageLocationInSubframe):
(TestWebKitAPI::testSelectionDragImageLocation):
(TestWebKitAPI::TEST(SiteIsolation, SelectionDragImageLocation)):
(TestWebKitAPI::TEST(SiteIsolation, 
SelectionDragImageLocationInScrolledMainFrame)):
(TestWebKitAPI::TEST(SiteIsolation, 
SelectionDragImageLocationInScrolledSubframe)):
(TestWebKitAPI::TEST(SiteIsolation, 
SelectionDragImageLocationInScrolledMainFrameAndSubframe)):

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



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

Reply via email to