RESOLVED FIXED 237292
[GTK] setDragImage ignores offset
https://bugs.webkit.org/show_bug.cgi?id=237292
Summary [GTK] setDragImage ignores offset
Per Bothner
Reported 2022-02-28 15:00:02 PST
Created attachment 453436 [details] test of setDragImage offset WebKitGtk (Epiphany/Gnome Web and Wry, tested on Fedora 35, updated) seem to ignore the xOffset/yOffset parameters passed to setDragImage. The strange thing is that Safari works (tested on Catalina, updated) - and both report version 605.1.15. FireFox and Google Chrome work as expected. To reproduce, view the attached file in a browser. Do a mousedown over the word "here" and then drag the mouse without releasing. A drag image is created of the "Drag here"+"Lower contents" elements, and follows the mouse as expected. However, the image of the word "here" is supposed to be under the mouse cursor. Instead the drag image is displaced so the center of the drag image is under the mouse cursor.
Attachments
test of setDragImage offset (1.36 KB, text/html)
2022-02-28 15:00 PST, Per Bothner
no flags
Patch (15.17 KB, patch)
2022-03-01 13:01 PST, Michael Catanzaro
no flags
Patch (14.99 KB, patch)
2022-03-01 15:49 PST, Michael Catanzaro
ews-feeder: commit-queue-
Michael Catanzaro
Comment 1 2022-03-01 11:18:49 PST
Looks like we need to somehow plumb the coordinates from WebCore::DataTransfer::updateDragImage and WebCore::DataTransfer::createDragImage, where they're available, to WebKit::DragSource::begin (both GTK 3 and GTK 4 versions), where they're needed but don't seem to be available. The GTK 3 version uses cairo_surface_set_device_offset() to center the image, while the GTK 4 version uses gdk_drag_set_hotspot().
Michael Catanzaro
Comment 2 2022-03-01 12:49:03 PST
Thanks for the good example/test. This helped a lot.
Michael Catanzaro
Comment 3 2022-03-01 13:01:29 PST
Michael Catanzaro
Comment 4 2022-03-01 15:49:30 PST
EWS
Comment 5 2022-03-02 07:08:06 PST
Committed r290728 (247975@main): <https://commits.webkit.org/247975@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 453543 [details].
Per Bothner
Comment 6 2022-03-02 07:24:53 PST
Thanks for the quick fix! Looking forward to it appearing in Fedora and other distributions.
Note You need to log in before you can comment on or make changes to this bug.