Available space constraints for layout computation.
Available space represents the amount of space available to a node in a given axis during CSS layout computation. It distinguishes between definite sizes (concrete pixel values) and intrinsic sizing constraints (min-content and max-content). See CSS Sizing Level 3.
Layout algorithms use these constraints to determine node dimensions. Definite specifies a fixed pixel count, Min_content instructs the node to shrink-wrap to its minimum intrinsic size, and Max_content instructs the node to expand to its maximum intrinsic size.
Constraint Propagation
Operations on available space follow consistent semantics for constraint propagation:
Arithmetic operations (add, sub) apply only to Definite values; constraints propagate unchanged.
min operations convert constraints to Definite when combined with concrete values, as constraints represent unbounded space.
max operations preserve constraints, as they remain unbounded after comparison.
Optional variants (min_or_self, add_or_zero) treat None as a no-op.
compute_free_space t used_space computes remaining free space after allocating used_space.
Returns Float.infinity for Max_content (unbounded expansion), 0.0 for Min_content (no free space for expansion), and available -. used_space for Definite available.
is_roughly_equal t other tests approximate equality. Equivalent to equal.
Arithmetic Operations with Concrete Values
These operations combine available space with concrete float values. Operations on Definite values apply standard arithmetic. Constraint handling varies by operation as documented.
min t rhs returns the minimum of t and rhs. Definite values use Float.min. Constraints become Definite rhs, as unbounded space is greater than any finite value.
max t rhs returns the maximum of t and rhs. Definite values use Float.max. Constraints remain unchanged, as they represent unbounded space greater than any finite value.