Struct ScrollTree

Source
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

Source

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.

Source

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 SpatialIds.

Source

pub fn get_node_mut(&mut self, id: &ScrollTreeNodeId) -> &mut ScrollTreeNode

Get a mutable reference to the node with the given index.

Source

pub fn get_node(&self, id: &ScrollTreeNodeId) -> &ScrollTreeNode

Get an immutable reference to the node with the given index.

Source

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.

Source

pub fn scroll_node_or_ancestor_inner( &mut self, scroll_node_id: &ScrollTreeNodeId, scroll_location: ScrollLocation, context: ScrollType, ) -> Option<(ExternalScrollId, LayoutVector2D)>

Source

fn node_with_external_scroll_node_id( &self, external_id: &ExternalScrollId, ) -> Option<ScrollTreeNodeId>

Source

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.

Source

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.

Source

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.

Source

pub fn reset_all_scroll_offsets(&mut self)

Set the offsets of all scrolling nodes in this tree to 0.

Source

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.

Source

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.

Source

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.

Source

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.

Source

fn cumulative_node_transform_inner( &self, node: &ScrollTreeNode, ) -> (ScrollTreeNodeTransformationCache, AncestorStickyInfo)

Traverse a scroll node to its root to calculate the transform.

Source

fn invalidate_cached_transforms(&self)

Source

fn external_scroll_id_for_scroll_tree_node( &self, id: ScrollTreeNodeId, ) -> Option<ExternalScrollId>

Source§

impl ScrollTree

Implementation of ScrollTree that is related to debugging.

Source

fn nodes_in_adjacency_list(&self) -> Vec<Vec<ScrollTreeNodeId>>

Source

fn debug_print_traversal( &self, print_tree: &mut PrintTree, current_id: &ScrollTreeNodeId, adjacency_list: &[Vec<ScrollTreeNodeId>], )

Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ScrollTree

Source§

fn default() -> ScrollTree

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ScrollTree

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl MallocSizeOf for ScrollTree

Source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.
Source§

impl Serialize for ScrollTree

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T