PinchGesture routing in Blink

6 views
Skip to first unread message

Sean O'Brien

unread,
Sep 21, 2017, 4:40:57 PM9/21/17
to inpu...@chromium.org
Hello,

I'm working on adding some functionality for touchpad pinches to Chrome, and I'm having a little difficulty understanding the routing.

Namely, in input_handler_proxy, there is a check for a MouseWheel listener, and if one exists then pinch events are not handled.

I haven't been able to find where these events are sent, but they are getting through somehow (page is scaling).

Can you help me understand the routing?

-Sean

Majid Valipour

unread,
Sep 21, 2017, 5:41:36 PM9/21/17
to Sean O'Brien, inpu...@chromium.org
input_handler_proxy is responsible for handling events on impl thread.  Events that are not handled by are forwarded to main thread and eventually find their way to WebViewImpl::handleInputEvent. [1]

In this case, as you pointed out since there is a registered mouse wheel, the event has to be sent to main thread so that the event listener is called before the browser can perform its default action (i.e., pinch zoom). This is the relevant code in WebViewImpl that is responsible for synthesizing the wheel event and then doing a pinch zoom as a default action on main thread.

[1] The actual machinery that first passes event to impl thread and then if not consumed then dispatches to main thread is mainly in InputEventFilter (see ForwardToHandler and DidForwardToHandlerAndOverscroll). FYI that machinery is actually being overhauled as input event IPC is moving to mojo. 

Majid

Sean O'Brien

unread,
Sep 21, 2017, 7:34:27 PM9/21/17
to Majid Valipour, inpu...@chromium.org
Thanks Majid, this was very helpful.
Reply all
Reply to author
Forward
0 new messages