Bug 238327 - [GTK] Scrollbar jumps to top when drag released outside window
Summary: [GTK] Scrollbar jumps to top when drag released outside window
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on:
Blocks: GTK4
  Show dependency treegraph
 
Reported: 2022-03-24 08:54 PDT by Michael Catanzaro
Modified: 2023-10-06 12:57 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2022-03-24 08:54:07 PDT
This is not a very serious issue, but apparently it's something I do habitually: click on the scrollbar slider, drag it around, then release the drag *outside* the window. With GTK 3, the scrollbar stops in the position where it was released (expected behavior). With GTK 4, the scrollbar jumps to the top of the window and I have to scroll back to wherever I was.
Comment 1 Michael Catanzaro 2023-05-18 13:48:52 PDT
Problem seems to be that the cursor leaving the web view gets indicated by a mouse event with coordinates (-1, -1). WebKit interprets this too literally and decides the cursor jumped up and left.
Comment 2 Michael Catanzaro 2023-05-18 14:03:05 PDT
It's coming from webkitWebViewBaseLeave:

priv->pageProxy->handleMouseEvent(NativeWebMouseEvent({ -1, -1 }));
Comment 3 Michael Catanzaro 2023-05-18 14:26:44 PDT
So with GTK 3, this problem is handled by webkitWebViewBaseCrossingNotifyEvent. We need to do something like that for GTK 4. But GtkEventControllerMotion is designed to make this difficult. It's not going to give us coordinates we can use, and there is no current event to get them from.

We might need to fake it somehow by starting with the coordinates from the last event before the leave event, and adjusting them to be just outside the web view's allocation. Opinions welcome.
Comment 4 Michael Catanzaro 2023-05-19 10:31:25 PDT
Pull request: https://github.com/WebKit/WebKit/pull/14085
Comment 5 EWS 2023-05-26 08:12:42 PDT
Committed 264582@main (c56a5e4e1e44): <https://commits.webkit.org/264582@main>

Reviewed commits have been landed. Closing PR #14085 and removing active labels.
Comment 6 Michael Catanzaro 2023-05-28 05:35:21 PDT
This should also fix Google Maps scrolling like crazy to the northwest when dragging the mouse outside the web view.