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 <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-09-24 20:21:04 +02:00 committed by GitHub
parent e4f3705494
commit 454d6052b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 6 deletions

View file

@ -245,11 +245,14 @@ impl Zero for CellOrTrackMeasure {
impl<'a> TableLayout<'a> { impl<'a> TableLayout<'a> {
fn new(table: &'a Table) -> 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.
// <https://github.com/w3c/csswg-drafts/issues/10937#issuecomment-2669150397> // <https://github.com/w3c/csswg-drafts/issues/10937>
let style = &table.style; let style = &table.style;
let is_in_fixed_mode = style.get_table().table_layout == TableLayoutMode::Fixed && 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 { Self {
table, table,
pbm: PaddingBorderMargin::zero(), pbm: PaddingBorderMargin::zero(),

View file

@ -618521,7 +618521,7 @@
] ]
], ],
"fixed-layout-2.html": [ "fixed-layout-2.html": [
"d751954714cd7b8c1f5b87182d1025474c5c4939", "1b07b57c781ea0e3766d579f8480a899d66007cb",
[ [
null, null,
{} {}

View file

@ -3,7 +3,7 @@
<link rel="author" title="Oriol Brufau" href="obrufau@igalia.com"> <link rel="author" title="Oriol Brufau" href="obrufau@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#in-fixed-mode"> <link rel="help" href="https://drafts.csswg.org/css-tables-3/#in-fixed-mode">
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/10937"> <link rel="help" href="https://github.com/w3c/csswg-drafts/issues/10937">
<meta name="assert" content="Fixed table layout is triggered except when inline-size is auto."> <meta name="assert" content="Fixed table layout is triggered except when inline-size is auto or max-content.">
<link rel="stylesheet" href="./support/base.css"> <link rel="stylesheet" href="./support/base.css">
<style> <style>
@ -103,7 +103,7 @@ function checkSize(size, allowsFixed) {
for (let size of sizes) { for (let size of sizes) {
if (CSS.supports("width", size)) { if (CSS.supports("width", size)) {
let allowsFixed = size !== "auto"; let allowsFixed = size !== "auto" && size !== "max-content";
checkSize(size, allowsFixed); checkSize(size, allowsFixed);
// calc-size() should trigger fixed table layout. // calc-size() should trigger fixed table layout.