pub trait LayoutContainingBlock: LayoutPartialTree {
type OofItemStyle<'a>: OofItemStyle<CustomIdent = Self::CustomIdent>
where Self: 'a;
// Required methods
fn get_oof_item_style(&self, node_id: NodeId) -> Self::OofItemStyle<'_>;
fn clear_hoisted_children(&mut self, node_id: NodeId);
fn add_hoisted_children(&mut self, node_id: NodeId, hoisted: &[NodeId]);
// Provided method
fn get_detailed_layout_info(
&self,
node_id: NodeId,
) -> &DetailedLayoutInfo<Self::CustomIdent> { ... }
}Expand description
Extends LayoutPartialTree with the operations needed by the out-of-flow positioning pass
(compute_oof_layout), which lays out the absolute/fixed boxes
for which a node acts as the containing block.
This trait is required by compute_oof_layout and
compute_root_layout.
Required Associated Types§
Sourcetype OofItemStyle<'a>: OofItemStyle<CustomIdent = Self::CustomIdent>
where
Self: 'a
type OofItemStyle<'a>: OofItemStyle<CustomIdent = Self::CustomIdent> where Self: 'a
The style type representing the styles of an out-of-flow (absolute/fixed) box being positioned by its containing block
Required Methods§
Sourcefn get_oof_item_style(&self, node_id: NodeId) -> Self::OofItemStyle<'_>
fn get_oof_item_style(&self, node_id: NodeId) -> Self::OofItemStyle<'_>
Get the style of an out-of-flow box being positioned by its containing block
Interpreted in the containing block’s axes (see LayoutPartialTree::get_core_container_style).
Sourcefn clear_hoisted_children(&mut self, node_id: NodeId)
fn clear_hoisted_children(&mut self, node_id: NodeId)
Clear the list of out-of-flow (absolute/fixed) boxes whose containing block is node_id.
This is called (exactly once) for each node laid out with RunMode::PerformLayout, before
the boxes it lays out are recorded with add_hoisted_children,
so that lists recorded by previous layout runs do not persist.
Sourcefn add_hoisted_children(&mut self, node_id: NodeId, hoisted: &[NodeId])
fn add_hoisted_children(&mut self, node_id: NodeId, hoisted: &[NodeId])
Append to the list of out-of-flow boxes whose containing block is node_id.
This is called by each containing block for the boxes it lays out, and by
compute_root_layout to record boxes (e.g. position: fixed
boxes) which are positioned by the final root positioning pass, which runs after the root
node’s own layout algorithm has already recorded its list. The recorded lists are consumed
by round_layout (out-of-flow boxes are rounded via their
containing block rather than via their parent), and are also useful for consumers
implementing paint/hit-testing traversals.
Provided Methods§
Sourcefn get_detailed_layout_info(
&self,
node_id: NodeId,
) -> &DetailedLayoutInfo<Self::CustomIdent>
fn get_detailed_layout_info( &self, node_id: NodeId, ) -> &DetailedLayoutInfo<Self::CustomIdent>
Read back the detailed layout information most recently recorded for node_id
(as stored by LayoutGridContainer::set_detailed_grid_info).
This is used by the out-of-flow positioning pass to resolve the grid area of absolutely
positioned boxes whose containing block is a grid container. Implementing this method is
optional: the default implementation returns DetailedLayoutInfo::None, in which case
such boxes are positioned relative to the grid container’s padding box instead of their
grid area.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".