pub fn compute_root_layout(
tree: &mut (impl LayoutContainingBlock + CacheTree),
root: NodeId,
available_space: Size<AvailableSpace>,
)Expand description
Compute layout for the root node in the tree
The root’s containing block is the initial containing block (ICB), which has the dimensions of the
viewport (available_space) and is anchored at the canvas origin. The root’s position and inset
styles are resolved against it:
- A
position: absolute/fixedroot is laid out by the out-of-flow positioning routine used for every other out-of-flow box (insets, shrink-to-fit sizing, auto margins, …), with its static position at the ICB origin. This requires a definiteavailable_spacein both axes: otherwise there is no ICB to resolve against and the root is laid out as if it were in flow. - A
position: relativeroot is laid out in flow and then offset by its insets.