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§
Sourcefn get_unrounded_layout(&self, node_id: NodeId) -> Layout
fn get_unrounded_layout(&self, node_id: NodeId) -> Layout
Get the node’s unrounded layout
Sourcefn set_final_layout(&mut self, node_id: NodeId, layout: &Layout)
fn set_final_layout(&mut self, node_id: NodeId, layout: &Layout)
Get a reference to the node’s final layout
Sourcefn is_out_of_flow(&self, node_id: NodeId) -> bool
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).
Sourcefn hoisted_child_count(&self, node_id: NodeId) -> usize
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)
Sourcefn get_hoisted_child_id(&self, node_id: NodeId, index: usize) -> NodeId
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".