aboutsummaryrefslogtreecommitdiffstats
path: root/components/shared/script/lib.rs
diff options
context:
space:
mode:
authorDelan Azabani <dazabani@igalia.com>2023-12-12 14:36:27 +0800
committerGitHub <noreply@github.com>2023-12-12 06:36:27 +0000
commit8a226fdb1975ae1df8d1a673eb3dca9f2bb771aa (patch)
tree086be8a112b7f1fdec4c96035327acfa69fce856 /components/shared/script/lib.rs
parent676c170b07551deabb9947f1f7ce6e0d1ec50974 (diff)
downloadservo-8a226fdb1975ae1df8d1a673eb3dca9f2bb771aa.tar.gz
servo-8a226fdb1975ae1df8d1a673eb3dca9f2bb771aa.zip
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
Diffstat (limited to 'components/shared/script/lib.rs')
-rw-r--r--components/shared/script/lib.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/components/shared/script/lib.rs b/components/shared/script/lib.rs
index 77782255a4c..fac68c03745 100644
--- a/components/shared/script/lib.rs
+++ b/components/shared/script/lib.rs
@@ -27,7 +27,7 @@ use canvas_traits::webgl::WebGLPipeline;
use compositor::ScrollTreeNodeId;
use crossbeam_channel::{Receiver, RecvTimeoutError, Sender};
use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, WorkerId};
-use embedder_traits::Cursor;
+use embedder_traits::{CompositorEventVariant, Cursor};
use euclid::default::Point2D;
use euclid::{Length, Rect, Scale, Size2D, UnknownUnit, Vector2D};
use gfx_traits::Epoch;
@@ -571,6 +571,21 @@ pub enum CompositorEvent {
IMEDismissedEvent,
}
+impl From<&CompositorEvent> for CompositorEventVariant {
+ fn from(value: &CompositorEvent) -> Self {
+ match value {
+ CompositorEvent::ResizeEvent(..) => CompositorEventVariant::ResizeEvent,
+ CompositorEvent::MouseButtonEvent(..) => CompositorEventVariant::MouseButtonEvent,
+ CompositorEvent::MouseMoveEvent(..) => CompositorEventVariant::MouseMoveEvent,
+ CompositorEvent::TouchEvent(..) => CompositorEventVariant::TouchEvent,
+ CompositorEvent::WheelEvent(..) => CompositorEventVariant::WheelEvent,
+ CompositorEvent::KeyboardEvent(..) => CompositorEventVariant::KeyboardEvent,
+ CompositorEvent::CompositionEvent(..) => CompositorEventVariant::CompositionEvent,
+ CompositorEvent::IMEDismissedEvent => CompositorEventVariant::IMEDismissedEvent,
+ }
+ }
+}
+
/// Requests a TimerEvent-Message be sent after the given duration.
#[derive(Debug, Deserialize, Serialize)]
pub struct TimerEventRequest(