pub struct LayoutTree {
pub nodes: Vec<LayoutNode>,
pub root: usize,
pub dom_to_layout: BTreeMap<NodeId, Vec<usize>>,
}Expand description
The complete layout tree structure
Fields§
§nodes: Vec<LayoutNode>Arena-style storage for layout nodes
root: usizeRoot node index
dom_to_layout: BTreeMap<NodeId, Vec<usize>>Mapping from DOM node IDs to layout node indices
Implementations§
Source§impl LayoutTree
impl LayoutTree
pub fn get(&self, index: usize) -> Option<&LayoutNode>
pub fn get_mut(&mut self, index: usize) -> Option<&mut LayoutNode>
pub fn root_node(&self) -> &LayoutNode
Sourcepub fn mark_dirty(&mut self, start_index: usize, flag: DirtyFlag)
pub fn mark_dirty(&mut self, start_index: usize, flag: DirtyFlag)
Marks a node and its ancestors as dirty with the given flag.
The dirty state is “upgraded” if the new flag is more severe than the
existing one (e.g., upgrading from Paint to Layout). Propagation stops
if an ancestor is already marked with an equal or more severe flag.
Sourcepub fn mark_subtree_dirty(&mut self, start_index: usize, flag: DirtyFlag)
pub fn mark_subtree_dirty(&mut self, start_index: usize, flag: DirtyFlag)
Marks a node and its entire subtree of descendants with the given dirty flag.
This is used for inherited CSS properties. Each node in the subtree will be upgraded to at least the new flag’s severity.
Sourcepub fn clear_all_dirty_flags(&mut self)
pub fn clear_all_dirty_flags(&mut self)
Resets the dirty flags of all nodes in the tree to None after layout is complete.
Sourcepub fn get_inline_layout_for_node(
&self,
layout_index: usize,
) -> Option<&Arc<UnifiedLayout>>
pub fn get_inline_layout_for_node( &self, layout_index: usize, ) -> Option<&Arc<UnifiedLayout>>
Get inline layout for a node, navigating through IFC membership if needed.
For text nodes that participate in an IFC (Inline Formatting Context),
the actual inline_layout_result is stored on the IFC root node (the block
container), not on the text node itself. This method handles both cases:
- If the node has its own
inline_layout_result, return it directly - If the node has
ifc_membership, navigate to the IFC root and return its layout
This mirrors the W3C Selection model where:
- Selection.focusNode points to the TEXT node
- But the layout data is owned by the containing block
§Arguments
layout_index- The index of the layout node in the tree
§Returns
The inline layout for the node’s IFC, or None if no layout is available
Trait Implementations§
Source§impl Clone for LayoutTree
impl Clone for LayoutTree
Source§fn clone(&self) -> LayoutTree
fn clone(&self) -> LayoutTree
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for LayoutTree
impl RefUnwindSafe for LayoutTree
impl Send for LayoutTree
impl Sync for LayoutTree
impl Unpin for LayoutTree
impl UnwindSafe for LayoutTree
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more