Expand description
Box sizing, box model constraints, intrinsic measurement, and numerical rules.
Provides:
- Complete box model geometry (
BoxDimensions: content, padding, border, margin boxes). - Min/max constraint resolution with strict floor precedence (
min_size > max_sizemin wins). - Aspect ratio proportional resolution (width-to-height and height-to-width).
- Inset and positioning calculations for
Position::RelativeandPosition::Absolute. - Sizing units resolution (
Dimension,LengthPercentage,LengthPercentageAuto). - Definite vs indefinite available space handling (indefinite percentages collapse to Auto/0.0).
- Negative margin offsets.
- Intrinsic measurement and text measurement caching with zero redundant calls.
- Strict numerical invariants (finite f32, non-negative dimensions).
Structs§
- BoxConstraints
- Min, max, and aspect ratio constraints resolved against available space.
- BoxDimensions
- The four geometric regions of a box in the layout model: content box, padding box, border box, and margin box.
- Text
Measurement Cache - Cache and evaluator for intrinsic text measurements with call counting and constraint caching.
Constants§
- MAX_
LAYOUT_ DEPTH - Maximum recursion depth allowed during layout to prevent infinite loops.
- STRICT_
TOLERANCE_ PX - Numerical comparison tolerance for logical pixel layout.
Traits§
- Measurer
- Trait for intrinsic measurement providers.
Functions§
- apply_
relative_ offset - Applies relative positioning offset to an in-flow item based on its
inset. - compute_
box_ sizing - Computes the complete box dimensions for a node given its style, available space, and optional intrinsic content size.
- resolve_
absolute_ position - Computes the layout position for an out-of-flow
Position::Absolutechild relative to the parent’s padding box. - resolve_
box_ constraints - Extracts and resolves min/max constraints and aspect ratio from a node’s style.
- resolve_
dimension - Resolves a
Dimensionagainst available space on that axis. - resolve_
inset - Resolves insets (left, right, top, bottom) for positioned nodes.
- resolve_
margin - Resolves margins against available space. Negative margins are preserved (FIX-SIZ-009). Percentages against indefinite space resolve to 0.0. Auto resolves to 0.0.
- resolve_
padding - Resolves padding against available space. Indefinite space produces 0.0 for percentages.