Skip to content

Truly independent web browser

LibWeb: Resolve grid item heights against fixed rows for columns

Andreas Klinga3347130782f
diff --git a/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs
index 18f2d5dd567..580da49ab38 100644
--- a/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs
@@ -1956,8 +1956,47 @@ impl<'pass> GridFormattingContext<'pass> {
.constraints_for_child_context(self.run.box_, self.layout_input.unwrap().containing_block_constraints)
}
+ // The sum of the max track sizing functions of the tracks the item spans in the axis, and the gutters between them,
+ // if those functions are all fixed.
+ fn fixed_track_span_size(&self, item: GridItem, axis: Axis) -> Option<CssPixels> {
+ let available = self.axis_available(axis);
+ let tracks = self.axis_tracks(axis);
+ let gaps = self.axis_gaps(axis);
+ let start = item.position(axis).max(0) as usize;
+ let end = start.saturating_add(item.span(axis)).min(tracks.len());
+ let mut size = CssPixels::default();
+ for (index, track) in tracks.iter().enumerate().take(end).skip(start) {
+ if !track.max_sizing.is_fixed(available) {
+ return None;
+ }
+ size += track.max_sizing.resolve(available);
+ if index + 1 < end {
+ size += gaps.get(index).map_or(CssPixels::default(), |gap| gap.base_size);
+ }
+ }
+ Some(size)
+ }
+
+ // https://drafts.csswg.org/css-grid-2/#algo-overview
+ // If calculating the layout of a grid item in this step depends on the available space in the block axis, assume
+ // the available space that it would have if any row with a definite max track sizing function had that size and all
+ // other rows were infinite.
+ fn column_sizing_constraints(
+ &self,
+ item: GridItem,
+ mut constraints: ContainingBlockConstraints,
+ ) -> ContainingBlockConstraints {
+ if constraints.percentage_basis_block_size.is_none() {
+ constraints.percentage_basis_block_size = self.fixed_track_span_size(item, Axis::Row);
+ }
+ constraints
+ }
+
fn intrinsic_contribution_constraints(&self, item: GridItem, axis: Axis) -> ContainingBlockConstraints {
- let constraints = self.container_constraints();
+ let mut constraints = self.container_constraints();
+ if axis.is_column() {
+ constraints = self.column_sizing_constraints(item, constraints);
+ }
// https://drafts.csswg.org/css-sizing-3/#cyclic-percentage-contribution
// A table's width, min-width and max-width apply to the table box inside the wrapper, so the wrapper's own
// preferred size looks auto. Those percentages still resolve against the grid area, which the column
@@ -3006,7 +3045,9 @@ impl<'pass> GridFormattingContext<'pass> {
block_size: AvailableSize::definite(clamp_to_max_dimension_value(containing_block)),
};
let mut constraints = self.grid_area_constraints(item);
- if !axis.is_column() {
+ if axis.is_column() {
+ constraints = self.column_sizing_constraints(item, constraints);
+ } else {
constraints.percentage_basis_block_size = Some(containing);
}
let preferred = self.item_preferred_size(item, axis);
diff --git a/Libraries/LibWeb/Rust/src/layout/sizing_context.rs b/Libraries/LibWeb/Rust/src/layout/sizing_context.rs
index a0aea315de6..a8ac3fc1091 100644
--- a/Libraries/LibWeb/Rust/src/layout/sizing_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/sizing_context.rs
@@ -2126,7 +2126,7 @@ impl<'pass> SizingContext<'pass> {
// When a box has a preferred aspect ratio, its automatic sizes are calculated the same as for a replaced element
// with a natural aspect ratio and no natural size in that axis.
if !facts.has_preferred_aspect_ratio()
- || !style.width().is_auto()
+ || (facts.is_replaced_box() && !style.width().is_auto())
|| style.height().is_auto()
|| style.height().is_intrinsic_sizing_constraint()
{
@@ -2138,16 +2138,23 @@ impl<'pass> SizingContext<'pass> {
inline_size: AvailableSize::MaxContent,
block_size: AvailableSize::Indefinite,
});
- if self.should_treat_block_size_as_auto(node, available_space, constraints) {
+ // NB: A cyclic percentage width of a non-replaced box behaves as auto for its intrinsic sizes.
+ if !self.should_treat_inline_size_as_auto(node, available_space)
+ || self.should_treat_block_size_as_auto(node, available_space, constraints)
+ {
return None;
}
+ // NB: Replaced elements resolve their sizes here without a percentage basis.
+ let sizing_constraints = if facts.is_replaced_box() {
+ ContainingBlockConstraints::default()
+ } else {
+ constraints
+ };
// https://drafts.csswg.org/css2/#inline-replaced-width
// "(used height) * (intrinsic ratio)"
- let inline_size =
- self.compute_inline_size_for_replaced_element(node, available_space, ContainingBlockConstraints::default());
+ let inline_size = self.compute_inline_size_for_replaced_element(node, available_space, sizing_constraints);
// https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum
- let block_size =
- self.compute_block_size_for_replaced_element(node, available_space, ContainingBlockConstraints::default());
+ let block_size = self.compute_block_size_for_replaced_element(node, available_space, sizing_constraints);
let minimum = self.automatic_minimum_size_from_aspect_ratio(
node,
SizingAxis::Inline,
diff --git a/Tests/LibWeb/Text/expected/css/aspect-ratio-min-max-transfer-matrix.txt b/Tests/LibWeb/Text/expected/css/aspect-ratio-min-max-transfer-matrix.txt
index 4ed19483672..969faf6f223 100644
--- a/Tests/LibWeb/Text/expected/css/aspect-ratio-min-max-transfer-matrix.txt
+++ b/Tests/LibWeb/Text/expected/css/aspect-ratio-min-max-transfer-matrix.txt
@@ -6820,24 +6820,24 @@ grid-definite-row block width=auto height=auto tall min-width-max-height: 150x30
grid-definite-row block width=auto height=auto tall max-width-min-height: 40x60 child=30
grid-definite-row block width=auto height=auto tall border-box-min-height: 120x60 child=25
grid-definite-row block width=auto height=auto tall border-box-max-width: 20x310 child=0
-grid-definite-row block width=auto height=100% empty min-height: 120x120 child=60
+grid-definite-row block width=auto height=100% empty min-height: 240x120 child=60
grid-definite-row block width=auto height=100% empty min-height-large: 300x150 child=75
-grid-definite-row block width=auto height=100% empty max-height: 0x30 child=15
-grid-definite-row block width=auto height=100% empty min-width: 150x120 child=60
-grid-definite-row block width=auto height=100% empty max-width: 0x120 child=60
+grid-definite-row block width=auto height=100% empty max-height: 60x30 child=15
+grid-definite-row block width=auto height=100% empty min-width: 240x120 child=60
+grid-definite-row block width=auto height=100% empty max-width: 40x120 child=60
grid-definite-row block width=auto height=100% empty min-width-max-height: 150x30 child=15
grid-definite-row block width=auto height=100% empty max-width-min-height: 40x120 child=60
-grid-definite-row block width=auto height=100% empty border-box-min-height: 120x120 child=55
-grid-definite-row block width=auto height=100% empty border-box-max-width: 20x120 child=55
-grid-definite-row block width=auto height=100% tall min-height: 120x120 child=60
+grid-definite-row block width=auto height=100% empty border-box-min-height: 240x120 child=55
+grid-definite-row block width=auto height=100% empty border-box-max-width: 40x120 child=55
+grid-definite-row block width=auto height=100% tall min-height: 240x120 child=60
grid-definite-row block width=auto height=100% tall min-height-large: 300x150 child=75
-grid-definite-row block width=auto height=100% tall max-height: 10x30 child=15
-grid-definite-row block width=auto height=100% tall min-width: 150x120 child=60
-grid-definite-row block width=auto height=100% tall max-width: 10x120 child=60
+grid-definite-row block width=auto height=100% tall max-height: 60x30 child=15
+grid-definite-row block width=auto height=100% tall min-width: 240x120 child=60
+grid-definite-row block width=auto height=100% tall max-width: 40x120 child=60
grid-definite-row block width=auto height=100% tall min-width-max-height: 150x30 child=15
grid-definite-row block width=auto height=100% tall max-width-min-height: 40x120 child=60
-grid-definite-row block width=auto height=100% tall border-box-min-height: 120x120 child=55
-grid-definite-row block width=auto height=100% tall border-box-max-width: 20x120 child=55
+grid-definite-row block width=auto height=100% tall border-box-min-height: 240x120 child=55
+grid-definite-row block width=auto height=100% tall border-box-max-width: 40x120 child=55
grid-definite-row block width=auto height=40px empty min-height: 120x60 child=30
grid-definite-row block width=auto height=40px empty min-height-large: 300x150 child=75
grid-definite-row block width=auto height=40px empty max-height: 60x30 child=15
@@ -6928,23 +6928,23 @@ grid-definite-row block width=50% height=auto tall min-width-max-height: 150x30
grid-definite-row block width=50% height=auto tall max-width-min-height: 40x60 child=30
grid-definite-row block width=50% height=auto tall border-box-min-height: 100x60 child=25
grid-definite-row block width=50% height=auto tall border-box-max-width: 40x315 child=5
-grid-definite-row block width=50% height=100% empty min-height: 100x120 child=60
+grid-definite-row block width=50% height=100% empty min-height: 120x120 child=60
grid-definite-row block width=50% height=100% empty min-height-large: 150x150 child=75
grid-definite-row block width=50% height=100% empty max-height: 100x30 child=15
grid-definite-row block width=50% height=100% empty min-width: 150x120 child=60
grid-definite-row block width=50% height=100% empty max-width: 40x120 child=60
grid-definite-row block width=50% height=100% empty min-width-max-height: 150x30 child=15
grid-definite-row block width=50% height=100% empty max-width-min-height: 40x120 child=60
-grid-definite-row block width=50% height=100% empty border-box-min-height: 100x120 child=55
+grid-definite-row block width=50% height=100% empty border-box-min-height: 120x120 child=55
grid-definite-row block width=50% height=100% empty border-box-max-width: 40x120 child=55
-grid-definite-row block width=50% height=100% tall min-height: 100x120 child=60
+grid-definite-row block width=50% height=100% tall min-height: 120x120 child=60
grid-definite-row block width=50% height=100% tall min-height-large: 150x150 child=75
grid-definite-row block width=50% height=100% tall max-height: 100x30 child=15
grid-definite-row block width=50% height=100% tall min-width: 150x120 child=60
grid-definite-row block width=50% height=100% tall max-width: 40x120 child=60
grid-definite-row block width=50% height=100% tall min-width-max-height: 150x30 child=15
grid-definite-row block width=50% height=100% tall max-width-min-height: 40x120 child=60
-grid-definite-row block width=50% height=100% tall border-box-min-height: 100x120 child=55
+grid-definite-row block width=50% height=100% tall border-box-min-height: 120x120 child=55
grid-definite-row block width=50% height=100% tall border-box-max-width: 40x120 child=55
grid-definite-row block width=50% height=40px empty min-height: 100x60 child=30
grid-definite-row block width=50% height=40px empty min-height-large: 150x150 child=75
@@ -6982,24 +6982,24 @@ grid-definite-row flow-root width=auto height=auto tall min-width-max-height: 15
grid-definite-row flow-root width=auto height=auto tall max-width-min-height: 40x60 child=30
grid-definite-row flow-root width=auto height=auto tall border-box-min-height: 120x60 child=25
grid-definite-row flow-root width=auto height=auto tall border-box-max-width: 20x310 child=0
-grid-definite-row flow-root width=auto height=100% empty min-height: 120x120 child=60
+grid-definite-row flow-root width=auto height=100% empty min-height: 240x120 child=60
grid-definite-row flow-root width=auto height=100% empty min-height-large: 300x150 child=75
-grid-definite-row flow-root width=auto height=100% empty max-height: 0x30 child=15
-grid-definite-row flow-root width=auto height=100% empty min-width: 150x120 child=60
-grid-definite-row flow-root width=auto height=100% empty max-width: 0x120 child=60
+grid-definite-row flow-root width=auto height=100% empty max-height: 60x30 child=15
+grid-definite-row flow-root width=auto height=100% empty min-width: 240x120 child=60
+grid-definite-row flow-root width=auto height=100% empty max-width: 40x120 child=60
grid-definite-row flow-root width=auto height=100% empty min-width-max-height: 150x30 child=15
grid-definite-row flow-root width=auto height=100% empty max-width-min-height: 40x120 child=60
-grid-definite-row flow-root width=auto height=100% empty border-box-min-height: 120x120 child=55
-grid-definite-row flow-root width=auto height=100% empty border-box-max-width: 20x120 child=55
-grid-definite-row flow-root width=auto height=100% tall min-height: 120x120 child=60
+grid-definite-row flow-root width=auto height=100% empty border-box-min-height: 240x120 child=55
+grid-definite-row flow-root width=auto height=100% empty border-box-max-width: 40x120 child=55
+grid-definite-row flow-root width=auto height=100% tall min-height: 240x120 child=60
grid-definite-row flow-root width=auto height=100% tall min-height-large: 300x150 child=75
-grid-definite-row flow-root width=auto height=100% tall max-height: 10x30 child=15
-grid-definite-row flow-root width=auto height=100% tall min-width: 150x120 child=60
-grid-definite-row flow-root width=auto height=100% tall max-width: 10x120 child=60
+grid-definite-row flow-root width=auto height=100% tall max-height: 60x30 child=15
+grid-definite-row flow-root width=auto height=100% tall min-width: 240x120 child=60
+grid-definite-row flow-root width=auto height=100% tall max-width: 40x120 child=60
grid-definite-row flow-root width=auto height=100% tall min-width-max-height: 150x30 child=15
grid-definite-row flow-root width=auto height=100% tall max-width-min-height: 40x120 child=60
-grid-definite-row flow-root width=auto height=100% tall border-box-min-height: 120x120 child=55
-grid-definite-row flow-root width=auto height=100% tall border-box-max-width: 20x120 child=55
+grid-definite-row flow-root width=auto height=100% tall border-box-min-height: 240x120 child=55
+grid-definite-row flow-root width=auto height=100% tall border-box-max-width: 40x120 child=55
grid-definite-row flow-root width=auto height=40px empty min-height: 120x60 child=30
grid-definite-row flow-root width=auto height=40px empty min-height-large: 300x150 child=75
grid-definite-row flow-root width=auto height=40px empty max-height: 60x30 child=15
@@ -7090,23 +7090,23 @@ grid-definite-row flow-root width=50% height=auto tall min-width-max-height: 150
grid-definite-row flow-root width=50% height=auto tall max-width-min-height: 40x60 child=30
grid-definite-row flow-root width=50% height=auto tall border-box-min-height: 100x60 child=25
grid-definite-row flow-root width=50% height=auto tall border-box-max-width: 40x315 child=5
-grid-definite-row flow-root width=50% height=100% empty min-height: 100x120 child=60
+grid-definite-row flow-root width=50% height=100% empty min-height: 120x120 child=60
grid-definite-row flow-root width=50% height=100% empty min-height-large: 150x150 child=75
grid-definite-row flow-root width=50% height=100% empty max-height: 100x30 child=15
grid-definite-row flow-root width=50% height=100% empty min-width: 150x120 child=60
grid-definite-row flow-root width=50% height=100% empty max-width: 40x120 child=60
grid-definite-row flow-root width=50% height=100% empty min-width-max-height: 150x30 child=15
grid-definite-row flow-root width=50% height=100% empty max-width-min-height: 40x120 child=60
-grid-definite-row flow-root width=50% height=100% empty border-box-min-height: 100x120 child=55
+grid-definite-row flow-root width=50% height=100% empty border-box-min-height: 120x120 child=55
grid-definite-row flow-root width=50% height=100% empty border-box-max-width: 40x120 child=55
-grid-definite-row flow-root width=50% height=100% tall min-height: 100x120 child=60
+grid-definite-row flow-root width=50% height=100% tall min-height: 120x120 child=60
grid-definite-row flow-root width=50% height=100% tall min-height-large: 150x150 child=75
grid-definite-row flow-root width=50% height=100% tall max-height: 100x30 child=15
grid-definite-row flow-root width=50% height=100% tall min-width: 150x120 child=60
grid-definite-row flow-root width=50% height=100% tall max-width: 40x120 child=60
grid-definite-row flow-root width=50% height=100% tall min-width-max-height: 150x30 child=15
grid-definite-row flow-root width=50% height=100% tall max-width-min-height: 40x120 child=60
-grid-definite-row flow-root width=50% height=100% tall border-box-min-height: 100x120 child=55
+grid-definite-row flow-root width=50% height=100% tall border-box-min-height: 120x120 child=55
grid-definite-row flow-root width=50% height=100% tall border-box-max-width: 40x120 child=55
grid-definite-row flow-root width=50% height=40px empty min-height: 100x60 child=30
grid-definite-row flow-root width=50% height=40px empty min-height-large: 150x150 child=75
@@ -7144,24 +7144,24 @@ grid-definite-row inline-block width=auto height=auto tall min-width-max-height:
grid-definite-row inline-block width=auto height=auto tall max-width-min-height: 40x60 child=30
grid-definite-row inline-block width=auto height=auto tall border-box-min-height: 120x60 child=25
grid-definite-row inline-block width=auto height=auto tall border-box-max-width: 20x310 child=0
-grid-definite-row inline-block width=auto height=100% empty min-height: 120x120 child=60
+grid-definite-row inline-block width=auto height=100% empty min-height: 240x120 child=60
grid-definite-row inline-block width=auto height=100% empty min-height-large: 300x150 child=75
-grid-definite-row inline-block width=auto height=100% empty max-height: 0x30 child=15
-grid-definite-row inline-block width=auto height=100% empty min-width: 150x120 child=60
-grid-definite-row inline-block width=auto height=100% empty max-width: 0x120 child=60
+grid-definite-row inline-block width=auto height=100% empty max-height: 60x30 child=15
+grid-definite-row inline-block width=auto height=100% empty min-width: 240x120 child=60
+grid-definite-row inline-block width=auto height=100% empty max-width: 40x120 child=60
grid-definite-row inline-block width=auto height=100% empty min-width-max-height: 150x30 child=15
grid-definite-row inline-block width=auto height=100% empty max-width-min-height: 40x120 child=60
-grid-definite-row inline-block width=auto height=100% empty border-box-min-height: 120x120 child=55
-grid-definite-row inline-block width=auto height=100% empty border-box-max-width: 20x120 child=55
-grid-definite-row inline-block width=auto height=100% tall min-height: 120x120 child=60
+grid-definite-row inline-block width=auto height=100% empty border-box-min-height: 240x120 child=55
+grid-definite-row inline-block width=auto height=100% empty border-box-max-width: 40x120 child=55
+grid-definite-row inline-block width=auto height=100% tall min-height: 240x120 child=60
grid-definite-row inline-block width=auto height=100% tall min-height-large: 300x150 child=75
-grid-definite-row inline-block width=auto height=100% tall max-height: 10x30 child=15
-grid-definite-row inline-block width=auto height=100% tall min-width: 150x120 child=60
-grid-definite-row inline-block width=auto height=100% tall max-width: 10x120 child=60
+grid-definite-row inline-block width=auto height=100% tall max-height: 60x30 child=15
+grid-definite-row inline-block width=auto height=100% tall min-width: 240x120 child=60
+grid-definite-row inline-block width=auto height=100% tall max-width: 40x120 child=60
grid-definite-row inline-block width=auto height=100% tall min-width-max-height: 150x30 child=15
grid-definite-row inline-block width=auto height=100% tall max-width-min-height: 40x120 child=60
-grid-definite-row inline-block width=auto height=100% tall border-box-min-height: 120x120 child=55
-grid-definite-row inline-block width=auto height=100% tall border-box-max-width: 20x120 child=55
+grid-definite-row inline-block width=auto height=100% tall border-box-min-height: 240x120 child=55
+grid-definite-row inline-block width=auto height=100% tall border-box-max-width: 40x120 child=55
grid-definite-row inline-block width=auto height=40px empty min-height: 120x60 child=30
grid-definite-row inline-block width=auto height=40px empty min-height-large: 300x150 child=75
grid-definite-row inline-block width=auto height=40px empty max-height: 60x30 child=15
@@ -7252,23 +7252,23 @@ grid-definite-row inline-block width=50% height=auto tall min-width-max-height:
grid-definite-row inline-block width=50% height=auto tall max-width-min-height: 40x60 child=30
grid-definite-row inline-block width=50% height=auto tall border-box-min-height: 100x60 child=25
grid-definite-row inline-block width=50% height=auto tall border-box-max-width: 40x315 child=5
-grid-definite-row inline-block width=50% height=100% empty min-height: 100x120 child=60
+grid-definite-row inline-block width=50% height=100% empty min-height: 120x120 child=60
grid-definite-row inline-block width=50% height=100% empty min-height-large: 150x150 child=75
grid-definite-row inline-block width=50% height=100% empty max-height: 100x30 child=15
grid-definite-row inline-block width=50% height=100% empty min-width: 150x120 child=60
grid-definite-row inline-block width=50% height=100% empty max-width: 40x120 child=60
grid-definite-row inline-block width=50% height=100% empty min-width-max-height: 150x30 child=15
grid-definite-row inline-block width=50% height=100% empty max-width-min-height: 40x120 child=60
-grid-definite-row inline-block width=50% height=100% empty border-box-min-height: 100x120 child=55
+grid-definite-row inline-block width=50% height=100% empty border-box-min-height: 120x120 child=55
grid-definite-row inline-block width=50% height=100% empty border-box-max-width: 40x120 child=55
-grid-definite-row inline-block width=50% height=100% tall min-height: 100x120 child=60
+grid-definite-row inline-block width=50% height=100% tall min-height: 120x120 child=60
grid-definite-row inline-block width=50% height=100% tall min-height-large: 150x150 child=75
grid-definite-row inline-block width=50% height=100% tall max-height: 100x30 child=15
grid-definite-row inline-block width=50% height=100% tall min-width: 150x120 child=60
grid-definite-row inline-block width=50% height=100% tall max-width: 40x120 child=60
grid-definite-row inline-block width=50% height=100% tall min-width-max-height: 150x30 child=15
grid-definite-row inline-block width=50% height=100% tall max-width-min-height: 40x120 child=60
-grid-definite-row inline-block width=50% height=100% tall border-box-min-height: 100x120 child=55
+grid-definite-row inline-block width=50% height=100% tall border-box-min-height: 120x120 child=55
grid-definite-row inline-block width=50% height=100% tall border-box-max-width: 40x120 child=55
grid-definite-row inline-block width=50% height=40px empty min-height: 100x60 child=30
grid-definite-row inline-block width=50% height=40px empty min-height-large: 150x150 child=75
@@ -7306,24 +7306,24 @@ grid-definite-row float width=auto height=auto tall min-width-max-height: 150x30
grid-definite-row float width=auto height=auto tall max-width-min-height: 40x60 child=30
grid-definite-row float width=auto height=auto tall border-box-min-height: 120x60 child=25
grid-definite-row float width=auto height=auto tall border-box-max-width: 20x310 child=0
-grid-definite-row float width=auto height=100% empty min-height: 120x120 child=60
+grid-definite-row float width=auto height=100% empty min-height: 240x120 child=60
grid-definite-row float width=auto height=100% empty min-height-large: 300x150 child=75
-grid-definite-row float width=auto height=100% empty max-height: 0x30 child=15
-grid-definite-row float width=auto height=100% empty min-width: 150x120 child=60
-grid-definite-row float width=auto height=100% empty max-width: 0x120 child=60
+grid-definite-row float width=auto height=100% empty max-height: 60x30 child=15
+grid-definite-row float width=auto height=100% empty min-width: 240x120 child=60
+grid-definite-row float width=auto height=100% empty max-width: 40x120 child=60
grid-definite-row float width=auto height=100% empty min-width-max-height: 150x30 child=15
grid-definite-row float width=auto height=100% empty max-width-min-height: 40x120 child=60
-grid-definite-row float width=auto height=100% empty border-box-min-height: 120x120 child=55
-grid-definite-row float width=auto height=100% empty border-box-max-width: 20x120 child=55
-grid-definite-row float width=auto height=100% tall min-height: 120x120 child=60
+grid-definite-row float width=auto height=100% empty border-box-min-height: 240x120 child=55
+grid-definite-row float width=auto height=100% empty border-box-max-width: 40x120 child=55
+grid-definite-row float width=auto height=100% tall min-height: 240x120 child=60
grid-definite-row float width=auto height=100% tall min-height-large: 300x150 child=75
-grid-definite-row float width=auto height=100% tall max-height: 10x30 child=15
-grid-definite-row float width=auto height=100% tall min-width: 150x120 child=60
-grid-definite-row float width=auto height=100% tall max-width: 10x120 child=60
+grid-definite-row float width=auto height=100% tall max-height: 60x30 child=15
+grid-definite-row float width=auto height=100% tall min-width: 240x120 child=60
+grid-definite-row float width=auto height=100% tall max-width: 40x120 child=60
grid-definite-row float width=auto height=100% tall min-width-max-height: 150x30 child=15
grid-definite-row float width=auto height=100% tall max-width-min-height: 40x120 child=60
-grid-definite-row float width=auto height=100% tall border-box-min-height: 120x120 child=55
-grid-definite-row float width=auto height=100% tall border-box-max-width: 20x120 child=55
+grid-definite-row float width=auto height=100% tall border-box-min-height: 240x120 child=55
+grid-definite-row float width=auto height=100% tall border-box-max-width: 40x120 child=55
grid-definite-row float width=auto height=40px empty min-height: 120x60 child=30
grid-definite-row float width=auto height=40px empty min-height-large: 300x150 child=75
grid-definite-row float width=auto height=40px empty max-height: 60x30 child=15
@@ -7414,23 +7414,23 @@ grid-definite-row float width=50% height=auto tall min-width-max-height: 150x30
grid-definite-row float width=50% height=auto tall max-width-min-height: 40x60 child=30
grid-definite-row float width=50% height=auto tall border-box-min-height: 100x60 child=25
grid-definite-row float width=50% height=auto tall border-box-max-width: 40x315 child=5
-grid-definite-row float width=50% height=100% empty min-height: 100x120 child=60
+grid-definite-row float width=50% height=100% empty min-height: 120x120 child=60
grid-definite-row float width=50% height=100% empty min-height-large: 150x150 child=75
grid-definite-row float width=50% height=100% empty max-height: 100x30 child=15
grid-definite-row float width=50% height=100% empty min-width: 150x120 child=60
grid-definite-row float width=50% height=100% empty max-width: 40x120 child=60
grid-definite-row float width=50% height=100% empty min-width-max-height: 150x30 child=15
grid-definite-row float width=50% height=100% empty max-width-min-height: 40x120 child=60
-grid-definite-row float width=50% height=100% empty border-box-min-height: 100x120 child=55
+grid-definite-row float width=50% height=100% empty border-box-min-height: 120x120 child=55
grid-definite-row float width=50% height=100% empty border-box-max-width: 40x120 child=55
-grid-definite-row float width=50% height=100% tall min-height: 100x120 child=60
+grid-definite-row float width=50% height=100% tall min-height: 120x120 child=60
grid-definite-row float width=50% height=100% tall min-height-large: 150x150 child=75
grid-definite-row float width=50% height=100% tall max-height: 100x30 child=15
grid-definite-row float width=50% height=100% tall min-width: 150x120 child=60
grid-definite-row float width=50% height=100% tall max-width: 40x120 child=60
grid-definite-row float width=50% height=100% tall min-width-max-height: 150x30 child=15
grid-definite-row float width=50% height=100% tall max-width-min-height: 40x120 child=60
-grid-definite-row float width=50% height=100% tall border-box-min-height: 100x120 child=55
+grid-definite-row float width=50% height=100% tall border-box-min-height: 120x120 child=55
grid-definite-row float width=50% height=100% tall border-box-max-width: 40x120 child=55
grid-definite-row float width=50% height=40px empty min-height: 100x60 child=30
grid-definite-row float width=50% height=40px empty min-height-large: 150x150 child=75
@@ -7468,24 +7468,24 @@ grid-definite-row flex width=auto height=auto tall min-width-max-height: 150x30
grid-definite-row flex width=auto height=auto tall max-width-min-height: 40x60 child=30
grid-definite-row flex width=auto height=auto tall border-box-min-height: 120x60 child=25
grid-definite-row flex width=auto height=auto tall border-box-max-width: 20x310 child=0
-grid-definite-row flex width=auto height=100% empty min-height: 120x120 child=60
+grid-definite-row flex width=auto height=100% empty min-height: 240x120 child=60
grid-definite-row flex width=auto height=100% empty min-height-large: 300x150 child=75
-grid-definite-row flex width=auto height=100% empty max-height: 0x30 child=15
-grid-definite-row flex width=auto height=100% empty min-width: 150x120 child=60
-grid-definite-row flex width=auto height=100% empty max-width: 0x120 child=60
+grid-definite-row flex width=auto height=100% empty max-height: 60x30 child=15
+grid-definite-row flex width=auto height=100% empty min-width: 240x120 child=60
+grid-definite-row flex width=auto height=100% empty max-width: 40x120 child=60
grid-definite-row flex width=auto height=100% empty min-width-max-height: 150x30 child=15
grid-definite-row flex width=auto height=100% empty max-width-min-height: 40x120 child=60
-grid-definite-row flex width=auto height=100% empty border-box-min-height: 120x120 child=55
-grid-definite-row flex width=auto height=100% empty border-box-max-width: 20x120 child=55
-grid-definite-row flex width=auto height=100% tall min-height: 120x120 child=60
+grid-definite-row flex width=auto height=100% empty border-box-min-height: 240x120 child=55
+grid-definite-row flex width=auto height=100% empty border-box-max-width: 40x120 child=55
+grid-definite-row flex width=auto height=100% tall min-height: 240x120 child=60
grid-definite-row flex width=auto height=100% tall min-height-large: 300x150 child=75
-grid-definite-row flex width=auto height=100% tall max-height: 10x30 child=15
-grid-definite-row flex width=auto height=100% tall min-width: 150x120 child=60
-grid-definite-row flex width=auto height=100% tall max-width: 10x120 child=60
+grid-definite-row flex width=auto height=100% tall max-height: 60x30 child=15
+grid-definite-row flex width=auto height=100% tall min-width: 240x120 child=60
+grid-definite-row flex width=auto height=100% tall max-width: 40x120 child=60
grid-definite-row flex width=auto height=100% tall min-width-max-height: 150x30 child=15
grid-definite-row flex width=auto height=100% tall max-width-min-height: 40x120 child=60
-grid-definite-row flex width=auto height=100% tall border-box-min-height: 120x120 child=55
-grid-definite-row flex width=auto height=100% tall border-box-max-width: 20x120 child=55
+grid-definite-row flex width=auto height=100% tall border-box-min-height: 240x120 child=55
+grid-definite-row flex width=auto height=100% tall border-box-max-width: 40x120 child=55
grid-definite-row flex width=auto height=40px empty min-height: 120x60 child=30
grid-definite-row flex width=auto height=40px empty min-height-large: 300x150 child=75
grid-definite-row flex width=auto height=40px empty max-height: 60x30 child=15
@@ -7576,23 +7576,23 @@ grid-definite-row flex width=50% height=auto tall min-width-max-height: 150x30 c
grid-definite-row flex width=50% height=auto tall max-width-min-height: 40x60 child=30
grid-definite-row flex width=50% height=auto tall border-box-min-height: 100x60 child=25
grid-definite-row flex width=50% height=auto tall border-box-max-width: 40x310 child=5
-grid-definite-row flex width=50% height=100% empty min-height: 100x120 child=60
+grid-definite-row flex width=50% height=100% empty min-height: 120x120 child=60
grid-definite-row flex width=50% height=100% empty min-height-large: 150x150 child=75
grid-definite-row flex width=50% height=100% empty max-height: 100x30 child=15
grid-definite-row flex width=50% height=100% empty min-width: 150x120 child=60
grid-definite-row flex width=50% height=100% empty max-width: 40x120 child=60
grid-definite-row flex width=50% height=100% empty min-width-max-height: 150x30 child=15
grid-definite-row flex width=50% height=100% empty max-width-min-height: 40x120 child=60
-grid-definite-row flex width=50% height=100% empty border-box-min-height: 100x120 child=55
+grid-definite-row flex width=50% height=100% empty border-box-min-height: 120x120 child=55
grid-definite-row flex width=50% height=100% empty border-box-max-width: 40x120 child=55
-grid-definite-row flex width=50% height=100% tall min-height: 100x120 child=60
+grid-definite-row flex width=50% height=100% tall min-height: 120x120 child=60
grid-definite-row flex width=50% height=100% tall min-height-large: 150x150 child=75
grid-definite-row flex width=50% height=100% tall max-height: 100x30 child=15
grid-definite-row flex width=50% height=100% tall min-width: 150x120 child=60
grid-definite-row flex width=50% height=100% tall max-width: 40x120 child=60
grid-definite-row flex width=50% height=100% tall min-width-max-height: 150x30 child=15
grid-definite-row flex width=50% height=100% tall max-width-min-height: 40x120 child=60
-grid-definite-row flex width=50% height=100% tall border-box-min-height: 100x120 child=55
+grid-definite-row flex width=50% height=100% tall border-box-min-height: 120x120 child=55
grid-definite-row flex width=50% height=100% tall border-box-max-width: 40x120 child=55
grid-definite-row flex width=50% height=40px empty min-height: 100x60 child=30
grid-definite-row flex width=50% height=40px empty min-height-large: 150x150 child=75
@@ -7630,24 +7630,24 @@ grid-definite-row grid width=auto height=auto tall min-width-max-height: 150x30
grid-definite-row grid width=auto height=auto tall max-width-min-height: 40x60 child=0
grid-definite-row grid width=auto height=auto tall border-box-min-height: 120x60 child=0
grid-definite-row grid width=auto height=auto tall border-box-max-width: 20x310 child=0
-grid-definite-row grid width=auto height=100% empty min-height: 120x120 child=60
+grid-definite-row grid width=auto height=100% empty min-height: 240x120 child=60
grid-definite-row grid width=auto height=100% empty min-height-large: 300x150 child=75
-grid-definite-row grid width=auto height=100% empty max-height: 0x30 child=15
-grid-definite-row grid width=auto height=100% empty min-width: 150x120 child=60
-grid-definite-row grid width=auto height=100% empty max-width: 0x120 child=60
+grid-definite-row grid width=auto height=100% empty max-height: 60x30 child=15
+grid-definite-row grid width=auto height=100% empty min-width: 240x120 child=60
+grid-definite-row grid width=auto height=100% empty max-width: 40x120 child=60
grid-definite-row grid width=auto height=100% empty min-width-max-height: 150x30 child=15
grid-definite-row grid width=auto height=100% empty max-width-min-height: 40x120 child=60
-grid-definite-row grid width=auto height=100% empty border-box-min-height: 120x120 child=55
-grid-definite-row grid width=auto height=100% empty border-box-max-width: 20x120 child=55
-grid-definite-row grid width=auto height=100% tall min-height: 120x120 child=0
+grid-definite-row grid width=auto height=100% empty border-box-min-height: 240x120 child=55
+grid-definite-row grid width=auto height=100% empty border-box-max-width: 40x120 child=55
+grid-definite-row grid width=auto height=100% tall min-height: 240x120 child=0
grid-definite-row grid width=auto height=100% tall min-height-large: 300x150 child=0
-grid-definite-row grid width=auto height=100% tall max-height: 10x30 child=0
-grid-definite-row grid width=auto height=100% tall min-width: 150x120 child=0
-grid-definite-row grid width=auto height=100% tall max-width: 10x120 child=0
+grid-definite-row grid width=auto height=100% tall max-height: 60x30 child=0
+grid-definite-row grid width=auto height=100% tall min-width: 240x120 child=0
+grid-definite-row grid width=auto height=100% tall max-width: 40x120 child=0
grid-definite-row grid width=auto height=100% tall min-width-max-height: 150x30 child=0
grid-definite-row grid width=auto height=100% tall max-width-min-height: 40x120 child=0
-grid-definite-row grid width=auto height=100% tall border-box-min-height: 120x120 child=0
-grid-definite-row grid width=auto height=100% tall border-box-max-width: 20x120 child=0
+grid-definite-row grid width=auto height=100% tall border-box-min-height: 240x120 child=0
+grid-definite-row grid width=auto height=100% tall border-box-max-width: 40x120 child=0
grid-definite-row grid width=auto height=40px empty min-height: 120x60 child=30
grid-definite-row grid width=auto height=40px empty min-height-large: 300x150 child=75
grid-definite-row grid width=auto height=40px empty max-height: 60x30 child=15
@@ -7738,23 +7738,23 @@ grid-definite-row grid width=50% height=auto tall min-width-max-height: 150x30 c
grid-definite-row grid width=50% height=auto tall max-width-min-height: 40x60 child=0
grid-definite-row grid width=50% height=auto tall border-box-min-height: 100x60 child=0
grid-definite-row grid width=50% height=auto tall border-box-max-width: 40x310 child=0
-grid-definite-row grid width=50% height=100% empty min-height: 100x120 child=60
+grid-definite-row grid width=50% height=100% empty min-height: 120x120 child=60
grid-definite-row grid width=50% height=100% empty min-height-large: 150x150 child=75
grid-definite-row grid width=50% height=100% empty max-height: 100x30 child=15
grid-definite-row grid width=50% height=100% empty min-width: 150x120 child=60
grid-definite-row grid width=50% height=100% empty max-width: 40x120 child=60
grid-definite-row grid width=50% height=100% empty min-width-max-height: 150x30 child=15
grid-definite-row grid width=50% height=100% empty max-width-min-height: 40x120 child=60
-grid-definite-row grid width=50% height=100% empty border-box-min-height: 100x120 child=55
+grid-definite-row grid width=50% height=100% empty border-box-min-height: 120x120 child=55
grid-definite-row grid width=50% height=100% empty border-box-max-width: 40x120 child=55
-grid-definite-row grid width=50% height=100% tall min-height: 100x120 child=0
+grid-definite-row grid width=50% height=100% tall min-height: 120x120 child=0
grid-definite-row grid width=50% height=100% tall min-height-large: 150x150 child=0
grid-definite-row grid width=50% height=100% tall max-height: 100x30 child=0
grid-definite-row grid width=50% height=100% tall min-width: 150x120 child=0
grid-definite-row grid width=50% height=100% tall max-width: 40x120 child=0
grid-definite-row grid width=50% height=100% tall min-width-max-height: 150x30 child=0
grid-definite-row grid width=50% height=100% tall max-width-min-height: 40x120 child=0
-grid-definite-row grid width=50% height=100% tall border-box-min-height: 100x120 child=0
+grid-definite-row grid width=50% height=100% tall border-box-min-height: 120x120 child=0
grid-definite-row grid width=50% height=100% tall border-box-max-width: 40x120 child=0
grid-definite-row grid width=50% height=40px empty min-height: 100x60 child=30
grid-definite-row grid width=50% height=40px empty min-height-large: 150x150 child=75
diff --git a/Tests/LibWeb/Text/expected/css/aspect-ratio-percentage-height-matrix.txt b/Tests/LibWeb/Text/expected/css/aspect-ratio-percentage-height-matrix.txt
index e5864e2627f..62188a172ab 100644
--- a/Tests/LibWeb/Text/expected/css/aspect-ratio-percentage-height-matrix.txt
+++ b/Tests/LibWeb/Text/expected/css/aspect-ratio-percentage-height-matrix.txt
@@ -3022,22 +3022,22 @@ grid abspos width=50% height=auto tall none: 100x325 child=25
grid abspos width=50% height=auto tall max-height: 100x30 child=15
grid abspos width=50% height=auto tall min-height: 100x60 child=30
grid abspos width=50% height=auto tall padding: 100x330 child=20
-grid-definite-row block width=auto height=100% empty none: 0x120 child=60
-grid-definite-row block width=auto height=100% empty max-height: 0x30 child=15
-grid-definite-row block width=auto height=100% empty min-height: 120x120 child=60
-grid-definite-row block width=auto height=100% empty padding: 20x120 child=55
-grid-definite-row block width=auto height=100% tall none: 10x120 child=60
-grid-definite-row block width=auto height=100% tall max-height: 10x30 child=15
-grid-definite-row block width=auto height=100% tall min-height: 120x120 child=60
-grid-definite-row block width=auto height=100% tall padding: 20x120 child=55
-grid-definite-row block width=auto height=calc empty none: 0x70 child=35
-grid-definite-row block width=auto height=calc empty max-height: 0x30 child=15
-grid-definite-row block width=auto height=calc empty min-height: 120x70 child=35
-grid-definite-row block width=auto height=calc empty padding: 20x70 child=30
-grid-definite-row block width=auto height=calc tall none: 10x70 child=35
-grid-definite-row block width=auto height=calc tall max-height: 10x30 child=15
-grid-definite-row block width=auto height=calc tall min-height: 120x70 child=35
-grid-definite-row block width=auto height=calc tall padding: 20x70 child=30
+grid-definite-row block width=auto height=100% empty none: 240x120 child=60
+grid-definite-row block width=auto height=100% empty max-height: 60x30 child=15
+grid-definite-row block width=auto height=100% empty min-height: 240x120 child=60
+grid-definite-row block width=auto height=100% empty padding: 240x120 child=55
+grid-definite-row block width=auto height=100% tall none: 240x120 child=60
+grid-definite-row block width=auto height=100% tall max-height: 60x30 child=15
+grid-definite-row block width=auto height=100% tall min-height: 240x120 child=60
+grid-definite-row block width=auto height=100% tall padding: 240x120 child=55
+grid-definite-row block width=auto height=calc empty none: 140x70 child=35
+grid-definite-row block width=auto height=calc empty max-height: 60x30 child=15
+grid-definite-row block width=auto height=calc empty min-height: 140x70 child=35
+grid-definite-row block width=auto height=calc empty padding: 140x70 child=30
+grid-definite-row block width=auto height=calc tall none: 140x70 child=35
+grid-definite-row block width=auto height=calc tall max-height: 60x30 child=15
+grid-definite-row block width=auto height=calc tall min-height: 140x70 child=35
+grid-definite-row block width=auto height=calc tall padding: 140x70 child=30
grid-definite-row block width=auto height=auto empty none: 0x0 child=0
grid-definite-row block width=auto height=auto empty max-height: 0x0 child=0
grid-definite-row block width=auto height=auto empty min-height: 120x60 child=30
@@ -3070,14 +3070,14 @@ grid-definite-row block width=80px height=auto tall none: 80x320 child=20
grid-definite-row block width=80px height=auto tall max-height: 80x30 child=15
grid-definite-row block width=80px height=auto tall min-height: 80x60 child=30
grid-definite-row block width=80px height=auto tall padding: 80x325 child=15
-grid-definite-row block width=50% height=100% empty none: 100x120 child=60
+grid-definite-row block width=50% height=100% empty none: 120x120 child=60
grid-definite-row block width=50% height=100% empty max-height: 100x30 child=15
-grid-definite-row block width=50% height=100% empty min-height: 100x120 child=60
-grid-definite-row block width=50% height=100% empty padding: 100x120 child=55
-grid-definite-row block width=50% height=100% tall none: 100x120 child=60
+grid-definite-row block width=50% height=100% empty min-height: 120x120 child=60
+grid-definite-row block width=50% height=100% empty padding: 120x120 child=55
+grid-definite-row block width=50% height=100% tall none: 120x120 child=60
grid-definite-row block width=50% height=100% tall max-height: 100x30 child=15
-grid-definite-row block width=50% height=100% tall min-height: 100x120 child=60
-grid-definite-row block width=50% height=100% tall padding: 100x120 child=55
+grid-definite-row block width=50% height=100% tall min-height: 120x120 child=60
+grid-definite-row block width=50% height=100% tall padding: 120x120 child=55
grid-definite-row block width=50% height=calc empty none: 100x70 child=35
grid-definite-row block width=50% height=calc empty max-height: 100x30 child=15
grid-definite-row block width=50% height=calc empty min-height: 100x70 child=35
@@ -3094,22 +3094,22 @@ grid-definite-row block width=50% height=auto tall none: 100x325 child=25
grid-definite-row block width=50% height=auto tall max-height: 100x30 child=15
grid-definite-row block width=50% height=auto tall min-height: 100x60 child=30
grid-definite-row block width=50% height=auto tall padding: 100x330 child=20
-grid-definite-row flow-root width=auto height=100% empty none: 0x120 child=60
-grid-definite-row flow-root width=auto height=100% empty max-height: 0x30 child=15
-grid-definite-row flow-root width=auto height=100% empty min-height: 120x120 child=60
-grid-definite-row flow-root width=auto height=100% empty padding: 20x120 child=55
-grid-definite-row flow-root width=auto height=100% tall none: 10x120 child=60
-grid-definite-row flow-root width=auto height=100% tall max-height: 10x30 child=15
-grid-definite-row flow-root width=auto height=100% tall min-height: 120x120 child=60
-grid-definite-row flow-root width=auto height=100% tall padding: 20x120 child=55
-grid-definite-row flow-root width=auto height=calc empty none: 0x70 child=35
-grid-definite-row flow-root width=auto height=calc empty max-height: 0x30 child=15
-grid-definite-row flow-root width=auto height=calc empty min-height: 120x70 child=35
-grid-definite-row flow-root width=auto height=calc empty padding: 20x70 child=30
-grid-definite-row flow-root width=auto height=calc tall none: 10x70 child=35
-grid-definite-row flow-root width=auto height=calc tall max-height: 10x30 child=15
-grid-definite-row flow-root width=auto height=calc tall min-height: 120x70 child=35
-grid-definite-row flow-root width=auto height=calc tall padding: 20x70 child=30
+grid-definite-row flow-root width=auto height=100% empty none: 240x120 child=60
+grid-definite-row flow-root width=auto height=100% empty max-height: 60x30 child=15
+grid-definite-row flow-root width=auto height=100% empty min-height: 240x120 child=60
+grid-definite-row flow-root width=auto height=100% empty padding: 240x120 child=55
+grid-definite-row flow-root width=auto height=100% tall none: 240x120 child=60
+grid-definite-row flow-root width=auto height=100% tall max-height: 60x30 child=15
+grid-definite-row flow-root width=auto height=100% tall min-height: 240x120 child=60
+grid-definite-row flow-root width=auto height=100% tall padding: 240x120 child=55
+grid-definite-row flow-root width=auto height=calc empty none: 140x70 child=35
+grid-definite-row flow-root width=auto height=calc empty max-height: 60x30 child=15
+grid-definite-row flow-root width=auto height=calc empty min-height: 140x70 child=35
+grid-definite-row flow-root width=auto height=calc empty padding: 140x70 child=30
+grid-definite-row flow-root width=auto height=calc tall none: 140x70 child=35
+grid-definite-row flow-root width=auto height=calc tall max-height: 60x30 child=15
+grid-definite-row flow-root width=auto height=calc tall min-height: 140x70 child=35
+grid-definite-row flow-root width=auto height=calc tall padding: 140x70 child=30
grid-definite-row flow-root width=auto height=auto empty none: 0x0 child=0
grid-definite-row flow-root width=auto height=auto empty max-height: 0x0 child=0
grid-definite-row flow-root width=auto height=auto empty min-height: 120x60 child=30
@@ -3142,14 +3142,14 @@ grid-definite-row flow-root width=80px height=auto tall none: 80x320 child=20
grid-definite-row flow-root width=80px height=auto tall max-height: 80x30 child=15
grid-definite-row flow-root width=80px height=auto tall min-height: 80x60 child=30
grid-definite-row flow-root width=80px height=auto tall padding: 80x325 child=15
-grid-definite-row flow-root width=50% height=100% empty none: 100x120 child=60
+grid-definite-row flow-root width=50% height=100% empty none: 120x120 child=60
grid-definite-row flow-root width=50% height=100% empty max-height: 100x30 child=15
-grid-definite-row flow-root width=50% height=100% empty min-height: 100x120 child=60
-grid-definite-row flow-root width=50% height=100% empty padding: 100x120 child=55
-grid-definite-row flow-root width=50% height=100% tall none: 100x120 child=60
+grid-definite-row flow-root width=50% height=100% empty min-height: 120x120 child=60
+grid-definite-row flow-root width=50% height=100% empty padding: 120x120 child=55
+grid-definite-row flow-root width=50% height=100% tall none: 120x120 child=60
grid-definite-row flow-root width=50% height=100% tall max-height: 100x30 child=15
-grid-definite-row flow-root width=50% height=100% tall min-height: 100x120 child=60
-grid-definite-row flow-root width=50% height=100% tall padding: 100x120 child=55
+grid-definite-row flow-root width=50% height=100% tall min-height: 120x120 child=60
+grid-definite-row flow-root width=50% height=100% tall padding: 120x120 child=55
grid-definite-row flow-root width=50% height=calc empty none: 100x70 child=35
grid-definite-row flow-root width=50% height=calc empty max-height: 100x30 child=15
grid-definite-row flow-root width=50% height=calc empty min-height: 100x70 child=35
@@ -3166,22 +3166,22 @@ grid-definite-row flow-root width=50% height=auto tall none: 100x325 child=25
grid-definite-row flow-root width=50% height=auto tall max-height: 100x30 child=15
grid-definite-row flow-root width=50% height=auto tall min-height: 100x60 child=30
grid-definite-row flow-root width=50% height=auto tall padding: 100x330 child=20
-grid-definite-row inline-block width=auto height=100% empty none: 0x120 child=60
-grid-definite-row inline-block width=auto height=100% empty max-height: 0x30 child=15
-grid-definite-row inline-block width=auto height=100% empty min-height: 120x120 child=60
-grid-definite-row inline-block width=auto height=100% empty padding: 20x120 child=55
-grid-definite-row inline-block width=auto height=100% tall none: 10x120 child=60
-grid-definite-row inline-block width=auto height=100% tall max-height: 10x30 child=15
-grid-definite-row inline-block width=auto height=100% tall min-height: 120x120 child=60
-grid-definite-row inline-block width=auto height=100% tall padding: 20x120 child=55
-grid-definite-row inline-block width=auto height=calc empty none: 0x70 child=35
-grid-definite-row inline-block width=auto height=calc empty max-height: 0x30 child=15
-grid-definite-row inline-block width=auto height=calc empty min-height: 120x70 child=35
-grid-definite-row inline-block width=auto height=calc empty padding: 20x70 child=30
-grid-definite-row inline-block width=auto height=calc tall none: 10x70 child=35
-grid-definite-row inline-block width=auto height=calc tall max-height: 10x30 child=15
-grid-definite-row inline-block width=auto height=calc tall min-height: 120x70 child=35
-grid-definite-row inline-block width=auto height=calc tall padding: 20x70 child=30
+grid-definite-row inline-block width=auto height=100% empty none: 240x120 child=60
+grid-definite-row inline-block width=auto height=100% empty max-height: 60x30 child=15
+grid-definite-row inline-block width=auto height=100% empty min-height: 240x120 child=60
+grid-definite-row inline-block width=auto height=100% empty padding: 240x120 child=55
+grid-definite-row inline-block width=auto height=100% tall none: 240x120 child=60
+grid-definite-row inline-block width=auto height=100% tall max-height: 60x30 child=15
+grid-definite-row inline-block width=auto height=100% tall min-height: 240x120 child=60
+grid-definite-row inline-block width=auto height=100% tall padding: 240x120 child=55
+grid-definite-row inline-block width=auto height=calc empty none: 140x70 child=35
+grid-definite-row inline-block width=auto height=calc empty max-height: 60x30 child=15
+grid-definite-row inline-block width=auto height=calc empty min-height: 140x70 child=35
+grid-definite-row inline-block width=auto height=calc empty padding: 140x70 child=30
+grid-definite-row inline-block width=auto height=calc tall none: 140x70 child=35
+grid-definite-row inline-block width=auto height=calc tall max-height: 60x30 child=15
+grid-definite-row inline-block width=auto height=calc tall min-height: 140x70 child=35
+grid-definite-row inline-block width=auto height=calc tall padding: 140x70 child=30
grid-definite-row inline-block width=auto height=auto empty none: 0x0 child=0
grid-definite-row inline-block width=auto height=auto empty max-height: 0x0 child=0
grid-definite-row inline-block width=auto height=auto empty min-height: 120x60 child=30
@@ -3214,14 +3214,14 @@ grid-definite-row inline-block width=80px height=auto tall none: 80x320 child=20
grid-definite-row inline-block width=80px height=auto tall max-height: 80x30 child=15
grid-definite-row inline-block width=80px height=auto tall min-height: 80x60 child=30
grid-definite-row inline-block width=80px height=auto tall padding: 80x325 child=15
-grid-definite-row inline-block width=50% height=100% empty none: 100x120 child=60
+grid-definite-row inline-block width=50% height=100% empty none: 120x120 child=60
grid-definite-row inline-block width=50% height=100% empty max-height: 100x30 child=15
-grid-definite-row inline-block width=50% height=100% empty min-height: 100x120 child=60
-grid-definite-row inline-block width=50% height=100% empty padding: 100x120 child=55
-grid-definite-row inline-block width=50% height=100% tall none: 100x120 child=60
+grid-definite-row inline-block width=50% height=100% empty min-height: 120x120 child=60
+grid-definite-row inline-block width=50% height=100% empty padding: 120x120 child=55
+grid-definite-row inline-block width=50% height=100% tall none: 120x120 child=60
grid-definite-row inline-block width=50% height=100% tall max-height: 100x30 child=15
-grid-definite-row inline-block width=50% height=100% tall min-height: 100x120 child=60
-grid-definite-row inline-block width=50% height=100% tall padding: 100x120 child=55
+grid-definite-row inline-block width=50% height=100% tall min-height: 120x120 child=60
+grid-definite-row inline-block width=50% height=100% tall padding: 120x120 child=55
grid-definite-row inline-block width=50% height=calc empty none: 100x70 child=35
grid-definite-row inline-block width=50% height=calc empty max-height: 100x30 child=15
grid-definite-row inline-block width=50% height=calc empty min-height: 100x70 child=35
@@ -3238,22 +3238,22 @@ grid-definite-row inline-block width=50% height=auto tall none: 100x325 child=25
grid-definite-row inline-block width=50% height=auto tall max-height: 100x30 child=15
grid-definite-row inline-block width=50% height=auto tall min-height: 100x60 child=30
grid-definite-row inline-block width=50% height=auto tall padding: 100x330 child=20
-grid-definite-row float width=auto height=100% empty none: 0x120 child=60
-grid-definite-row float width=auto height=100% empty max-height: 0x30 child=15
-grid-definite-row float width=auto height=100% empty min-height: 120x120 child=60
-grid-definite-row float width=auto height=100% empty padding: 20x120 child=55
-grid-definite-row float width=auto height=100% tall none: 10x120 child=60
-grid-definite-row float width=auto height=100% tall max-height: 10x30 child=15
-grid-definite-row float width=auto height=100% tall min-height: 120x120 child=60
-grid-definite-row float width=auto height=100% tall padding: 20x120 child=55
-grid-definite-row float width=auto height=calc empty none: 0x70 child=35
-grid-definite-row float width=auto height=calc empty max-height: 0x30 child=15
-grid-definite-row float width=auto height=calc empty min-height: 120x70 child=35
-grid-definite-row float width=auto height=calc empty padding: 20x70 child=30
-grid-definite-row float width=auto height=calc tall none: 10x70 child=35
-grid-definite-row float width=auto height=calc tall max-height: 10x30 child=15
-grid-definite-row float width=auto height=calc tall min-height: 120x70 child=35
-grid-definite-row float width=auto height=calc tall padding: 20x70 child=30
+grid-definite-row float width=auto height=100% empty none: 240x120 child=60
+grid-definite-row float width=auto height=100% empty max-height: 60x30 child=15
+grid-definite-row float width=auto height=100% empty min-height: 240x120 child=60
+grid-definite-row float width=auto height=100% empty padding: 240x120 child=55
+grid-definite-row float width=auto height=100% tall none: 240x120 child=60
+grid-definite-row float width=auto height=100% tall max-height: 60x30 child=15
+grid-definite-row float width=auto height=100% tall min-height: 240x120 child=60
+grid-definite-row float width=auto height=100% tall padding: 240x120 child=55
+grid-definite-row float width=auto height=calc empty none: 140x70 child=35
+grid-definite-row float width=auto height=calc empty max-height: 60x30 child=15
+grid-definite-row float width=auto height=calc empty min-height: 140x70 child=35
+grid-definite-row float width=auto height=calc empty padding: 140x70 child=30
+grid-definite-row float width=auto height=calc tall none: 140x70 child=35
+grid-definite-row float width=auto height=calc tall max-height: 60x30 child=15
+grid-definite-row float width=auto height=calc tall min-height: 140x70 child=35
+grid-definite-row float width=auto height=calc tall padding: 140x70 child=30
grid-definite-row float width=auto height=auto empty none: 0x0 child=0
grid-definite-row float width=auto height=auto empty max-height: 0x0 child=0
grid-definite-row float width=auto height=auto empty min-height: 120x60 child=30
@@ -3286,14 +3286,14 @@ grid-definite-row float width=80px height=auto tall none: 80x320 child=20
grid-definite-row float width=80px height=auto tall max-height: 80x30 child=15
grid-definite-row float width=80px height=auto tall min-height: 80x60 child=30
grid-definite-row float width=80px height=auto tall padding: 80x325 child=15
-grid-definite-row float width=50% height=100% empty none: 100x120 child=60
+grid-definite-row float width=50% height=100% empty none: 120x120 child=60
grid-definite-row float width=50% height=100% empty max-height: 100x30 child=15
-grid-definite-row float width=50% height=100% empty min-height: 100x120 child=60
-grid-definite-row float width=50% height=100% empty padding: 100x120 child=55
-grid-definite-row float width=50% height=100% tall none: 100x120 child=60
+grid-definite-row float width=50% height=100% empty min-height: 120x120 child=60
+grid-definite-row float width=50% height=100% empty padding: 120x120 child=55
+grid-definite-row float width=50% height=100% tall none: 120x120 child=60
grid-definite-row float width=50% height=100% tall max-height: 100x30 child=15
-grid-definite-row float width=50% height=100% tall min-height: 100x120 child=60
-grid-definite-row float width=50% height=100% tall padding: 100x120 child=55
+grid-definite-row float width=50% height=100% tall min-height: 120x120 child=60
+grid-definite-row float width=50% height=100% tall padding: 120x120 child=55
grid-definite-row float width=50% height=calc empty none: 100x70 child=35
grid-definite-row float width=50% height=calc empty max-height: 100x30 child=15
grid-definite-row float width=50% height=calc empty min-height: 100x70 child=35
@@ -3310,22 +3310,22 @@ grid-definite-row float width=50% height=auto tall none: 100x325 child=25
grid-definite-row float width=50% height=auto tall max-height: 100x30 child=15
grid-definite-row float width=50% height=auto tall min-height: 100x60 child=30
grid-definite-row float width=50% height=auto tall padding: 100x330 child=20
-grid-definite-row flex width=auto height=100% empty none: 0x120 child=60
-grid-definite-row flex width=auto height=100% empty max-height: 0x30 child=15
-grid-definite-row flex width=auto height=100% empty min-height: 120x120 child=60
-grid-definite-row flex width=auto height=100% empty padding: 20x120 child=55
-grid-definite-row flex width=auto height=100% tall none: 10x120 child=60
-grid-definite-row flex width=auto height=100% tall max-height: 10x30 child=15
-grid-definite-row flex width=auto height=100% tall min-height: 120x120 child=60
-grid-definite-row flex width=auto height=100% tall padding: 20x120 child=55
-grid-definite-row flex width=auto height=calc empty none: 0x70 child=35
-grid-definite-row flex width=auto height=calc empty max-height: 0x30 child=15
-grid-definite-row flex width=auto height=calc empty min-height: 120x70 child=35
-grid-definite-row flex width=auto height=calc empty padding: 20x70 child=30
-grid-definite-row flex width=auto height=calc tall none: 10x70 child=35
-grid-definite-row flex width=auto height=calc tall max-height: 10x30 child=15
-grid-definite-row flex width=auto height=calc tall min-height: 120x70 child=35
-grid-definite-row flex width=auto height=calc tall padding: 20x70 child=30
+grid-definite-row flex width=auto height=100% empty none: 240x120 child=60
+grid-definite-row flex width=auto height=100% empty max-height: 60x30 child=15
+grid-definite-row flex width=auto height=100% empty min-height: 240x120 child=60
+grid-definite-row flex width=auto height=100% empty padding: 240x120 child=55
+grid-definite-row flex width=auto height=100% tall none: 240x120 child=60
+grid-definite-row flex width=auto height=100% tall max-height: 60x30 child=15
+grid-definite-row flex width=auto height=100% tall min-height: 240x120 child=60
+grid-definite-row flex width=auto height=100% tall padding: 240x120 child=55
+grid-definite-row flex width=auto height=calc empty none: 140x70 child=35
+grid-definite-row flex width=auto height=calc empty max-height: 60x30 child=15
+grid-definite-row flex width=auto height=calc empty min-height: 140x70 child=35
+grid-definite-row flex width=auto height=calc empty padding: 140x70 child=30
+grid-definite-row flex width=auto height=calc tall none: 140x70 child=35
+grid-definite-row flex width=auto height=calc tall max-height: 60x30 child=15
+grid-definite-row flex width=auto height=calc tall min-height: 140x70 child=35
+grid-definite-row flex width=auto height=calc tall padding: 140x70 child=30
grid-definite-row flex width=auto height=auto empty none: 0x0 child=0
grid-definite-row flex width=auto height=auto empty max-height: 0x0 child=0
grid-definite-row flex width=auto height=auto empty min-height: 120x60 child=30
@@ -3358,14 +3358,14 @@ grid-definite-row flex width=80px height=auto tall none: 80x300 child=20
grid-definite-row flex width=80px height=auto tall max-height: 80x30 child=15
grid-definite-row flex width=80px height=auto tall min-height: 80x60 child=30
grid-definite-row flex width=80px height=auto tall padding: 80x310 child=15
-grid-definite-row flex width=50% height=100% empty none: 100x120 child=60
+grid-definite-row flex width=50% height=100% empty none: 120x120 child=60
grid-definite-row flex width=50% height=100% empty max-height: 100x30 child=15
-grid-definite-row flex width=50% height=100% empty min-height: 100x120 child=60
-grid-definite-row flex width=50% height=100% empty padding: 100x120 child=55
-grid-definite-row flex width=50% height=100% tall none: 100x120 child=60
+grid-definite-row flex width=50% height=100% empty min-height: 120x120 child=60
+grid-definite-row flex width=50% height=100% empty padding: 120x120 child=55
+grid-definite-row flex width=50% height=100% tall none: 120x120 child=60
grid-definite-row flex width=50% height=100% tall max-height: 100x30 child=15
-grid-definite-row flex width=50% height=100% tall min-height: 100x120 child=60
-grid-definite-row flex width=50% height=100% tall padding: 100x120 child=55
+grid-definite-row flex width=50% height=100% tall min-height: 120x120 child=60
+grid-definite-row flex width=50% height=100% tall padding: 120x120 child=55
grid-definite-row flex width=50% height=calc empty none: 100x70 child=35
grid-definite-row flex width=50% height=calc empty max-height: 100x30 child=15
grid-definite-row flex width=50% height=calc empty min-height: 100x70 child=35
@@ -3382,22 +3382,22 @@ grid-definite-row flex width=50% height=auto tall none: 100x300 child=25
grid-definite-row flex width=50% height=auto tall max-height: 100x30 child=15
grid-definite-row flex width=50% height=auto tall min-height: 100x60 child=30
grid-definite-row flex width=50% height=auto tall padding: 100x310 child=20
-grid-definite-row grid width=auto height=100% empty none: 0x120 child=60
-grid-definite-row grid width=auto height=100% empty max-height: 0x30 child=15
-grid-definite-row grid width=auto height=100% empty min-height: 120x120 child=60
-grid-definite-row grid width=auto height=100% empty padding: 20x120 child=55
-grid-definite-row grid width=auto height=100% tall none: 10x120 child=0
-grid-definite-row grid width=auto height=100% tall max-height: 10x30 child=0
-grid-definite-row grid width=auto height=100% tall min-height: 120x120 child=0
-grid-definite-row grid width=auto height=100% tall padding: 20x120 child=0
-grid-definite-row grid width=auto height=calc empty none: 0x70 child=35
-grid-definite-row grid width=auto height=calc empty max-height: 0x30 child=15
-grid-definite-row grid width=auto height=calc empty min-height: 120x70 child=35
-grid-definite-row grid width=auto height=calc empty padding: 20x70 child=30
-grid-definite-row grid width=auto height=calc tall none: 10x70 child=0
-grid-definite-row grid width=auto height=calc tall max-height: 10x30 child=0
-grid-definite-row grid width=auto height=calc tall min-height: 120x70 child=0
-grid-definite-row grid width=auto height=calc tall padding: 20x70 child=0
+grid-definite-row grid width=auto height=100% empty none: 240x120 child=60
+grid-definite-row grid width=auto height=100% empty max-height: 60x30 child=15
+grid-definite-row grid width=auto height=100% empty min-height: 240x120 child=60
+grid-definite-row grid width=auto height=100% empty padding: 240x120 child=55
+grid-definite-row grid width=auto height=100% tall none: 240x120 child=0
+grid-definite-row grid width=auto height=100% tall max-height: 60x30 child=0
+grid-definite-row grid width=auto height=100% tall min-height: 240x120 child=0
+grid-definite-row grid width=auto height=100% tall padding: 240x120 child=0
+grid-definite-row grid width=auto height=calc empty none: 140x70 child=35
+grid-definite-row grid width=auto height=calc empty max-height: 60x30 child=15
+grid-definite-row grid width=auto height=calc empty min-height: 140x70 child=35
+grid-definite-row grid width=auto height=calc empty padding: 140x70 child=30
+grid-definite-row grid width=auto height=calc tall none: 140x70 child=0
+grid-definite-row grid width=auto height=calc tall max-height: 60x30 child=0
+grid-definite-row grid width=auto height=calc tall min-height: 140x70 child=0
+grid-definite-row grid width=auto height=calc tall padding: 140x70 child=0
grid-definite-row grid width=auto height=auto empty none: 0x0 child=0
grid-definite-row grid width=auto height=auto empty max-height: 0x0 child=0
grid-definite-row grid width=auto height=auto empty min-height: 120x60 child=30
@@ -3430,14 +3430,14 @@ grid-definite-row grid width=80px height=auto tall none: 80x300 child=0
grid-definite-row grid width=80px height=auto tall max-height: 80x30 child=0
grid-definite-row grid width=80px height=auto tall min-height: 80x60 child=0
grid-definite-row grid width=80px height=auto tall padding: 80x310 child=0
-grid-definite-row grid width=50% height=100% empty none: 100x120 child=60
+grid-definite-row grid width=50% height=100% empty none: 120x120 child=60
grid-definite-row grid width=50% height=100% empty max-height: 100x30 child=15
-grid-definite-row grid width=50% height=100% empty min-height: 100x120 child=60
-grid-definite-row grid width=50% height=100% empty padding: 100x120 child=55
-grid-definite-row grid width=50% height=100% tall none: 100x120 child=0
+grid-definite-row grid width=50% height=100% empty min-height: 120x120 child=60
+grid-definite-row grid width=50% height=100% empty padding: 120x120 child=55
+grid-definite-row grid width=50% height=100% tall none: 120x120 child=0
grid-definite-row grid width=50% height=100% tall max-height: 100x30 child=0
-grid-definite-row grid width=50% height=100% tall min-height: 100x120 child=0
-grid-definite-row grid width=50% height=100% tall padding: 100x120 child=0
+grid-definite-row grid width=50% height=100% tall min-height: 120x120 child=0
+grid-definite-row grid width=50% height=100% tall padding: 120x120 child=0
grid-definite-row grid width=50% height=calc empty none: 100x70 child=35
grid-definite-row grid width=50% height=calc empty max-height: 100x30 child=15
grid-definite-row grid width=50% height=calc empty min-height: 100x70 child=35
diff --git a/Tests/LibWeb/Text/expected/css/grid-aspect-ratio-percentage-height-in-fixed-rows-with-gap.txt b/Tests/LibWeb/Text/expected/css/grid-aspect-ratio-percentage-height-in-fixed-rows-with-gap.txt
new file mode 100644
index 00000000000..022598fd04e
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/css/grid-aspect-ratio-percentage-height-in-fixed-rows-with-gap.txt
@@ -0,0 +1 @@
+spanning: 220x220
diff --git a/Tests/LibWeb/Text/input/css/grid-aspect-ratio-percentage-height-in-fixed-rows-with-gap.html b/Tests/LibWeb/Text/input/css/grid-aspect-ratio-percentage-height-in-fixed-rows-with-gap.html
new file mode 100644
index 00000000000..2d1a619e909
--- /dev/null
+++ b/Tests/LibWeb/Text/input/css/grid-aspect-ratio-percentage-height-in-fixed-rows-with-gap.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<div style="display: grid; grid-template-rows: 100px 100px; row-gap: 20px; width: 400px; justify-items: start">
+ <div id="spanning" style="grid-row: 1 / 3; aspect-ratio: 1 / 1; height: 100%"></div>
+</div>
+<script src="../include.js"></script>
+<script>
+ test(() => {
+ const rect = document.getElementById("spanning").getBoundingClientRect();
+ println(`spanning: ${rect.width}x${rect.height}`);
+ });
+</script>