-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Should RefreshCursor Called in a Device Without a Cursor? #39433
Description
Whenever there is a new webrender frame, we always do refresh cursor.
servo/components/compositing/compositor.rs
Lines 1648 to 1679 in 54ba027
| fn refresh_cursor(&self) { | |
| let global = self.global.borrow(); | |
| let Some(last_mouse_move_position) = global.last_mouse_move_position else { | |
| return; | |
| }; | |
| let Some(hit_test_result) = global | |
| .hit_test_at_point(last_mouse_move_position) | |
| .first() | |
| .cloned() | |
| else { | |
| return; | |
| }; | |
| if let Err(error) = | |
| global | |
| .constellation_sender | |
| .send(EmbedderToConstellationMessage::RefreshCursor( | |
| hit_test_result.pipeline_id, | |
| )) | |
| { | |
| warn!("Sending event to constellation failed ({:?}).", error); | |
| } | |
| } | |
| fn handle_new_webrender_frame_ready(&mut self, recomposite_needed: bool) { | |
| self.pending_frames.set(self.pending_frames.get() - 1); | |
| if recomposite_needed { | |
| self.refresh_cursor(); | |
| } | |
| if recomposite_needed || self.animation_callbacks_running() { | |
| self.set_needs_repaint(RepaintReason::NewWebRenderFrame); |
The IOCompositor::refresh_cursor basically checks for the last_mouse_move_position. This looks fine, but for TouchEvent we basically simulate MouseEvents here, and therefore last_mouse_move_position is set along the way.
servo/components/compositing/webview_renderer.rs
Lines 651 to 659 in 54ba027
| TouchSequenceState::PendingClick(point) => { | |
| info.state = TouchSequenceState::Finished; | |
| // PreventDefault from touch_down may have been processed after | |
| // touch_up already occurred. | |
| if !info.prevent_click { | |
| self.simulate_mouse_click(point); | |
| } | |
| self.touch_handler.remove_touch_sequence(sequence_id); | |
| }, |
As this seems to be a no-op for a device (specifically for a touch device) without a cursor. I wonder if there are a way for embedder to notify compositor to skip these steps, or if there are more appropriate way to handle these cases.
cc: @jschwe