mirror of
https://github.com/servo/servo.git
synced 2025-06-21 23:59:00 +01:00
layout: Store scroll offsets in the ScrollTree
(#37428)
There are currently five places that scroll offsets are stored: - DOM: A set of scroll offsets used for script. - Layout: An array of scroll offsets that is used for tracking layout-side scroll offsets. - Layout: The scroll offsets stored in the `ScrollTree`. These are currently unset and unused. - Compositor: The scroll offsets stored in the `ScrollTree` mirrored from layout. - WebRender: The scrolled offsets stored in the WebRender spatial tree. This change is the first step in combining the first three into the layout `ScrollTree`. It eliminates the extra array of scroll offsets stored in layout in favor of the storing them in the `ScrollTree`. A followup change will eliminate the ones stored in the DOM. - In addition the `ScrollState` data structure is eliminated as these are now stored in a `HashMap` everywhere when passing them via IPC. - The offsests stored in layout can now never scroll past the boundaries of the scrolled content. Testing: This should not change behavior and is thus covered by existing WPT tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: stevennovaryo <steven.novaryo@gmail.com>
This commit is contained in:
parent
6cac782fb1
commit
f451dccd0b
11 changed files with 182 additions and 122 deletions
|
@ -9,6 +9,7 @@
|
|||
#![deny(missing_docs)]
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
@ -20,8 +21,8 @@ use bluetooth_traits::BluetoothRequest;
|
|||
use canvas_traits::webgl::WebGLPipeline;
|
||||
use compositing_traits::CrossProcessCompositorApi;
|
||||
use constellation_traits::{
|
||||
LoadData, NavigationHistoryBehavior, ScriptToConstellationChan, ScrollState,
|
||||
StructuredSerializedData, WindowSizeType,
|
||||
LoadData, NavigationHistoryBehavior, ScriptToConstellationChan, StructuredSerializedData,
|
||||
WindowSizeType,
|
||||
};
|
||||
use crossbeam_channel::{RecvTimeoutError, Sender};
|
||||
use devtools_traits::ScriptToDevtoolsControlMsg;
|
||||
|
@ -47,8 +48,8 @@ use style_traits::{CSSPixel, SpeculativePainter};
|
|||
use stylo_atoms::Atom;
|
||||
#[cfg(feature = "webgpu")]
|
||||
use webgpu_traits::WebGPUMsg;
|
||||
use webrender_api::ImageKey;
|
||||
use webrender_api::units::DevicePixel;
|
||||
use webrender_api::units::{DevicePixel, LayoutVector2D};
|
||||
use webrender_api::{ExternalScrollId, ImageKey};
|
||||
|
||||
/// The initial data required to create a new layout attached to an existing script thread.
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
|
@ -246,7 +247,7 @@ pub enum ScriptThreadMessage {
|
|||
SetWebGPUPort(IpcReceiver<WebGPUMsg>),
|
||||
/// The compositor scrolled and is updating the scroll states of the nodes in the given
|
||||
/// pipeline via the Constellation.
|
||||
SetScrollStates(PipelineId, Vec<ScrollState>),
|
||||
SetScrollStates(PipelineId, HashMap<ExternalScrollId, LayoutVector2D>),
|
||||
/// Evaluate the given JavaScript and return a result via a corresponding message
|
||||
/// to the Constellation.
|
||||
EvaluateJavaScript(PipelineId, JavaScriptEvaluationId, String),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue