Remove more IPC messages between script and layout (#32377)

Instead of bouncing messages from the compositor to script and then to
layout, just have script call methods on Layout. Additionally, we do not
need to send any followup messages to script for these messages. Instead
just execute code after calling the method on Layout.
This commit is contained in:
Martin Robinson 2024-05-27 09:30:51 +02:00 committed by GitHub
parent a7bf099cb1
commit 5f0866379a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 103 additions and 165 deletions

View file

@ -33,8 +33,8 @@ use net_traits::ResourceThreads;
use profile_traits::mem::Report;
use profile_traits::time;
use script_traits::{
ConstellationControlMsg, InitialScriptState, LayoutControlMsg, LayoutMsg, LoadData, Painter,
ScrollState, UntrustedNodeAddress, WindowSizeData,
ConstellationControlMsg, InitialScriptState, LayoutMsg, LoadData, Painter, ScrollState,
UntrustedNodeAddress, WindowSizeData,
};
use serde::{Deserialize, Serialize};
use servo_arc::Arc as ServoArc;
@ -178,9 +178,6 @@ pub trait LayoutFactory: Send + Sync {
}
pub trait Layout {
/// Handle a single message from the Constellation.
fn handle_constellation_message(&mut self, msg: LayoutControlMsg);
/// Get a reference to this Layout's Stylo `Device` used to handle media queries and
/// resolve font metrics.
fn device(&self) -> &Device;
@ -228,6 +225,12 @@ pub trait Layout {
painter: Box<dyn Painter>,
);
/// Set the scroll states of this layout after a compositor scroll.
fn set_scroll_states(&mut self, scroll_states: &[ScrollState]);
/// Set the paint time for a specific epoch.
fn set_epoch_paint_time(&mut self, epoch: Epoch, paint_time: u64);
fn query_content_box(&self, node: OpaqueNode) -> Option<Rect<Au>>;
fn query_content_boxes(&self, node: OpaqueNode) -> Vec<Rect<Au>>;
fn query_client_rect(&self, node: OpaqueNode) -> Rect<i32>;