Bug 233137

Summary: `gestureend` event fired twice for same gesture, occasionally
Product: WebKit Reporter: Dan <dan>
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: hi, simon.fraser, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Logger that displays wheel, touch, and gesture events
none
Video repro none

Description Dan 2021-11-15 10:42:51 PST
Created attachment 444274 [details]
Logger that displays wheel, touch, and gesture events

Occasionally when performing a pinch & twist gestures (that produce, in turn, a scale and a rotation in the emitted gesture events), the `gestureend` event is fired twice for the same gesture.

This goes against the expectation in regards to the order of gesture events (a series of `gesturechange` events bookended by exactly one `gesturestart` and exactly one `gestureend` event). It can also cause problems where the `gestureend` handler is not idempotent, and in the case of applying transformations, the handler is expected not to be.

The bug is elusive, but can hopefully be caught in the attached test file (which I believe is correct, unless I'm missing something obvious). I will also attach the bug repro in video form.
Comment 1 Dan 2021-11-15 10:45:47 PST
Created attachment 444275 [details]
Video repro

While performing a compound gesture (scale + rotate), the `gestureend` event is emitted twice.
Comment 2 Radar WebKit Bug Importer 2021-11-22 10:43:32 PST
<rdar://problem/85680216>