From 454d6052b4a3b396573e93f190413a4877daa902 Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Wed, 24 Sep 2025 20:21:04 +0200 Subject: [PATCH] layout: Avoid fixed table layout when `inline-size` is `max-content` (#39474) This undoes #35882 according to the last CSSWG resolution, since this is required by web compat. Testing: Modifying the relevant test Signed-off-by: Oriol Brufau --- components/layout/table/layout.rs | 9 ++++++--- tests/wpt/meta/MANIFEST.json | 2 +- tests/wpt/tests/css/css-tables/fixed-layout-2.html | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/components/layout/table/layout.rs b/components/layout/table/layout.rs index ad9785622f9..d8d0ebc923a 100644 --- a/components/layout/table/layout.rs +++ b/components/layout/table/layout.rs @@ -245,11 +245,14 @@ impl Zero for CellOrTrackMeasure { impl<'a> TableLayout<'a> { fn new(table: &'a Table) -> TableLayout<'a> { - // The CSSWG resolved that only `inline-size: auto` can prevent fixed table mode. - // + // The CSSWG resolved that `auto` and `max-content` inline sizes prevent fixed table mode. + // let style = &table.style; let is_in_fixed_mode = style.get_table().table_layout == TableLayoutMode::Fixed && - !style.box_size(style.writing_mode).inline.is_initial(); + !matches!( + style.box_size(style.writing_mode).inline, + Size::Initial | Size::MaxContent + ); Self { table, pbm: PaddingBorderMargin::zero(), diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json index e7b579bd3fd..6c6c7df1e42 100644 --- a/tests/wpt/meta/MANIFEST.json +++ b/tests/wpt/meta/MANIFEST.json @@ -618521,7 +618521,7 @@ ] ], "fixed-layout-2.html": [ - "d751954714cd7b8c1f5b87182d1025474c5c4939", + "1b07b57c781ea0e3766d579f8480a899d66007cb", [ null, {} diff --git a/tests/wpt/tests/css/css-tables/fixed-layout-2.html b/tests/wpt/tests/css/css-tables/fixed-layout-2.html index d751954714c..1b07b57c781 100644 --- a/tests/wpt/tests/css/css-tables/fixed-layout-2.html +++ b/tests/wpt/tests/css/css-tables/fixed-layout-2.html @@ -3,7 +3,7 @@ - +