Bug 276659

Summary: [GTK][X11] Pointer lock drifts if started while moving
Product: WebKit Reporter: Roope Salmi <rpsalmi>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply
Priority: P2    
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Example HTML demonstrating the issue none

Roope Salmi
Reported 2024-07-16 08:05:50 PDT
Created attachment 471892 [details] Example HTML demonstrating the issue Ubuntu 22.04.4 WebKitGTK local build of main https://commits.webkit.org/280684@main HTML (attached): <div id="box" style="background:red; width:50px; height:50px; position:fixed;"></div> <script> let x = window.innerWidth / 2; let y = window.innerHeight / 2; function update() { document.getElementById("box").style.left = x; document.getElementById("box").style.top = y; } update(); document.addEventListener("mousemove", (e) => { x += e.movementX; y += e.movementY; update(); }); document.addEventListener("mousedown", (e) => { document.body.requestPointerLock(); x = e.clientX; y = e.clientY; update(); }); </script> On mousedown, the box moves to the mouse and follows it. Move the mouse and simultaneously press LMB. Now move the mouse in a circular pattern. The box will move indefinitely in one direction, while it should stay at around the same place. Follow-up from https://bugs.webkit.org/show_bug.cgi?id=273876 See https://github.com/WebKit/WebKit/pull/30437#issuecomment-2228773994 I am planning to write a second PR to fix this.
Attachments
Example HTML demonstrating the issue (546 bytes, text/html)
2024-07-16 08:05 PDT, Roope Salmi
no flags
Roope Salmi
Comment 1 2024-07-17 09:08:17 PDT
EWS
Comment 2 2024-07-23 00:07:35 PDT
Committed 281232@main (c99908cf384c): <https://commits.webkit.org/281232@main> Reviewed commits have been landed. Closing PR #30908 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.