at (8,8) content-size 123.171875x118.40625 table-row-group children: not-inline
+ Box at (8,8) content-size 123.171875x39.46875 table-row children: not-inline
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
+ BlockContainer at (19,19) content-size 8.453125x17.46875 table-cell [BFC] children: inline
+ line 0 width: 6.34375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 0, length: 1, rect: [19,19 6.34375x17.46875]
+ "1"
+ TextNode <#text>
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
+ BlockContainer | at (49.453125,19) content-size 8.8125x17.46875 table-cell [BFC] children: inline
+ line 0 width: 8.8125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 0, length: 1, rect: [49.453125,19 8.8125x17.46875]
+ "2"
+ TextNode <#text>
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
+ BlockContainer | at (80.265625,19) content-size 9.09375x17.46875 table-cell [BFC] children: inline
+ line 0 width: 9.09375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 0, length: 1, rect: [80.265625,19 9.09375x17.46875]
+ "3"
+ TextNode <#text>
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
+ Box |
at (8,47.46875) content-size 123.171875x39.46875 table-row children: not-inline
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
+ BlockContainer at (19,58.46875) content-size 8.453125x17.46875 table-cell [BFC] children: inline
+ line 0 width: 7.75, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 0, length: 1, rect: [19,58.46875 7.75x17.46875]
+ "4"
+ TextNode <#text>
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
+ BlockContainer | at (49.453125,78.203125) content-size 70.71875x17.46875 table-cell [BFC] children: inline
+ line 0 width: 24.046875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 0, length: 3, rect: [49.453125,78.203125 24.046875x17.46875]
+ "6-9"
+ TextNode <#text>
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
+ Box |
at (8,86.9375) content-size 123.171875x39.46875 table-row children: not-inline
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
+ BlockContainer at (19,97.9375) content-size 8.453125x17.46875 table-cell [BFC] children: inline
+ line 0 width: 8.453125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
+ frag 0 from TextNode start: 0, length: 1, rect: [19,97.9375 8.453125x17.46875]
+ "5"
+ TextNode <#text>
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
+ BlockContainer <(anonymous)> (not painted) children: inline
+ TextNode <#text>
diff --git a/Tests/LibWeb/Layout/input/table/clip-spans-to-table-end.html b/Tests/LibWeb/Layout/input/table/clip-spans-to-table-end.html
new file mode 100644
index 0000000000..f1aaa9711c
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/table/clip-spans-to-table-end.html
@@ -0,0 +1,25 @@
+
+
+
+
+ 1 |
+ 2 |
+ 3 |
+
+
+ 4 |
+ 6-9 |
+
+
+ 5 |
+
+
\ No newline at end of file
diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
index 7bc0887a7d..c1d20cfede 100644
--- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp
@@ -153,6 +153,12 @@ void TableFormattingContext::calculate_row_column_grid(Box const& box)
});
m_columns.resize(x_width);
+
+ for (auto& cell : m_cells) {
+ // Clip spans to the end of the table.
+ cell.row_span = min(cell.row_span, m_rows.size() - cell.row_index);
+ cell.column_span = min(cell.column_span, m_columns.size() - cell.column_index);
+ }
}
void TableFormattingContext::compute_cell_measures(AvailableSpace const& available_space)
|