pub struct ScrollTree {
pub nodes: Vec<ScrollTreeNode>,
}
Expand description
A tree of spatial nodes, which mirrors the spatial nodes in the WebRender display list, except these are used to scrolling in the compositor so that new offsets can be sent to WebRender.
Fields§
§nodes: Vec<ScrollTreeNode>
A list of compositor-side scroll nodes that describe the tree of WebRender spatial nodes, used by the compositor to scroll the contents of the display list.
Implementations§
Source§impl ScrollTree
impl ScrollTree
Sourcepub fn add_scroll_tree_node(
&mut self,
parent: Option<&ScrollTreeNodeId>,
info: SpatialTreeNodeInfo,
) -> ScrollTreeNodeId
pub fn add_scroll_tree_node( &mut self, parent: Option<&ScrollTreeNodeId>, info: SpatialTreeNodeInfo, ) -> ScrollTreeNodeId
Add a scroll node to this ScrollTree returning the id of the new node.
Sourcepub fn update_mapping(&mut self, mapping: Vec<SpatialId>)
pub fn update_mapping(&mut self, mapping: Vec<SpatialId>)
Once WebRender display list construction is complete for this ScrollTree
, update
the mapping of nodes to WebRender SpatialId
s.
Sourcepub fn get_node_mut(&mut self, id: &ScrollTreeNodeId) -> &mut ScrollTreeNode
pub fn get_node_mut(&mut self, id: &ScrollTreeNodeId) -> &mut ScrollTreeNode
Get a mutable reference to the node with the given index.
Sourcepub fn get_node(&self, id: &ScrollTreeNodeId) -> &ScrollTreeNode
pub fn get_node(&self, id: &ScrollTreeNodeId) -> &ScrollTreeNode
Get an immutable reference to the node with the given index.
Sourcepub fn webrender_id(&self, id: &ScrollTreeNodeId) -> SpatialId
pub fn webrender_id(&self, id: &ScrollTreeNodeId) -> SpatialId
Get the WebRender SpatialId
for the given [ScrollNodeId
]. This will
panic if [ScrollTree::build_display_list
] has not been called yet.
pub fn scroll_node_or_ancestor_inner( &mut self, scroll_node_id: &ScrollTreeNodeId, scroll_location: ScrollLocation, context: ScrollType, ) -> Option<(ExternalScrollId, LayoutVector2D)>
fn node_with_external_scroll_node_id( &self, external_id: &ExternalScrollId, ) -> Option<ScrollTreeNodeId>
Sourcepub fn scroll_node_or_ancestor(
&mut self,
external_id: &ExternalScrollId,
scroll_location: ScrollLocation,
context: ScrollType,
) -> Option<(ExternalScrollId, LayoutVector2D)>
pub fn scroll_node_or_ancestor( &mut self, external_id: &ExternalScrollId, scroll_location: ScrollLocation, context: ScrollType, ) -> Option<(ExternalScrollId, LayoutVector2D)>
Scroll the scroll node with the given ExternalScrollId
on this scroll tree. If
the node cannot be scrolled, because it’s already scrolled to the maximum scroll
extent, try to scroll an ancestor of this node. Returns the node scrolled and the
new offset if a scroll was performed, otherwise returns None.
Sourcepub fn set_scroll_offset_for_node_with_external_scroll_id(
&mut self,
external_scroll_id: ExternalScrollId,
offset: LayoutVector2D,
context: ScrollType,
) -> Option<LayoutVector2D>
pub fn set_scroll_offset_for_node_with_external_scroll_id( &mut self, external_scroll_id: ExternalScrollId, offset: LayoutVector2D, context: ScrollType, ) -> Option<LayoutVector2D>
Given an ExternalScrollId
and an offset, update the scroll offset of the scroll node
with the given id.
Sourcepub fn set_all_scroll_offsets(
&mut self,
offsets: &FnvHashMap<ExternalScrollId, LayoutVector2D>,
)
pub fn set_all_scroll_offsets( &mut self, offsets: &FnvHashMap<ExternalScrollId, LayoutVector2D>, )
Given a set of all scroll offsets coming from the Servo renderer, update all of the offsets for nodes that actually exist in this tree.
Sourcepub fn reset_all_scroll_offsets(&mut self)
pub fn reset_all_scroll_offsets(&mut self)
Set the offsets of all scrolling nodes in this tree to 0.
Sourcepub fn scroll_offsets(&self) -> FnvHashMap<ExternalScrollId, LayoutVector2D>
pub fn scroll_offsets(&self) -> FnvHashMap<ExternalScrollId, LayoutVector2D>
Collect all of the scroll offsets of the scrolling nodes of this tree into a
HashMap
which can be applied to another tree.
Sourcepub fn scroll_offset(&self, id: ExternalScrollId) -> Option<LayoutVector2D>
pub fn scroll_offset(&self, id: ExternalScrollId) -> Option<LayoutVector2D>
Get the scroll offset for the given ExternalScrollId
or None
if that node cannot
be found in the tree.
Sourcepub fn cumulative_node_to_root_transform(
&self,
node_id: &ScrollTreeNodeId,
) -> FastLayoutTransform
pub fn cumulative_node_to_root_transform( &self, node_id: &ScrollTreeNodeId, ) -> FastLayoutTransform
Find a transformation that can convert a point in the node coordinate system to a point in the root coordinate system.
Sourcepub fn cumulative_root_to_node_transform(
&self,
node_id: &ScrollTreeNodeId,
) -> Option<FastLayoutTransform>
pub fn cumulative_root_to_node_transform( &self, node_id: &ScrollTreeNodeId, ) -> Option<FastLayoutTransform>
Find a transformation that can convert a point in the root coordinate system to a
point in the coordinate system of the given node. This may be None
if the cumulative
transform is uninvertible.
Sourcefn cumulative_node_transform_inner(
&self,
node: &ScrollTreeNode,
) -> (ScrollTreeNodeTransformationCache, AncestorStickyInfo)
fn cumulative_node_transform_inner( &self, node: &ScrollTreeNode, ) -> (ScrollTreeNodeTransformationCache, AncestorStickyInfo)
Traverse a scroll node to its root to calculate the transform.
fn invalidate_cached_transforms(&self)
fn external_scroll_id_for_scroll_tree_node( &self, id: ScrollTreeNodeId, ) -> Option<ExternalScrollId>
Source§impl ScrollTree
Implementation of ScrollTree that is related to debugging.
impl ScrollTree
Implementation of ScrollTree that is related to debugging.
fn nodes_in_adjacency_list(&self) -> Vec<Vec<ScrollTreeNodeId>>
fn debug_print_traversal( &self, print_tree: &mut PrintTree, current_id: &ScrollTreeNodeId, adjacency_list: &[Vec<ScrollTreeNodeId>], )
Sourcepub fn debug_print(&self)
pub fn debug_print(&self)
Print the ScrollTree. Particularly, we are printing the node in preorder traversal. The order of the nodes will depends of the index of a node in the ScrollTree which corresponds to the declarations of the nodes.
Trait Implementations§
Source§impl Debug for ScrollTree
impl Debug for ScrollTree
Source§impl Default for ScrollTree
impl Default for ScrollTree
Source§fn default() -> ScrollTree
fn default() -> ScrollTree
Source§impl<'de> Deserialize<'de> for ScrollTree
impl<'de> Deserialize<'de> for ScrollTree
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl MallocSizeOf for ScrollTree
impl MallocSizeOf for ScrollTree
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Auto Trait Implementations§
impl Freeze for ScrollTree
impl !RefUnwindSafe for ScrollTree
impl Send for ScrollTree
impl !Sync for ScrollTree
impl Unpin for ScrollTree
impl UnwindSafe for ScrollTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.