compositor: Make input event handling per-WebView (#35716)

This is another step in the move to having a per-WebView renderer. In
this step event handling is made per-WebView. Most events sent to Servo
are sent via the WebView API already, so this just moves more event
handling code to the per-WebView render portion of the compositor.

- ServoRenderer is given shared ownership and interior mutability as
  it is now shared among all WebView(Renderers).
- Some messages coming from other parts of Servo must now carry a
  WebViewId as well so that they can be associated with a particular
  WebView.
- There needs to be some reorganization of `ServoRenderer` in order to
  avoid issues with double borrow of `RefCells`.

Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Delan Azabani 2025-03-06 02:47:13 +08:00 committed by GitHub
parent 16aeeaec85
commit 69e7499479
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 1016 additions and 887 deletions

View file

@ -65,7 +65,7 @@ pub enum CompositorMsg {
/// Remove a webview.
RemoveWebView(TopLevelBrowsingContextId),
/// Script has handled a touch event, and either prevented or allowed default actions.
TouchEventProcessed(TouchEventResult),
TouchEventProcessed(WebViewId, TouchEventResult),
/// Composite to a PNG file and return the Image over a passed channel.
CreatePng(Option<Rect<f32, CSSPixel>>, IpcSender<Option<Image>>),
/// A reply to the compositor asking if the output image is stable.
@ -89,9 +89,9 @@ pub enum CompositorMsg {
/// The load of a page has completed
LoadComplete(TopLevelBrowsingContextId),
/// WebDriver mouse button event
WebDriverMouseButtonEvent(MouseButtonAction, MouseButton, f32, f32),
WebDriverMouseButtonEvent(WebViewId, MouseButtonAction, MouseButton, f32, f32),
/// WebDriver mouse move event
WebDriverMouseMoveEvent(f32, f32),
WebDriverMouseMoveEvent(WebViewId, f32, f32),
/// Messages forwarded to the compositor by the constellation from other crates. These
/// messages are mainly passed on from the compositor to WebRender.