mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
constellation: Proxy ScrollState
through the Constellation
(#36062)
This will allow removing the dependency of the compositor on `script_traits`, which should make our internal dependency chain a lot easier to deal with. Part of #35984. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
ec20d9a3d7
commit
1f232eb17c
10 changed files with 60 additions and 33 deletions
|
@ -15,7 +15,7 @@ use ipc_channel::ipc::IpcSender;
|
|||
use script_traits::{AnimationTickType, LogEntry, WindowSizeData, WindowSizeType};
|
||||
use servo_url::ServoUrl;
|
||||
use strum_macros::IntoStaticStr;
|
||||
use webrender_traits::CompositorHitTestResult;
|
||||
use webrender_traits::{CompositorHitTestResult, ScrollState};
|
||||
|
||||
/// Messages to the constellation.
|
||||
#[derive(IntoStaticStr)]
|
||||
|
@ -69,6 +69,9 @@ pub enum ConstellationMsg {
|
|||
MediaSessionAction(MediaSessionActionType),
|
||||
/// Set whether to use less resources, by stopping animations and running timers at a heavily limited rate.
|
||||
SetWebViewThrottled(WebViewId, bool),
|
||||
/// The Servo renderer scrolled and is updating the scroll states of the nodes in the
|
||||
/// given pipeline via the constellation.
|
||||
SetScrollStates(PipelineId, Vec<ScrollState>),
|
||||
}
|
||||
|
||||
impl fmt::Debug for ConstellationMsg {
|
||||
|
|
|
@ -33,7 +33,7 @@ use crossbeam_channel::{RecvTimeoutError, Sender};
|
|||
use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, WorkerId};
|
||||
use embedder_traits::input_events::InputEvent;
|
||||
use embedder_traits::{MediaSessionActionType, Theme, WebDriverScriptCommand};
|
||||
use euclid::{Rect, Scale, Size2D, UnknownUnit, Vector2D};
|
||||
use euclid::{Rect, Scale, Size2D, UnknownUnit};
|
||||
use http::{HeaderMap, Method};
|
||||
use ipc_channel::Error as IpcError;
|
||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||
|
@ -56,10 +56,10 @@ use style_traits::{CSSPixel, SpeculativePainter};
|
|||
use stylo_atoms::Atom;
|
||||
#[cfg(feature = "webgpu")]
|
||||
use webgpu::WebGPUMsg;
|
||||
use webrender_api::units::{DevicePixel, LayoutPixel};
|
||||
use webrender_api::{DocumentId, ExternalScrollId, ImageKey};
|
||||
use webrender_api::units::DevicePixel;
|
||||
use webrender_api::{DocumentId, ImageKey};
|
||||
use webrender_traits::{
|
||||
CompositorHitTestResult, CrossProcessCompositorApi,
|
||||
CompositorHitTestResult, CrossProcessCompositorApi, ScrollState,
|
||||
UntrustedNodeAddress as WebRenderUntrustedNodeAddress,
|
||||
};
|
||||
|
||||
|
@ -593,15 +593,6 @@ bitflags! {
|
|||
}
|
||||
}
|
||||
|
||||
/// The scroll state of a stacking context.
|
||||
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct ScrollState {
|
||||
/// The ID of the scroll root.
|
||||
pub scroll_id: ExternalScrollId,
|
||||
/// The scrolling offset of this stacking context.
|
||||
pub scroll_offset: Vector2D<f32, LayoutPixel>,
|
||||
}
|
||||
|
||||
/// Data about the window size.
|
||||
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
|
||||
pub struct WindowSizeData {
|
||||
|
|
|
@ -33,7 +33,7 @@ use net_traits::image_cache::{ImageCache, PendingImageId};
|
|||
use profile_traits::mem::Report;
|
||||
use profile_traits::time;
|
||||
use script_traits::{
|
||||
InitialScriptState, LoadData, Painter, ScriptThreadMessage, ScrollState, UntrustedNodeAddress,
|
||||
InitialScriptState, LoadData, Painter, ScriptThreadMessage, UntrustedNodeAddress,
|
||||
WindowSizeData,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -53,7 +53,7 @@ use style::selector_parser::{PseudoElement, RestyleDamage, Snapshot};
|
|||
use style::stylesheets::Stylesheet;
|
||||
use style_traits::CSSPixel;
|
||||
use webrender_api::ImageKey;
|
||||
use webrender_traits::CrossProcessCompositorApi;
|
||||
use webrender_traits::{CrossProcessCompositorApi, ScrollState};
|
||||
|
||||
pub type GenericLayoutData = dyn Any + Send + Sync;
|
||||
|
||||
|
@ -243,7 +243,7 @@ pub trait Layout {
|
|||
);
|
||||
|
||||
/// Set the scroll states of this layout after a compositor scroll.
|
||||
fn set_scroll_states(&mut self, scroll_states: &[ScrollState]);
|
||||
fn set_scroll_offsets(&mut self, scroll_states: &[ScrollState]);
|
||||
|
||||
/// Set the paint time for a specific epoch.
|
||||
fn set_epoch_paint_time(&mut self, epoch: Epoch, paint_time: CrossProcessInstant);
|
||||
|
|
|
@ -14,13 +14,14 @@ use std::sync::{Arc, Mutex};
|
|||
use base::id::{PipelineId, WebViewId};
|
||||
use display_list::{CompositorDisplayListInfo, ScrollTreeNodeId};
|
||||
use embedder_traits::Cursor;
|
||||
use euclid::Vector2D;
|
||||
use euclid::default::Size2D as UntypedSize2D;
|
||||
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
|
||||
use libc::c_void;
|
||||
use log::warn;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use servo_geometry::{DeviceIndependentIntRect, DeviceIndependentIntSize};
|
||||
use webrender_api::units::{DevicePoint, LayoutPoint, TexelRect};
|
||||
use webrender_api::units::{DevicePoint, LayoutPixel, LayoutPoint, TexelRect};
|
||||
use webrender_api::{
|
||||
BuiltDisplayList, BuiltDisplayListDescriptor, ExternalImage, ExternalImageData,
|
||||
ExternalImageHandler, ExternalImageId, ExternalImageSource, ExternalScrollId,
|
||||
|
@ -530,3 +531,12 @@ pub struct CompositorHitTestResult {
|
|||
/// The scroll tree node associated with this hit test item.
|
||||
pub scroll_tree_node: ScrollTreeNodeId,
|
||||
}
|
||||
|
||||
/// The scroll state of a stacking context.
|
||||
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct ScrollState {
|
||||
/// The ID of the scroll root.
|
||||
pub scroll_id: ExternalScrollId,
|
||||
/// The scrolling offset of this stacking context.
|
||||
pub scroll_offset: Vector2D<f32, LayoutPixel>,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue