compositor: Move WebRender-ish messages and types to webrender_traits (#32315)

* Move WebRender related types to `webrender_traits`

This refactor moves several WebRender related types
from `compositing_traits`, `script_traits` and `net_traits`
crates to the `webrender_traits` crate.

This change also moves the `Image` type and associated
function out of `net_traits` and into the `pixels` crate.

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* Move `script_traits::WebrenderIpcSender` to `webrender_traits::WebRenderScriptApi`

---------

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Mukilan Thiyagarajan 2024-05-20 16:05:18 +05:30 committed by GitHub
parent c2076580f3
commit 2af6fe0b30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
53 changed files with 666 additions and 617 deletions

View file

@ -36,8 +36,7 @@ use compositing::webview::UnknownWebView;
use compositing::windowing::{EmbedderEvent, EmbedderMethods, WindowMethods};
use compositing::{CompositeTarget, IOCompositor, InitialCompositorState, ShutdownState};
use compositing_traits::{
CanvasToCompositorMsg, CompositorMsg, CompositorProxy, CompositorReceiver, ConstellationMsg,
FontToCompositorMsg, ForwardedToCompositorMsg,
CompositorMsg, CompositorProxy, CompositorReceiver, ConstellationMsg, ForwardedToCompositorMsg,
};
#[cfg(all(
not(target_os = "windows"),
@ -96,8 +95,8 @@ use webrender_api::{
NativeFontHandle,
};
use webrender_traits::{
WebRenderFontApi, WebrenderExternalImageHandlers, WebrenderExternalImageRegistry,
WebrenderImageHandlerType,
CanvasToCompositorMsg, FontToCompositorMsg, ImageUpdate, WebRenderFontApi,
WebrenderExternalImageHandlers, WebrenderExternalImageRegistry, WebrenderImageHandlerType,
};
pub use {
background_hang_monitor, base, bluetooth, bluetooth_traits, canvas, canvas_traits, compositing,
@ -1100,7 +1099,7 @@ impl canvas_paint_thread::WebrenderApi for CanvasWebrenderApi {
)));
receiver.recv().ok()
}
fn update_images(&self, updates: Vec<canvas_paint_thread::ImageUpdate>) {
fn update_images(&self, updates: Vec<ImageUpdate>) {
self.0
.send(CompositorMsg::Forwarded(ForwardedToCompositorMsg::Canvas(
CanvasToCompositorMsg::UpdateImages(updates),