From 73c2864233f8f27e61a1389e3dbacb83fe2e1d45 Mon Sep 17 00:00:00 2001 From: batu_hoang <55729155+longvatrong111@users.noreply.github.com> Date: Thu, 12 Jun 2025 11:13:11 +0800 Subject: [PATCH] Handle Touch events in dispatch_pending_point_input_events (#37285) Add a missing step in hit test retry [(comment)](https://github.com/servo/servo/pull/37085/files/0d02b61f72c24e575273b6240e04351762ef000a#r2131567216). cc: @xiaochengh , @kongbai1996 --------- Signed-off-by: batu_hoang --- components/compositing/webview_renderer.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/compositing/webview_renderer.rs b/components/compositing/webview_renderer.rs index 2f822a37e11..1c099f72714 100644 --- a/components/compositing/webview_renderer.rs +++ b/components/compositing/webview_renderer.rs @@ -370,8 +370,10 @@ impl WebViewRenderer { } } + // TODO: This function duplicates a lot of `dispatch_point_input_event. + // Perhaps it should just be called here instead. pub(crate) fn dispatch_pending_point_input_events(&self) { - while let Some(event) = self.pending_point_input_events.borrow_mut().pop_front() { + while let Some(mut event) = self.pending_point_input_events.borrow_mut().pop_front() { // Events that do not need to do hit testing are sent directly to the // constellation to filter down. let Some(point) = event.point() else { @@ -390,7 +392,15 @@ impl WebViewRenderer { return; }; - self.global.borrow_mut().update_cursor(point, &result); + match event { + InputEvent::Touch(ref mut touch_event) => { + touch_event.init_sequence_id(self.touch_handler.current_sequence_id); + }, + InputEvent::MouseButton(_) | InputEvent::MouseMove(_) | InputEvent::Wheel(_) => { + self.global.borrow_mut().update_cursor(point, &result); + }, + _ => unreachable!("Unexpected input event type: {event:?}"), + } if let Err(error) = self.global.borrow().constellation_sender.send( EmbedderToConstellationMessage::ForwardInputEvent(self.id, event, Some(result)),