Add mouse hover tracking across the Servo input pipeline

Without continuous MouseMove events, Servo never updates hover state:
no cursor changes over links, no :hover CSS effects, no mouseenter
JavaScript events. The web page appears completely non-interactive.

Track mouse position from GPUI on_mouse_move through the full IPC
pipeline to Servo. Hover position is included with each ensure
request so Servo updates hover state at frame rate (~60fps).
This commit is contained in:
2026-05-09 16:21:43 -04:00
parent e621c43757
commit 4c6d9c757a
9 changed files with 1219 additions and 433 deletions
+7 -52
View File
@@ -1,10 +1,8 @@
use ely_domain::TabId;
use crate::services::servo_sidecar::{ServoSidecarClient, SidecarSnapshotRequest};
use super::{
web_surface_frame::WebSurfaceFrame,
web_surface_geometry::{WebSurfaceClickPoint, WebSurfaceScrollOffset, WebSurfaceSize},
web_surface_geometry::{WebSurfaceClickPoint, WebSurfaceScrollOffset},
};
pub(super) struct WebSurfaceScrollState {
@@ -40,60 +38,17 @@ pub(super) struct WebSurfaceTextInputState {
pub(super) text: String,
}
#[derive(Clone, Copy)]
pub(super) struct WebSurfaceStateKey<'a> {
pub(super) requested_url: &'a str,
pub(super) size: WebSurfaceSize,
#[derive(Clone, Debug, Eq, PartialEq)]
pub(super) struct WebSurfacePendingInput {
pub(super) scroll_offset: WebSurfaceScrollOffset,
pub(super) zoom_percent: u16,
pub(super) click_point: Option<WebSurfaceClickPoint>,
pub(super) typed_text: Option<&'a str>,
}
pub(super) enum WebSurfaceClient {
Ready(ServoSidecarClient),
Unavailable(String),
}
impl WebSurfaceClient {
pub(super) fn new() -> Self {
match ServoSidecarClient::new() {
Ok(client) => Self::Ready(client),
Err(error) => Self::Unavailable(error.to_string()),
}
}
}
pub(super) struct WebSurfaceRequest {
pub(super) tab_id: TabId,
pub(super) requested_url: String,
pub(super) size: WebSurfaceSize,
pub(super) scroll_offset: WebSurfaceScrollOffset,
pub(super) zoom_percent: u16,
pub(super) scroll_delta: Option<super::web_surface_geometry::WebSurfaceScrollDelta>,
pub(super) click_point: Option<WebSurfaceClickPoint>,
pub(super) hover_point: Option<WebSurfaceClickPoint>,
pub(super) typed_text: Option<String>,
pub(super) client: ServoSidecarClient,
pub(super) snapshot_request: SidecarSnapshotRequest,
}
pub(super) enum WebSurfaceState {
Loading {
requested_url: String,
size: WebSurfaceSize,
scroll_offset: WebSurfaceScrollOffset,
zoom_percent: u16,
click_point: Option<WebSurfaceClickPoint>,
typed_text: Option<String>,
previous_frame: Option<WebSurfaceFrame>,
},
Loading { requested_url: String, previous_frame: Option<WebSurfaceFrame> },
Ready(WebSurfaceFrame),
Failed {
requested_url: String,
size: WebSurfaceSize,
scroll_offset: WebSurfaceScrollOffset,
zoom_percent: u16,
click_point: Option<WebSurfaceClickPoint>,
typed_text: Option<String>,
message: String,
},
Failed { message: String },
}