layout: Enforce min-content min main size of flex-level tables (#36469)

Additionally to the minimum specified in min-width or min-height, tables
also enforce a `min-content` minimum.

This was handled in `Sizes::resolve()`, but flex items don't use that.
So this patch moves the logic into `Size::resolve_for_min()`.

Testing: Covered by WPT

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-04-12 07:22:37 -07:00 committed by GitHub
parent 56e7c21fe7
commit 64fe52e918
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 31 additions and 22 deletions

View file

@ -2155,10 +2155,7 @@ impl FlexItem<'_> {
#[inline]
fn is_table(&self) -> bool {
match &self.box_.independent_formatting_context.contents {
IndependentFormattingContextContents::NonReplaced(content) => content.is_table(),
IndependentFormattingContextContents::Replaced(_) => false,
}
self.box_.is_table()
}
}
@ -2366,6 +2363,7 @@ impl FlexItemBox {
get_automatic_minimum_size,
stretch_size.main,
&main_content_sizes,
self.is_table(),
);
FlexItem {
@ -2724,4 +2722,12 @@ impl FlexItemBox {
},
}
}
#[inline]
fn is_table(&self) -> bool {
match &self.independent_formatting_context.contents {
IndependentFormattingContextContents::NonReplaced(content) => content.is_table(),
IndependentFormattingContextContents::Replaced(_) => false,
}
}
}