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

@ -55,7 +55,7 @@ use script_layout_interface::{
use script_traits::{
ConstellationControlMsg, DrawAPaintImageResult, IFrameSizeMsg, LayoutControlMsg,
LayoutMsg as ConstellationMsg, PaintWorkletError, Painter, ScrollState, UntrustedNodeAddress,
WebrenderIpcSender, WindowSizeData, WindowSizeType,
WindowSizeData, WindowSizeType,
};
use servo_arc::Arc as ServoArc;
use servo_atoms::Atom;
@ -89,6 +89,7 @@ use style_traits::{CSSPixel, DevicePixel, SpeculativePainter};
use url::Url;
use webrender_api::units::LayoutPixel;
use webrender_api::{units, ExternalScrollId, HitTestFlags};
use webrender_traits::WebRenderScriptApi;
/// Information needed by layout.
pub struct LayoutThread {
@ -158,7 +159,7 @@ pub struct LayoutThread {
registered_painters: RegisteredPaintersImpl,
/// Webrender interface.
webrender_api: WebrenderIpcSender,
webrender_api: WebRenderScriptApi,
/// Paint time metrics.
paint_time_metrics: PaintTimeMetrics,
@ -328,7 +329,7 @@ impl Layout for LayoutThread {
.webrender_api
.hit_test(Some(self.id.into()), client_point, flags);
results.iter().map(|result| result.node).collect()
results.iter().map(|result| result.node.into()).collect()
}
fn query_offset_parent(&self, node: OpaqueNode) -> OffsetParentResponse {
@ -484,7 +485,7 @@ impl LayoutThread {
image_cache: Arc<dyn ImageCache>,
font_cache_thread: FontCacheThread,
time_profiler_chan: profile_time::ProfilerChan,
webrender_api_sender: WebrenderIpcSender,
webrender_api_sender: WebRenderScriptApi,
paint_time_metrics: PaintTimeMetrics,
window_size: WindowSizeData,
) -> LayoutThread {