Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 33a1cda45d6c0058bd2ce05d6d186dc4d7392cc5
https://github.com/WebKit/WebKit/commit/33a1cda45d6c0058bd2ce05d6d186dc4d7392cc5
Author: Abrar Rahman Protyasha <[email protected]>
Date: 2026-05-20 (Wed, 20 May 2026)
Changed paths:
M Source/WebCore/platform/PlatformScreen.h
M Source/WebKit/WebProcess/WebPage/Cocoa/PositionInformationForWebPage.mm
M Tools/TestWebKitAPI/Helpers/cocoa/JavaScriptMessages.swift
M Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKitGesturesTests.swift
Log Message:
-----------
[AppKit Gestures] Gesture-driven drag-and-drop does not recognize <img>
elements
https://bugs.webkit.org/show_bug.cgi?id=315155
rdar://177489462
Reviewed by Richard Robinson.
In 313504@main, we taught WKAppKitGestureController to consult position
information to determine whether the gesture in question is interacting
with "draggable" web content. Unfortunately, the `isImage` bit was just
never computed for macOS, and so plain `<img>` elements were being
rejected as drag candidates.
To fix this, we undo the `#if PLATFORM(IOS_FAMILY)` guards in all of the
image and video helpers in PositionInformationForWebPage.mm. These code
paths generally do not have any iOS-specific dependencies, and the one
platform-specific call inside WebCore::screenSize(), which was used as a
size limit for the generated image bitmap, was generalized via a helper
that consults the local main frame's view to ask `screenRect(Widget*)`
for the web view's current screen on macOS, falling back to a null widget
(and therefore the primary screen) when this web process does not host
the local main frame.
That last change is mostly academic, though, because there are no macOS
codepaths that set includeSnapshot or includeImageData on the
interaction information request anyway.
Test: AppKitGesturesTests.pressDragOnImageInitiatesDragAndDrop
* Source/WebCore/platform/PlatformScreen.h:
* Source/WebKit/WebProcess/WebPage/Cocoa/PositionInformationForWebPage.mm:
(WebKit::platformBitmapSizeCap):
(WebKit::videoPositionInformation):
(WebKit::imagePositionInformation):
(WebKit::elementPositionInformation):
(WebKit::positionInformationForWebPage):
* Tools/TestWebKitAPI/Helpers/cocoa/JavaScriptMessages.swift:
(BoundingClientRect.expression):
(Storage.encoded):
(BoundingClientRect.encoded): Deleted.
* Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKitGesturesTests.swift:
(AppKitGesturesTests.pressDragOnImageInitiatesDragAndDrop):
Canonical link: https://commits.webkit.org/313624@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications