layout: Fix intrinsic contributions of tables (#34696)

If a table element had e.g. `width: 0px`, we were assuming that this was
its intrinsic min-content and max-content contributions.

However, tables are always at least as big as its min-content size, so
this patch floors the intrinsic contributions by that amount.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2024-12-20 06:04:56 -08:00 committed by GitHub
parent 915901bdec
commit 65c65c9a6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 24 additions and 12 deletions

View file

@ -204,11 +204,18 @@ impl IndependentFormattingContext {
auto_minimum: &LogicalVec2<Au>,
auto_block_size_stretches_to_containing_block: bool,
) -> InlineContentSizesResult {
let is_table = matches!(
self.contents,
IndependentFormattingContextContents::NonReplaced(
IndependentNonReplacedContents::Table(_)
)
);
sizing::outer_inline(
self.style(),
containing_block,
auto_minimum,
auto_block_size_stretches_to_containing_block,
is_table,
|padding_border_sums| self.preferred_aspect_ratio(padding_border_sums),
|constraint_space| self.inline_content_sizes(layout_context, constraint_space),
)