Function compute_widget_layout
pub unsafe fn compute_widget_layout(
taffy: &mut TaffyTree,
root: NodeId,
available: Size<AvailableSpace>,
nodes: &HashMap<NodeId, *mut dyn Widget>,
bindings: &BoundNodeMap,
text: &mut TextRenderer,
) -> Result<(), WidgetLayoutError>Expand description
Measure the host tree and settle allocation-dependent styles before calling
Widget::apply_layout. App and the headless runner use this same solver.
Manual hosts may use it with the maps from their current build_layout.
Raw Taffy layout still works for ordinary Grid tracks, but cannot resolve
CardGrid’s below-minimum single-column fallback without this adjustment.
This changes styles only: widget state and node identities are retained. Paint-only and scroll-translation frames do not need to call it.
§Errors
Returns a Taffy error or DidNotSettle; callers must skip applying/painting
an unsettled layout.
§Safety
nodes and bindings must describe this exact live tree. The caller must
exclusively own every referenced widget throughout the call, without
moving, rebuilding or destroying widgets or allowing pointers to escape.