mirror of
https://github.com/servo/servo.git
synced 2025-09-29 16:19:14 +01:00
script/compositor: Send mouseleave
events when cursor moves between <iframe>
s (#38539)
Properly send `mouseleave` events when the cursor moves between `<iframe>`s. This allows a better handling of cursor changes and status text updates. Specifically, we do not need to continuously update the cursor and the value can be cached in the `Document`. In addition, status updates can now be sent properly when moving focus between `<iframe>`s. Note that style updates for `:hover` values are still broken, but less so than before. Now the hover state on the `Node` is updated, but for some reason the restyle isn't taking place properly. This maintains the status quo as far as behavior goes when hover moves between `<iframe>`s. This change also adds a helper data structure to `Document` which will eventually be responsible for event handling. Testing: Cursor and status change are currently very hard to test as the API test harness makes this difficult at the moment. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
82ca2b92cd
commit
b75c3feb97
11 changed files with 307 additions and 210 deletions
|
@ -2939,34 +2939,8 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
let pipeline_id = match &hit_test_result {
|
||||
Some(hit_test) => hit_test.pipeline_id,
|
||||
None => {
|
||||
// If there's no hit test, send to the focused browsing context of the given webview.
|
||||
let Some(browsing_context_id) = self
|
||||
.webviews
|
||||
.get(webview_id)
|
||||
.map(|webview| webview.focused_browsing_context_id)
|
||||
else {
|
||||
warn!("Handling InputEvent for an unknown webview: {webview_id}");
|
||||
return;
|
||||
};
|
||||
|
||||
let Some(pipeline_id) = self
|
||||
.browsing_contexts
|
||||
.get(&browsing_context_id)
|
||||
.map(|context| context.pipeline_id)
|
||||
else {
|
||||
warn!("{browsing_context_id}: Got InputEvent for nonexistent browsing context");
|
||||
return;
|
||||
};
|
||||
|
||||
pipeline_id
|
||||
},
|
||||
};
|
||||
|
||||
let Some(pipeline) = self.pipelines.get(&pipeline_id) else {
|
||||
debug!("Got event for pipeline ({pipeline_id}) after closure");
|
||||
let Some(webview) = self.webviews.get_mut(webview_id) else {
|
||||
warn!("Got input event for unknown WebViewId: {webview_id:?}");
|
||||
return;
|
||||
};
|
||||
|
||||
|
@ -2976,13 +2950,7 @@ where
|
|||
active_keyboard_modifiers,
|
||||
event,
|
||||
};
|
||||
|
||||
if let Err(error) = pipeline
|
||||
.event_loop
|
||||
.send(ScriptThreadMessage::SendInputEvent(pipeline_id, event))
|
||||
{
|
||||
self.handle_send_error(pipeline_id, error);
|
||||
}
|
||||
webview.forward_input_event(event, &self.pipelines, &self.browsing_contexts);
|
||||
}
|
||||
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue