mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
libservo: Expose a single InputEvent
type and pass it to script (#35430)
This change exposes a single `InputEvent` type and now there is only a single delegate method for this `WebViewDelegate::notify_input_event`. - Clipboard events are now handled as `EditingAction` inpute events. In the future this can include things like "Select All", etc. In addition, many parts of the dance to pass these events can now be simplified due to this abstraction. - All forwarded events are handled the same way in the `Constellation`, though they may carry an optional hit test (for events that have a `point`) which affects which `Pipeline` they are sent to. - In the `ScriptThread` we now accept these `InputEvents` and use them everywhere. Now all "compositor events" are "input events". - This allows removing several data structures which are no longer necessary. - We no longer inform the embedder when an event was handled by a WebView as that was only important for a MDI feature that will no longer be so important the full-featured `WebView` API. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
parent
b7b8619e87
commit
0908a47780
25 changed files with 921 additions and 1200 deletions
|
@ -47,6 +47,8 @@ pub(crate) trait LogTarget {
|
|||
}
|
||||
|
||||
mod from_compositor {
|
||||
use embedder_traits::InputEvent;
|
||||
|
||||
use super::LogTarget;
|
||||
|
||||
macro_rules! target {
|
||||
|
@ -65,8 +67,6 @@ mod from_compositor {
|
|||
target!("GetFocusTopLevelBrowsingContext")
|
||||
},
|
||||
Self::IsReadyToSaveImage(..) => target!("IsReadyToSaveImage"),
|
||||
Self::Keyboard(..) => target!("Keyboard"),
|
||||
Self::IMECompositionEvent(..) => target!("IMECompositionEvent"),
|
||||
Self::AllowNavigationResponse(..) => target!("AllowNavigationResponse"),
|
||||
Self::LoadUrl(..) => target!("LoadUrl"),
|
||||
Self::ClearCache => target!("ClearCache"),
|
||||
|
@ -83,37 +83,32 @@ mod from_compositor {
|
|||
Self::SendError(..) => target!("SendError"),
|
||||
Self::FocusWebView(..) => target!("FocusWebView"),
|
||||
Self::BlurWebView => target!("BlurWebView"),
|
||||
Self::ForwardEvent(_, event) => event.log_target(),
|
||||
Self::ForwardInputEvent(event, ..) => event.log_target(),
|
||||
Self::SetCursor(..) => target!("SetCursor"),
|
||||
Self::ToggleProfiler(..) => target!("EnableProfiler"),
|
||||
Self::ExitFullScreen(_) => target!("ExitFullScreen"),
|
||||
Self::MediaSessionAction(_) => target!("MediaSessionAction"),
|
||||
Self::SetWebViewThrottled(_, _) => target!("SetWebViewThrottled"),
|
||||
Self::IMEDismissed => target!("IMEDismissed"),
|
||||
Self::Gamepad(..) => target!("Gamepad"),
|
||||
Self::Clipboard(..) => target!("Clipboard"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl LogTarget for script_traits::CompositorEvent {
|
||||
impl LogTarget for InputEvent {
|
||||
fn log_target(&self) -> &'static str {
|
||||
macro_rules! target_variant {
|
||||
($name:literal) => {
|
||||
target!("ForwardEvent(" $name ")")
|
||||
target!("ForwardInputEvent(" $name ")")
|
||||
};
|
||||
}
|
||||
match self {
|
||||
Self::ResizeEvent(..) => target_variant!("ResizeEvent"),
|
||||
Self::MouseButtonEvent(..) => target_variant!("MouseButtonEvent"),
|
||||
Self::MouseMoveEvent(..) => target_variant!("MouseMoveEvent"),
|
||||
Self::TouchEvent(..) => target_variant!("TouchEvent"),
|
||||
Self::WheelEvent(..) => target_variant!("WheelEvent"),
|
||||
Self::KeyboardEvent(..) => target_variant!("KeyboardEvent"),
|
||||
Self::CompositionEvent(..) => target_variant!("CompositionEvent"),
|
||||
Self::IMEDismissedEvent => target_variant!("IMEDismissedEvent"),
|
||||
Self::GamepadEvent(..) => target_variant!("GamepadEvent"),
|
||||
Self::ClipboardEvent(..) => target_variant!("ClipboardEvent"),
|
||||
InputEvent::EditingAction(..) => target_variant!("EditingAction"),
|
||||
InputEvent::Gamepad(..) => target_variant!("Gamepad"),
|
||||
InputEvent::Ime(..) => target_variant!("Ime"),
|
||||
InputEvent::Keyboard(..) => target_variant!("Keyboard"),
|
||||
InputEvent::MouseButton(..) => target_variant!("MouseButton"),
|
||||
InputEvent::MouseMove(..) => target_variant!("MouseMove"),
|
||||
InputEvent::Touch(..) => target_variant!("Touch"),
|
||||
InputEvent::Wheel(..) => target_variant!("Wheel"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +242,6 @@ mod from_script {
|
|||
Self::MediaSessionEvent(..) => target_variant!("MediaSessionEvent"),
|
||||
Self::OnDevtoolsStarted(..) => target_variant!("OnDevtoolsStarted"),
|
||||
Self::RequestDevtoolsConnection(..) => target_variant!("RequestDevtoolsConnection"),
|
||||
Self::EventDelivered(..) => target_variant!("EventDelivered"),
|
||||
Self::PlayGamepadHapticEffect(..) => target_variant!("PlayGamepadHapticEffect"),
|
||||
Self::StopGamepadHapticEffect(..) => target_variant!("StopGamepadHapticEffect"),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue