Skip to main content

perform_oof_layout

Function perform_oof_layout 

Source
pub(crate) fn perform_oof_layout(
    tree: &mut impl LayoutContainingBlock,
    node_id: NodeId,
    candidates: &[OofCandidate],
    area_size: Size<f32>,
    area_offset: Point<f32>,
    direction: Direction,
    claims: ContainingBlockClaims,
    container_overflow: Point<Overflow>,
    hoisted: &mut Vec<NodeId>,
    unclaimed: &mut OofCandidates,
) -> Rect<f32>
Expand description

Perform final layout on the out-of-flow candidates for which the current node is the containing block, and collect the remainder into unclaimed for further bubbling.

  • node_id is the current node. If its detailed layout info (as returned by LayoutContainingBlock::get_detailed_layout_info) indicates that it is a grid container, each claimed box is positioned relative to the grid area determined by its grid-placement properties rather than the passed inset-resolution area.
  • candidates is the merged, document-ordered list of candidates held by the current node (direct out-of-flow children plus candidates bubbled from in-flow children). Anchors must be relative to the current node’s border box.
  • area_size/area_offset describe the inset-resolution area of the current node (border box minus borders and scrollbar gutters).
  • claims describes which out-of-flow positions the current node acts as a containing block for (see CoreStyle::is_containing_block). The final root positioning pass claims all.
  • container_overflow is the overflow style of the containing block.

Laying out a claimed box may surface further candidates from within its subtree (e.g. a position: fixed descendant of a position: absolute box). These are re-swept: claimed ones are appended to the work list, unclaimed ones are added to unclaimed.

The ids of claimed boxes are appended to hoisted in order. Returns the scrollable overflow contribution of the claimed boxes.