Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes for aspect ratio and min/max sizes (#317)
* Add aspect ratio support to gentest script + add aspect ratio support to text node content sizing * Add maybe_apply_aspect_ratio helper to Size<Option<f32>> * Apply aspect ratio to leaf node style resolution * Apply aspect ratio when doing final placement of grid items * Make cargo gentest compile generator in release mode * Add tests for aspect ratio of leaf nodes in grid containers * Apply aspect ratio to grid container styles * Apply aspect ratio to automatic minimum size * Add tests for aspect ratio of content-sized leaf nodes * Use main size for flex-basis if flex-basis is not set * Resolve size, min_size, max_size against aspect ratio when generating flex items * Add gentests for aspect-ratio in flex-row (align-start) * Move aspect ratio handling from text measure func to leaf.rs * Tweak clamping of flex item minimum sizes * Add aspect ratio tests for flex-columns with align-items: start * FLexbox: don't apply aspect ratio to max_width when clamping stretched cross-sizes * Add tests for aspect ratio with align-items:stretch (flexbox) * Apply aspect ratio to absolute children of flex container * Remove duplicate test * Namespace grid aspect ratio tests under grid * Absolute positioning: Apply aspect ratio to inset-generated width before generating height from inset * Add tests for aspect ratio height/width for absolutely positioned nodes * Exclude hidden items from absolute positioning * Apply min/max sizes when finally positioning grid items * Add tests for interaction between inset and aspect ratio for absolutely positioned grid children * Always apply margins to absolutely positioned grid items * Rewrite flex item absolute positioning It now: - Applies margins correctly - Applies min/max correctly - Applies aspect ratio correctly * Take border into account when absolutely positioning grid items relative to the grid container * Add absolute positioning margin test * Apply suggestions from code review Co-authored-by: Andreas Weibye <13300393+Weibye@users.noreply.github.com> * Update release notes * Add test for absolutely positioned fallback to static position of grid item in container with border * Implement Add for Rect where the inner type implements Add * Apply aspect ratio and min/max size to flex container size * Cleanup TODOs in the flexbox algorithm * Remove one more TODO * Add min/max size tests for absolutely positioned flex items * Move absolute flex positioning aspect ratio tests under absolute namespace * Clamp available_space by min/max size for final layout * Add tests for applying aspect ratio to min/max size of flex items Co-authored-by: Andreas Weibye <13300393+Weibye@users.noreply.github.com>
- Loading branch information