diff options
Diffstat (limited to 'components/shared')
-rw-r--r-- | components/shared/embedder/lib.rs | 16 | ||||
-rw-r--r-- | components/shared/script/lib.rs | 17 |
2 files changed, 32 insertions, 1 deletions
diff --git a/components/shared/embedder/lib.rs b/components/shared/embedder/lib.rs index ecaf57a14bb..d3e67bd9d24 100644 --- a/components/shared/embedder/lib.rs +++ b/components/shared/embedder/lib.rs @@ -208,6 +208,21 @@ pub enum EmbedderMsg { OnDevtoolsStarted(Result<u16, ()>, String), /// Compositing done, but external code needs to present. ReadyToPresent, + /// The given event was delivered to a pipeline in the given browser. + EventDelivered(CompositorEventVariant), +} + +/// The variant of CompositorEvent that was delivered to a pipeline. +#[derive(Debug, Deserialize, Serialize)] +pub enum CompositorEventVariant { + ResizeEvent, + MouseButtonEvent, + MouseMoveEvent, + TouchEvent, + WheelEvent, + KeyboardEvent, + CompositionEvent, + IMEDismissedEvent, } impl Debug for EmbedderMsg { @@ -245,6 +260,7 @@ impl Debug for EmbedderMsg { EmbedderMsg::OnDevtoolsStarted(..) => write!(f, "OnDevtoolsStarted"), EmbedderMsg::ShowContextMenu(..) => write!(f, "ShowContextMenu"), EmbedderMsg::ReadyToPresent => write!(f, "ReadyToPresent"), + EmbedderMsg::EventDelivered(..) => write!(f, "HitTestedEvent"), } } } 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( |