[Webkit-unassigned] [Bug 254046] `dragend` events have incorrect coordinates

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Mar 24 11:50:51 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=254046

--- Comment #2 from Avi Drissman <avi at drissman.com> ---
FYI: Chromium encountered a similar issue (https://crbug.com/1424292) when we moved from an old macOS API to a modern one.

In the old version of the code, we used to use -[NSWindow dragImage:at:offset:event:pasteboard:source:slideBack:] which for the position took the corner of the image, and when -[NSDraggingSource draggedImage:endedAt:operation:] was called, the ending point was the corner of the image again. Therefore, in our old code, we had to offset the ending point to find the actual coordinates of the drag that we wanted.

We modernized our use of the drag API (https://crrev.com/c/4114681), moving to -[NSView beginDraggingSessionWithItems:event:source:]. When the drag was over, that calls -[NSDraggingSource draggingSession:endedAtPoint:operation:]. There was no need to offset the ending point, as this new API gives the correct point, but we incorrectly kept our offsetting code.

We solved (https://crrev.com/c/4347532) our version of this bug by removing this offsetting.

I don’t know what the underlying cause of this bug is for you, but given the shared history of WebKit and Blink, it’s possible that when you moved to the new macOS drag API, you too didn’t realize you needed to remove this obsolete offsetting code. If that indeed turns out to be the case for you, I hope that our pain in discovering this helps make your bug fix easier.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230324/a5bc668e/attachment.htm>


More information about the webkit-unassigned mailing list