Skip to content

Commit

Permalink
Grid: only stretch auto tracks if content-alignment is stretch (#783)
Browse files Browse the repository at this point in the history
Signed-off-by: Nico Burns <[email protected]>
  • Loading branch information
nicoburns authored Jan 10, 2025
1 parent e353c14 commit d19b5f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/compute/grid/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ pub fn compute_grid_layout<Tree: LayoutGridContainer>(
AbstractAxis::Inline,
min_size.get(AbstractAxis::Inline),
max_size.get(AbstractAxis::Inline),
justify_content,
align_content,
available_grid_space,
inner_node_size,
Expand All @@ -269,6 +270,7 @@ pub fn compute_grid_layout<Tree: LayoutGridContainer>(
AbstractAxis::Block,
min_size.get(AbstractAxis::Block),
max_size.get(AbstractAxis::Block),
align_content,
justify_content,
available_grid_space,
inner_node_size,
Expand Down Expand Up @@ -385,6 +387,7 @@ pub fn compute_grid_layout<Tree: LayoutGridContainer>(
AbstractAxis::Inline,
min_size.get(AbstractAxis::Inline),
max_size.get(AbstractAxis::Inline),
justify_content,
align_content,
available_grid_space,
inner_node_size,
Expand Down Expand Up @@ -444,6 +447,7 @@ pub fn compute_grid_layout<Tree: LayoutGridContainer>(
AbstractAxis::Block,
min_size.get(AbstractAxis::Block),
max_size.get(AbstractAxis::Block),
align_content,
justify_content,
available_grid_space,
inner_node_size,
Expand Down
5 changes: 4 additions & 1 deletion src/compute/grid/track_sizing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ pub(super) fn track_sizing_algorithm<Tree: LayoutPartialTree>(
axis: AbstractAxis,
axis_min_size: Option<f32>,
axis_max_size: Option<f32>,
axis_alignment: AlignContent,
other_axis_alignment: AlignContent,
available_grid_space: Size<AvailableSpace>,
inner_node_size: Size<Option<f32>>,
Expand Down Expand Up @@ -357,7 +358,9 @@ pub(super) fn track_sizing_algorithm<Tree: LayoutPartialTree>(

// 11.8. Stretch auto Tracks
// This step expands tracks that have an auto max track sizing function by dividing any remaining positive, definite free space equally amongst them.
stretch_auto_tracks(axis_tracks, axis_min_size, axis_available_space_for_expansion);
if axis_alignment == AlignContent::Stretch {
stretch_auto_tracks(axis_tracks, axis_min_size, axis_available_space_for_expansion);
}
}

/// Whether it is a minimum or maximum size's space being distributed
Expand Down

0 comments on commit d19b5f5

Please sign in to comment.