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> {
fn new(table: &'a Table) -> TableLayout<'a> {
// The CSSWG resolved that only `inline-size: auto` can prevent fixed table mode.
// <https://github.com/w3c/csswg-drafts/issues/10937#issuecomment-2669150397>
// The CSSWG resolved that `auto` and `max-content` inline sizes prevent fixed table mode.
// <https://github.com/w3c/csswg-drafts/issues/10937>
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(),