From 07c709624684e9d77c34a935c40db695b35f9073 Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Tue, 13 Feb 2024 01:00:02 -0800 Subject: [PATCH] Include border-spacing gutters in compute_inline_content_sizes (#31337) This way, if the table is inside an intrinsically sized container, like a float or inline-block, the table won't overflow it (in basic cases). --- components/layout_2020/table/layout.rs | 3 +++ tests/wpt/meta/css/css-tables/absolute-tables-005.html.ini | 6 ------ .../wpt/meta/css/css-tables/tentative/table-minmax.html.ini | 6 ------ 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/components/layout_2020/table/layout.rs b/components/layout_2020/table/layout.rs index 0afbe567c04..9cf4cd02c31 100644 --- a/components/layout_2020/table/layout.rs +++ b/components/layout_2020/table/layout.rs @@ -1185,6 +1185,9 @@ impl Table { inline_content_sizes.push(row_inline_content_sizes); total_size += max_content_sizes_in_column; } + let gutters = self.border_spacing().inline * (self.size.width as i32 + 1); + total_size.min_content += gutters; + total_size.max_content += gutters; (total_size, inline_content_sizes) } diff --git a/tests/wpt/meta/css/css-tables/absolute-tables-005.html.ini b/tests/wpt/meta/css/css-tables/absolute-tables-005.html.ini index 80fcc051f7a..0af821bee54 100644 --- a/tests/wpt/meta/css/css-tables/absolute-tables-005.html.ini +++ b/tests/wpt/meta/css/css-tables/absolute-tables-005.html.ini @@ -4,9 +4,3 @@ [.table 2] expected: FAIL - - [.table 3] - expected: FAIL - - [.table 4] - expected: FAIL diff --git a/tests/wpt/meta/css/css-tables/tentative/table-minmax.html.ini b/tests/wpt/meta/css/css-tables/tentative/table-minmax.html.ini index ab7e0b53ae8..d4c213682b8 100644 --- a/tests/wpt/meta/css/css-tables/tentative/table-minmax.html.ini +++ b/tests/wpt/meta/css/css-tables/tentative/table-minmax.html.ini @@ -2,12 +2,6 @@ [table 2] expected: FAIL - [table 3] - expected: FAIL - - [table 4] - expected: FAIL - [table 5] expected: FAIL