Skip to main content

enforce_minimized_locks

Function enforce_minimized_locks 

Source
pub fn enforce_minimized_locks(root: &mut Option<LayoutNode>) -> usize
Expand description

Write-point enforcement of the minimize lock (the invariant-at-the-write companion to prune_dangling_block_refs, per SPEC_LAYOUT_MINIMIZE_LOCKED_STATE_REDESIGN_2026_07_16.md): snap every locked node’s size back to its recorded minimizedLockedSize, returning the delta to the nearest unlocked sibling (next preferred, then previous) so the parent’s flex-unit budget is conserved. It no longer has a frontend twin: since minimize became a display mode (#2197) the frontend drops minimizedLockedSize when it loads a tree (rebuildMinimizedSet in frontend/layout/lib/layoutMinimize.ts), so only a tree that pass has not migrated yet carries a size to snap to. Returns the number of snapped nodes (0 = tree already honored the locks — the common case, cheap to call unconditionally on every write).

If every sibling is locked (inside a dissolved column) the delta is dropped: flex sizes are relative within the parent, so the locked nodes’ shares stay proportionally correct.