Bug 230541

Summary: [GTK] Allow sending precise mouse wheel events in LayoutTests
Product: WebKit Reporter: Chris Lord <clord>
Component: Tools / TestsAssignee: Chris Lord <clord>
Status: RESOLVED FIXED    
Severity: Normal CC: berto, cdumez, cgarcia, darin, ews-watchlist, gustavo, mcatanzaro, mrobinson, sihui_liu, simon.fraser, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 229037    
Attachments:
Description Flags
Patch
none
Patch none

Description Chris Lord 2021-09-21 02:55:43 PDT
Currently in TestRunner you can send a mouse wheel event with start/end phases, but you can't actually send pixel or sub-pixel precise mouse-wheel events. This is a bit of a pain for GTK specifically because kinetic scrolling can only be exercised with precise mouse-wheel events. This is actually the same for other platforms that use sync scrolling and the base scroll animation classes, but I suspect GTK is the main consumer here (and the only one I can easily test).

We may well want this behaviour on other non-Mac/iOS platforms, such as WPE, but I'm dealing with GTK first as it's the easiest to test.
Comment 1 Chris Lord 2021-09-21 03:05:24 PDT
Created attachment 438799 [details]
Patch
Comment 2 EWS Watchlist 2021-09-21 03:06:36 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 3 Simon Fraser (smfr) 2021-09-21 09:20:46 PDT
Comment on attachment 438799 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=438799&action=review

> Source/WebKit/UIProcess/API/gtk/WebKitWebViewBaseInternal.h:48
> +WK_EXPORT void webkitWebViewBaseSetWheelEventsArePrecise(WebKitWebViewBase*, bool);

HasPreciseDeltas

> Tools/WebKitTestRunner/EventSenderProxy.h:66
> +    void setMouseWheelIsPrecise(bool);

I think setMouseWheelHasPreciseDeltas() would be a better name.

> Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:41
> +    undefined setMouseWheelIsPrecise(boolean isPrecise);

setMouseWheelHasPreciseDeltas

> Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp:382
> +    WKBundlePageForceRepaint(InjectedBundle::singleton().page()->page()); // Triggers a scrolling tree commit.

This is a weird thing to do here, and could affect test behavior.

> Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h:61
> +    void setMouseWheelIsPrecise(bool);

setMouseWheelHasPreciseDeltas
Comment 4 Chris Lord 2021-09-22 02:36:48 PDT
Created attachment 438936 [details]
Patch
Comment 5 Chris Lord 2021-09-22 02:40:09 PDT
(In reply to Simon Fraser (smfr) from comment #3)
> Comment on attachment 438799 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=438799&action=review
> 
> > Source/WebKit/UIProcess/API/gtk/WebKitWebViewBaseInternal.h:48
> > +WK_EXPORT void webkitWebViewBaseSetWheelEventsArePrecise(WebKitWebViewBase*, bool);
> 
> HasPreciseDeltas
> 
> > Tools/WebKitTestRunner/EventSenderProxy.h:66
> > +    void setMouseWheelIsPrecise(bool);
> 
> I think setMouseWheelHasPreciseDeltas() would be a better name.
> 
> > Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:41
> > +    undefined setMouseWheelIsPrecise(boolean isPrecise);
> 
> setMouseWheelHasPreciseDeltas
> 
> > Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp:382
> > +    WKBundlePageForceRepaint(InjectedBundle::singleton().page()->page()); // Triggers a scrolling tree commit.
> 
> This is a weird thing to do here, and could affect test behavior.
> 
> > Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h:61
> > +    void setMouseWheelIsPrecise(bool);
> 
> setMouseWheelHasPreciseDeltas

All sounds good, I went with the shorter setWheelHasPreciseDeltas, but don't mind changing it if you don't like that.
Comment 6 EWS 2021-09-23 01:18:53 PDT
Committed r282952 (242042@main): <https://commits.webkit.org/242042@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 438936 [details].
Comment 7 Radar WebKit Bug Importer 2021-09-23 01:19:18 PDT
<rdar://problem/83436653>