Raxol.UI.Layout.Flexbox.Solver (Raxol v2.6.1)

View Source

Resolve flexible lengths per CSS Flexbox spec section 9.7, on resolved Raxol.UI.Layout.FlexItems. Called from Flexbox.calculate_single_line_layout/5 for every flex line.

  • free space computed from OUTER sizes (margins included; :auto margins count as 0 during sizing — positioning distributes into them)
  • inflexible items and items whose clamped hypothetical size differs from their base size freeze BEFORE the loop
  • iterative clamp-freeze-redistribute until no min/max violations (bounded by the item count)
  • exact integer accounting: each round distributes whole cells via largest-remainder, so no free space is silently lost to div truncation

Not implemented (documented divergence): the fractional-flex-factor rule (sum of factors < 1 leaves proportional free space undistributed) — factors here are non-negative integers, so a fractional sum cannot occur.

Summary

Functions

Solves main sizes for items inside container_main cells (the container's content-box main size, gaps already subtracted by the caller).

Functions

resolve_flexible_lengths(items, container_main, main_axis)

Solves main sizes for items inside container_main cells (the container's content-box main size, gaps already subtracted by the caller).

Returns items in original order, each with main_size set and frozen.