Skip to content

Truly independent web browser

LibWeb: Measure row subgrid content widths against their parent grid

Andreas Kling5e3bb8fc65e3
diff --git a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
index 15f344b0010..d9be757df3e 100644
--- a/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/formatting_context.rs
@@ -3433,6 +3433,16 @@ pub(crate) trait ChildRunShapes {
inline_size: CssPixels,
constraints: ContainingBlockConstraints,
) -> Option<ChildRunShape>;
+
+ /// The content inline sizes of `node` as this container measures them, where they depend on the container and so
+ /// can't be measured with `node` on its own.
+ fn child_content_inline_sizes(
+ &self,
+ _node: Node,
+ _constraints: ContainingBlockConstraints,
+ ) -> Option<sizing_context::ContentSizes> {
+ None
+ }
}
pub(crate) fn item_is_block_container_whose_committing_run_can_adopt_its_measurement(
diff --git a/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs
index c6769ccd7de..50206164d92 100644
--- a/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/grid_formatting_context.rs
@@ -1170,6 +1170,21 @@ pub(crate) struct GridFormattingContext<'pass> {
item_runs_offered_to_row_measurements: Option<RowMeasurementsAhead>,
next_item_lookup_start: Cell<usize>,
items_to_fork: OnceCell<Vec<usize>>,
+ /// The content inline sizes of the row-only subgrids among the items, measured with this grid as their parent
+ /// grid. They are kept across the runs of this grid, keyed by what they depend on from it.
+ row_only_subgrid_content_inline_sizes:
+ std::cell::RefCell<Vec<(RowOnlySubgridContentInlineSizesKey, sizing_context::ContentSizes)>>,
+}
+
+/// What the content inline sizes of a row-only subgrid depend on, beyond its own content: the percentage bases it's
+/// measured with, where it's placed in its parent grid, and the parent grid's lines, which place its items.
+#[derive(Clone, PartialEq)]
+struct RowOnlySubgridContentInlineSizesKey {
+ subgrid: Node,
+ constraints: ContainingBlockConstraints,
+ placement: GridItemPlacement,
+ column_lines: Vec<Vec<LineName>>,
+ row_lines: Vec<Vec<LineName>>,
}
impl formatting_context::ChildRunShapes for GridFormattingContext<'_> {
@@ -1193,6 +1208,18 @@ impl formatting_context::ChildRunShapes for GridFormattingContext<'_> {
}
Some(self.item_run_shape(item)).filter(|shape| shape.lays_out_at(inline_size, constraints))
}
+
+ fn child_content_inline_sizes(
+ &self,
+ node: Node,
+ constraints: ContainingBlockConstraints,
+ ) -> Option<sizing_context::ContentSizes> {
+ let item = self.items[self.index_of_item(node)?];
+ if !self.grid_item_is_subgridded(item, Axis::Row) || self.grid_item_is_subgridded(item, Axis::Column) {
+ return None;
+ }
+ Some(self.row_only_subgrid_content_inline_sizes(item, constraints))
+ }
}
#[derive(Clone, Copy)]
@@ -1207,7 +1234,7 @@ enum RowMeasurementsAhead {
ItemBlockSizesOnly,
}
-#[derive(Clone, Copy)]
+#[derive(Clone, Copy, PartialEq)]
struct GridItemPlacement {
row: i32,
row_span: usize,
@@ -1394,6 +1421,7 @@ impl<'pass> GridFormattingContext<'pass> {
item_runs_offered_to_row_measurements: None,
next_item_lookup_start: Cell::new(0),
items_to_fork: OnceCell::new(),
+ row_only_subgrid_content_inline_sizes: std::cell::RefCell::new(Vec::new()),
collected_items: Vec::new(),
table_inline_layout_of_item: Cell::new(None),
in_flow_items_margin_box_block_extent: None,
@@ -3550,6 +3578,57 @@ impl<'pass> GridFormattingContext<'pass> {
})
}
+ /// The min-content and max-content inline sizes of an item that's a subgrid in the row axis only. Its columns are
+ /// its own, but where its items go depends on the rows it inherits from this grid: an item may be placed by a line
+ /// name that only this grid declares. So it's measured with this grid as its parent grid, rather than as a grid
+ /// on its own, where such an item would be placed on an implicit line instead.
+ ///
+ /// https://drafts.csswg.org/css-grid-2/#subgrid-line-name-inheritance
+ /// Since subgrids can be placed before their contents are placed, the subgridded lines automatically receive the
+ /// explicit line names specified on the corresponding lines of the parent grid.
+ fn row_only_subgrid_content_inline_sizes(
+ &self,
+ subgrid: GridItem,
+ constraints: ContainingBlockConstraints,
+ ) -> sizing_context::ContentSizes {
+ let key = RowOnlySubgridContentInlineSizesKey {
+ subgrid: subgrid.box_,
+ constraints,
+ placement: subgrid.placement(),
+ column_lines: self.column_lines.clone(),
+ row_lines: self.row_lines.clone(),
+ };
+ if let Some((_, sizes)) = self
+ .row_only_subgrid_content_inline_sizes
+ .borrow()
+ .iter()
+ .find(|(measured_key, _)| *measured_key == key)
+ {
+ return *sizes;
+ }
+ let content_inline_size_under = |inline_size| {
+ self.measure_subgrid(subgrid, |context, _| {
+ let input = LayoutInput::new(
+ AvailableSpace {
+ inline_size,
+ block_size: AvailableSize::Indefinite,
+ },
+ constraints,
+ ParticipationInParentFormattingContext::Root,
+ );
+ clamp_to_max_dimension_value(context.content_inline_size(input, None))
+ })
+ };
+ let sizes = sizing_context::ContentSizes {
+ min: content_inline_size_under(AvailableSize::MinContent),
+ max: content_inline_size_under(AvailableSize::MaxContent),
+ };
+ self.row_only_subgrid_content_inline_sizes
+ .borrow_mut()
+ .push((key, sizes));
+ sizes
+ }
+
/// The content block size of an item that's a subgrid in the column axis only. Its rows are its own,
/// so it contributes to this grid's rows as an ordinary item — but the block size of its content depends
/// on the columns it inherits from this grid, so it's measured with this grid as its parent grid.
diff --git a/Libraries/LibWeb/Rust/src/layout/sizing_context.rs b/Libraries/LibWeb/Rust/src/layout/sizing_context.rs
index 20e4416f4fc..c370378da46 100644
--- a/Libraries/LibWeb/Rust/src/layout/sizing_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/sizing_context.rs
@@ -3328,6 +3328,21 @@ impl<'pass, 'container> SizingContext<'pass, 'container> {
if let Some(answer) = self.content_inline_size_ignoring_content(node) {
return ContentInlineSizeAnswers::of_both(answer);
}
+ // NB: Sizes that depend on the container are not cached on the node, which may be measured on its own too.
+ // They are measured in a run of their own, so their dependencies are assumed as for a skipped child.
+ if block_size.is_none()
+ && let Some(child_run_shapes) = self.child_run_shapes
+ && let Some(sizes) = child_run_shapes.child_content_inline_sizes(node, constraints)
+ {
+ return ContentInlineSizeAnswers::from_measurement(IntrinsicInlineSizeMeasurement {
+ min_content_inline_size: sizes.min,
+ max_content_inline_size: sizes.max,
+ first_line_max_content: FirstLineMaxContent::without_floats(sizes.max),
+ depends_on_percentage_block_size: self.skipped_child_depends_on_percentage_block_size(node),
+ depends_on_percentage_inline_basis: self.measurement_root_observes_percentage_inline_basis(node),
+ depends_on_block_size: self.intrinsic_inline_size_may_depend_on_block_size(node),
+ });
+ }
let key = self.intrinsic_size_cache_key(block_size, constraints);
if let Some(cached) = self.intrinsic_inline_measurement_cache_get(node, key) {
self.pass.layout_trace().intrinsic_size_hit(node, kind);
diff --git a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-nested-subgrid-uses-grandparent-line-names.txt b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-nested-subgrid-uses-grandparent-line-names.txt
index e2c76aba44d..4b656bce851 100644
--- a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-nested-subgrid-uses-grandparent-line-names.txt
+++ b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-nested-subgrid-uses-grandparent-line-names.txt
@@ -1,35 +1,35 @@
-Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline overflow: [0,0 938.25x600]
+Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 80 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 80 0+0+0] children: not-inline
Box <div> at [0,0] flex-container(row) [0+0+0 800 0+0+0] [0+0+0 80 0+0+0] [FFC] children: not-inline
Box <div.outer> at [95,0] flex-item [0+0+0 610 0+0+0] [0+0+0 80 0+0+0] [GFC] children: not-inline
Box <div.tile> at [95,0] [0+0+0 300 0+0+0] [0+0+0 80 0+0+0] [GFC] children: not-inline
- BlockContainer <div.image> at [95,0] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: not-inline
- Box <div.group> at [95,20] [0+0+0 508.875 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
- BlockContainer <div.first> at [95,20] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.image> at [95,0] [0+0+0 300 0+0+0] [0+0+0 20 0+0+0] [BFC] children: not-inline
+ Box <div.group> at [95,20] [0+0+0 300 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [95,20] [0+0+0 300 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [95,20 213.9375x20] baseline: 16
"AAAAAAAAAAAA"
TextNode <#text> (not painted)
- BlockContainer <div.second> at [95,40] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.second> at [95,40] [0+0+0 300 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [95,40 140.25x20] baseline: 16
"BBBBBBBBBBBB"
TextNode <#text> (not painted)
- BlockContainer <div.third> at [95,60] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.third> at [95,60] [0+0+0 300 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [95,60 154.6875x20] baseline: 16
"CCCCCCCCCCCC"
TextNode <#text> (not painted)
Box <div.tile> at [405,0] [0+0+0 300 0+0+0] [0+0+0 80 0+0+0] [GFC] children: not-inline
- BlockContainer <div.image> at [405,0] [0+0+0 533.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: not-inline
- Box <div.group> at [405,20] [0+0+0 533.25 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
- BlockContainer <div.first> at [405,20] [0+0+0 533.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.image> at [405,0] [0+0+0 300 0+0+0] [0+0+0 20 0+0+0] [BFC] children: not-inline
+ Box <div.group> at [405,20] [0+0+0 300 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [405,20] [0+0+0 300 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [405,20 167.0625x20] baseline: 16
"DDDDDDDDDDDD"
TextNode <#text> (not painted)
- BlockContainer <div.second> at [405,40] [0+0+0 533.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.second> at [405,40] [0+0+0 300 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [405,40 177.9375x20] baseline: 16
"EEEEEEEEEEEE"
TextNode <#text> (not painted)
- BlockContainer <div.third> at [405,60] [0+0+0 533.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.third> at [405,60] [0+0+0 300 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [405,60 188.25x20] baseline: 16
"FFFFFFFFFFFF"
TextNode <#text> (not painted)
diff --git a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-own-subgrid-line-names.txt b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-own-subgrid-line-names.txt
index 8f496d544e7..bcdf395fc82 100644
--- a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-own-subgrid-line-names.txt
+++ b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-own-subgrid-line-names.txt
@@ -1,17 +1,17 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 60 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 60 0+0+0] children: not-inline
- Box <div.parent> at [0,0] [0+0+0 508.875 0+0+291.125] [0+0+0 60 0+0+0] [GFC] children: not-inline
- Box <div.subgrid> at [0,0] [0+0+0 508.875 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
- BlockContainer <div.a> at [0,0] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ Box <div.parent> at [0,0] [0+0+0 213.9375 0+0+586.0625] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ Box <div.subgrid> at [0,0] [0+0+0 213.9375 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.a> at [0,0] [0+0+0 213.9375 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [0,0 213.9375x20] baseline: 16
"AAAAAAAAAAAA"
TextNode <#text> (not painted)
- BlockContainer <div.b> at [0,20] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.b> at [0,20] [0+0+0 213.9375 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [0,20 140.25x20] baseline: 16
"BBBBBBBBBBBB"
TextNode <#text> (not painted)
- BlockContainer <div.c> at [0,40] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.c> at [0,40] [0+0+0 213.9375 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [0,40 154.6875x20] baseline: 16
"CCCCCCCCCCCC"
TextNode <#text> (not painted)
diff --git a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-parent-grid-area-names.txt b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-parent-grid-area-names.txt
index 7b450aafecb..6569e545cdb 100644
--- a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-parent-grid-area-names.txt
+++ b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-parent-grid-area-names.txt
@@ -1,17 +1,17 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 60 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 60 0+0+0] children: not-inline
- Box <div.parent> at [0,0] [0+0+0 508.875 0+0+291.125] [0+0+0 60 0+0+0] [GFC] children: not-inline
- Box <div.subgrid> at [0,0] [0+0+0 508.875 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
- BlockContainer <div.top> at [0,0] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ Box <div.parent> at [0,0] [0+0+0 213.9375 0+0+586.0625] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ Box <div.subgrid> at [0,0] [0+0+0 213.9375 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.top> at [0,0] [0+0+0 213.9375 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [0,0 213.9375x20] baseline: 16
"AAAAAAAAAAAA"
TextNode <#text> (not painted)
- BlockContainer <div.middle> at [0,20] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.middle> at [0,20] [0+0+0 213.9375 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [0,20 140.25x20] baseline: 16
"BBBBBBBBBBBB"
TextNode <#text> (not painted)
- BlockContainer <div.bottom> at [0,40] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.bottom> at [0,40] [0+0+0 213.9375 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [0,40 154.6875x20] baseline: 16
"CCCCCCCCCCCC"
TextNode <#text> (not painted)
diff --git a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-parent-line-names.txt b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-parent-line-names.txt
index 206f2c24894..000b719f63b 100644
--- a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-parent-line-names.txt
+++ b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-uses-parent-line-names.txt
@@ -2,31 +2,31 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 120 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 120 0+0+0] children: not-inline
Box <div.parent> at [0,0] [0+0+0 300 0+0+500] [0+0+0 60 0+0+0] [GFC] children: not-inline
- Box <div.subgrid> at [0,0] [0+0+0 508.875 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
- BlockContainer <div.first> at [0,0] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ Box <div.subgrid> at [0,0] [0+0+0 300 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [0,0] [0+0+0 300 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [0,0 213.9375x20] baseline: 16
"AAAAAAAAAAAA"
TextNode <#text> (not painted)
- BlockContainer <div.second> at [0,20] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.second> at [0,20] [0+0+0 300 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [0,20 140.25x20] baseline: 16
"BBBBBBBBBBBB"
TextNode <#text> (not painted)
- BlockContainer <div.third> at [0,40] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.third> at [0,40] [0+0+0 300 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [0,40 154.6875x20] baseline: 16
"CCCCCCCCCCCC"
TextNode <#text> (not painted)
Box <div> at [0,60] flex-container(row) [0+0+0 800 0+0+0] [0+0+0 60 0+0+0] [FFC] children: not-inline
- Box <div.parent> at [0,60] flex-item [0+0+0 508.875 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
- Box <div.subgrid> at [0,60] [0+0+0 508.875 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
- BlockContainer <div.first> at [0,60] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ Box <div.parent> at [0,60] flex-item [0+0+0 213.9375 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ Box <div.subgrid> at [0,60] [0+0+0 213.9375 0+0+0] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [0,60] [0+0+0 213.9375 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [0,60 213.9375x20] baseline: 16
"AAAAAAAAAAAA"
TextNode <#text> (not painted)
- BlockContainer <div.second> at [0,80] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.second> at [0,80] [0+0+0 213.9375 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [0,80 140.25x20] baseline: 16
"BBBBBBBBBBBB"
TextNode <#text> (not painted)
- BlockContainer <div.third> at [0,100] [0+0+0 508.875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.third> at [0,100] [0+0+0 213.9375 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [0,100 154.6875x20] baseline: 16
"CCCCCCCCCCCC"
TextNode <#text> (not painted)
diff --git a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-with-content-sized-subgrid.txt b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-with-content-sized-subgrid.txt
index ff2d22fab75..6090a0a7d78 100644
--- a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-with-content-sized-subgrid.txt
+++ b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-with-content-sized-subgrid.txt
@@ -1,62 +1,68 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 240 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 240 0+0+0] children: not-inline
- Box <div.parent> at [0,0] [0+0+0 600 0+0+200] [0+0+0 60 0+0+0] [GFC] children: not-inline
- Box <div.subgrid> at [0,0] [0+0+0 169.625 0+0+430.375] [0+0+0 60 0+0+0] [GFC] children: not-inline
- BlockContainer <div.first> at [0,0] [0+0+0 169.625 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 9, rect: [0,0 152.625x20] baseline: 16
- "AAAA AAAA"
- TextNode <#text> (not painted)
- BlockContainer <div.second> at [0,20] [0+0+0 169.625 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 9, rect: [0,20 103.5x20] baseline: 16
- "BBBB BBBB"
- TextNode <#text> (not painted)
- BlockContainer <div.third> at [0,40] [0+0+0 169.625 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 9, rect: [0,40 113.125x20] baseline: 16
- "CCCC CCCC"
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 300 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 300 0+0+0] children: not-inline
+ Box <div.parent> at [0,0] [0+0+0 600 0+0+200] [0+0+0 120 0+0+0] [GFC] children: not-inline
+ Box <div.subgrid> at [0,0] [0+0+0 71.3125 0+0+528.6875] [0+0+0 120 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [0,0] [0+0+0 71.3125 0+0+0] [0+0+0 40 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 4, rect: [0,0 71.3125x20] baseline: 16
+ "AAAA"
+ frag 1 from TextNode start: 5, length: 4, rect: [0,20 71.3125x20] baseline: 16
+ "AAAA"
TextNode <#text> (not painted)
- Box <div.parent> at [0,60] [0+0+0 600 0+0+200] [0+0+0 60 0+0+0] [GFC] children: not-inline
- Box <div.subgrid> at [0,60] [0+0+0 369.25 0+0+230.75] [0+0+0 60 0+0+0] [GFC] children: not-inline
- BlockContainer <div.first> at [0,60] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 9, rect: [0,60 152.625x20] baseline: 16
- "AAAA AAAA"
+ BlockContainer <div.second> at [0,40] [0+0+0 71.3125 0+0+0] [0+0+0 40 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 4, rect: [0,40 46.75x20] baseline: 16
+ "BBBB"
+ frag 1 from TextNode start: 5, length: 4, rect: [0,60 46.75x20] baseline: 16
+ "BBBB"
TextNode <#text> (not painted)
- BlockContainer <div.second> at [0,80] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 9, rect: [0,80 103.5x20] baseline: 16
- "BBBB BBBB"
- TextNode <#text> (not painted)
- BlockContainer <div.third> at [0,100] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
- frag 0 from TextNode start: 0, length: 9, rect: [0,100 113.125x20] baseline: 16
- "CCCC CCCC"
+ BlockContainer <div.third> at [0,80] [0+0+0 71.3125 0+0+0] [0+0+0 40 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 4, rect: [0,80 51.5625x20] baseline: 16
+ "CCCC"
+ frag 1 from TextNode start: 5, length: 4, rect: [0,100 51.5625x20] baseline: 16
+ "CCCC"
TextNode <#text> (not painted)
Box <div.parent> at [0,120] [0+0+0 600 0+0+200] [0+0+0 60 0+0+0] [GFC] children: not-inline
- Box <div.subgrid> at [0,120] [0+0+0 369.25 0+0+230.75] [0+0+0 60 0+0+0] [GFC] children: not-inline
- BlockContainer <div.first> at [0,120] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ Box <div.subgrid> at [0,120] [0+0+0 152.625 0+0+447.375] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [0,120] [0+0+0 152.625 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 9, rect: [0,120 152.625x20] baseline: 16
"AAAA AAAA"
TextNode <#text> (not painted)
- BlockContainer <div.second> at [0,140] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.second> at [0,140] [0+0+0 152.625 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 9, rect: [0,140 103.5x20] baseline: 16
"BBBB BBBB"
TextNode <#text> (not painted)
- BlockContainer <div.third> at [0,160] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.third> at [0,160] [0+0+0 152.625 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 9, rect: [0,160 113.125x20] baseline: 16
"CCCC CCCC"
TextNode <#text> (not painted)
Box <div.parent> at [0,180] [0+0+0 600 0+0+200] [0+0+0 60 0+0+0] [GFC] children: not-inline
- Box <div.subgrid> at [0,180] [0+0+0 369.25 0+0+230.75] [0+0+0 60 0+0+0] [GFC] children: not-inline
- BlockContainer <div.first> at [0,180] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ Box <div.subgrid> at [0,180] [0+0+0 152.625 0+0+447.375] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [0,180] [0+0+0 152.625 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 9, rect: [0,180 152.625x20] baseline: 16
"AAAA AAAA"
TextNode <#text> (not painted)
- BlockContainer <div.second> at [0,200] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.second> at [0,200] [0+0+0 152.625 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 9, rect: [0,200 103.5x20] baseline: 16
"BBBB BBBB"
TextNode <#text> (not painted)
- BlockContainer <div.third> at [0,220] [0+0+0 369.25 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.third> at [0,220] [0+0+0 152.625 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 9, rect: [0,220 113.125x20] baseline: 16
"CCCC CCCC"
TextNode <#text> (not painted)
+ Box <div.parent> at [0,240] [0+0+0 600 0+0+200] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ Box <div.subgrid> at [0,240] [0+0+0 152.625 0+0+447.375] [0+0+0 60 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.first> at [0,240] [0+0+0 152.625 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 9, rect: [0,240 152.625x20] baseline: 16
+ "AAAA AAAA"
+ TextNode <#text> (not painted)
+ BlockContainer <div.second> at [0,260] [0+0+0 152.625 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 9, rect: [0,260 103.5x20] baseline: 16
+ "BBBB BBBB"
+ TextNode <#text> (not painted)
+ BlockContainer <div.third> at [0,280] [0+0+0 152.625 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ frag 0 from TextNode start: 0, length: 9, rect: [0,280 113.125x20] baseline: 16
+ "CCCC CCCC"
+ TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x240] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x300] (z-index: auto)
diff --git a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-with-named-spans.txt b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-with-named-spans.txt
index 23bedc0c8f7..f17827ebb7a 100644
--- a/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-with-named-spans.txt
+++ b/Tests/LibWeb/Layout/expected/grid/subgrid-rows-intrinsic-width-with-named-spans.txt
@@ -1,13 +1,13 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 40 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [0,0] [0+0+0 800 0+0+0] [0+0+0 40 0+0+0] children: not-inline
- Box <div.parent> at [0,0] [0+0+0 354.1875 0+0+445.8125] [0+0+0 40 0+0+0] [GFC] children: not-inline
- Box <div.subgrid> at [0,0] [0+0+0 354.1875 0+0+0] [0+0+0 40 0+0+0] [GFC] children: not-inline
- BlockContainer <div.top> at [0,0] [0+0+0 354.1875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ Box <div.parent> at [0,0] [0+0+0 213.9375 0+0+586.0625] [0+0+0 40 0+0+0] [GFC] children: not-inline
+ Box <div.subgrid> at [0,0] [0+0+0 213.9375 0+0+0] [0+0+0 40 0+0+0] [GFC] children: not-inline
+ BlockContainer <div.top> at [0,0] [0+0+0 213.9375 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [0,0 213.9375x20] baseline: 16
"AAAAAAAAAAAA"
TextNode <#text> (not painted)
- BlockContainer <div.bottom> at [0,20] [0+0+0 354.1875 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
+ BlockContainer <div.bottom> at [0,20] [0+0+0 213.9375 0+0+0] [0+0+0 20 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 12, rect: [0,20 140.25x20] baseline: 16
"BBBBBBBBBBBB"
TextNode <#text> (not painted)