Skip to main content

compute_oof_layout

Function compute_oof_layout 

Source
pub fn compute_oof_layout(
    tree: &mut impl LayoutContainingBlock,
    node_id: NodeId,
    output: &mut LayoutOutput,
)
Expand description

Run the out-of-flow positioning pass for node_id after its layout algorithm has produced output: lay out the out-of-flow candidates in output.oof_candidates for which the node is the containing block, record them as the node’s hoisted children, and replace output.oof_candidates with the unclaimed remainder (which bubble further up the tree). The scrollable overflow contributed by the claimed boxes is merged into output.scrollable_overflow_rect.

This should be called once per RunMode::PerformLayout container layout, after the layout algorithm (block/flexbox/grid) has run, and inside any layout caching wrapper (such as compute_cached_layout) so that cache hits do not re-run the pass. It is a no-op when output.oof_positioning_area is None (leaf and size-only outputs).

Which candidates the node claims is determined by the node’s style via CoreStyle::is_containing_block. position: fixed boxes unclaimed by every ancestor are claimed by the final root positioning pass in compute_root_layout.