diff --git a/src/compute/grid/mod.rs b/src/compute/grid/mod.rs index 32338efed..a9c46d449 100644 --- a/src/compute/grid/mod.rs +++ b/src/compute/grid/mod.rs @@ -581,6 +581,17 @@ pub fn compute_grid_layout( } }); + // Set detailed grid information + #[cfg(feature = "detailed_layout_info")] + tree.set_detailed_grid_info( + node, + DetailedGridInfo { + rows: DetailedGridTracksInfo::from_grid_tracks_and_track_count(final_row_counts, rows), + columns: DetailedGridTracksInfo::from_grid_tracks_and_track_count(final_col_counts, columns), + items: items.iter().map(DetailedGridItemsInfo::from_grid_item).collect(), + }, + ); + // If there are not items then return just the container size (no baseline) if items.is_empty() { return LayoutOutput::from_outer_size(container_border_box); @@ -609,16 +620,6 @@ pub fn compute_grid_layout( item.y_position + item.baseline.unwrap_or(item.height) }; - #[cfg(feature = "detailed_layout_info")] - tree.set_detailed_grid_info( - node, - DetailedGridInfo { - rows: DetailedGridTracksInfo::from_grid_tracks_and_track_count(final_row_counts, rows), - columns: DetailedGridTracksInfo::from_grid_tracks_and_track_count(final_col_counts, columns), - items: items.iter().map(DetailedGridItemsInfo::from_grid_item).collect(), - }, - ); - LayoutOutput::from_sizes_and_baselines( container_border_box, item_content_size_contribution,