Skip to main content

RoundTree

Trait RoundTree 

Source
pub trait RoundTree: TraverseTree {
    // Required methods
    fn get_unrounded_layout(&self, node_id: NodeId) -> Layout;
    fn set_final_layout(&mut self, node_id: NodeId, layout: &Layout);
    fn is_out_of_flow(&self, node_id: NodeId) -> bool;
    fn hoisted_child_count(&self, node_id: NodeId) -> usize;
    fn get_hoisted_child_id(&self, node_id: NodeId, index: usize) -> NodeId;
}
Expand description

Trait used by the round_layout method which takes a tree of unrounded float-valued layouts and performs rounding to snap the values to the pixel grid.

As indicated by it’s dependence on TraverseTree, it required full recursive access to the tree.

Required Methods§

Source

fn get_unrounded_layout(&self, node_id: NodeId) -> Layout

Get the node’s unrounded layout

Source

fn set_final_layout(&mut self, node_id: NodeId, layout: &Layout)

Get a reference to the node’s final layout

Source

fn is_out_of_flow(&self, node_id: NodeId) -> bool

Whether the node is an out-of-flow (absolute/fixed) box. Out-of-flow boxes are hoisted to their containing block, so round_layout skips them when visiting a node’s children and instead visits them via their containing block’s hoisted child list.

This should return true for box-generating nodes whose position style is absolute or fixed, and false otherwise (including for display: none nodes).

Source

fn hoisted_child_count(&self, node_id: NodeId) -> usize

The number of out-of-flow boxes whose containing block is node_id (as recorded by LayoutContainingBlock::add_hoisted_children)

Source

fn get_hoisted_child_id(&self, node_id: NodeId, index: usize) -> NodeId

Get the nth out-of-flow box whose containing block is node_id (as recorded by LayoutContainingBlock::add_hoisted_children)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§