constellation: notify embedder when events are hit-tested to browsers (#30841)

* constellation: notify embedder when events are hit-tested to browsers

* fix compile error in libsimpleservo

* impl From<&CompositorEvent> for CompositorEventVariant

* remove msg temporaries in Constellation::forward_event

* use single wildcard arm in EventDelivered case in handle_servo_events
This commit is contained in:
Delan Azabani 2023-12-12 14:36:27 +08:00 committed by GitHub
parent 676c170b07
commit 8a226fdb19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 58 additions and 10 deletions

View file

@ -1548,9 +1548,10 @@ where
fn handle_request_from_script(&mut self, message: (PipelineId, FromScriptMsg)) {
let (source_pipeline_id, content) = message;
debug!(
trace!(
"{}: Message from pipeline: {:?}",
source_pipeline_id, content,
source_pipeline_id,
content,
);
let source_top_ctx_id = match self
@ -2904,15 +2905,23 @@ where
self.pressed_mouse_buttons = 0;
}
let msg = ConstellationControlMsg::SendEvent(destination_pipeline_id, event);
let result = match self.pipelines.get(&destination_pipeline_id) {
let pipeline = match self.pipelines.get(&destination_pipeline_id) {
None => {
debug!("{}: Got event after closure", destination_pipeline_id);
return;
},
Some(pipeline) => pipeline.event_loop.send(msg),
Some(pipeline) => pipeline,
};
if let Err(e) = result {
self.embedder_proxy.send((
Some(pipeline.top_level_browsing_context_id),
EmbedderMsg::EventDelivered((&event).into()),
));
if let Err(e) = pipeline.event_loop.send(ConstellationControlMsg::SendEvent(
destination_pipeline_id,
event,
)) {
self.handle_send_error(destination_pipeline_id, e);
}
}