1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:57:35 +00:00

LibWeb: Treat % max-width as none when containing block size indefinite

This is technically "undefined behavior" per CSS 2.2, but it seems
sensible to mirror the behavior of max-height in the same situation.
It also appears to match how other engines behave.

Fixes #19242
This commit is contained in:
Andreas Kling 2023-06-14 18:35:02 +02:00
parent ff1606ffaf
commit 3a11b55286
7 changed files with 34 additions and 11 deletions

View file

@ -188,7 +188,7 @@ void TableFormattingContext::compute_cell_measures(AvailableSpace const& availab
CSSPixels max_width = computed_values.width().is_auto() ? max_content_width : width;
if (!should_treat_max_height_as_none(cell.box))
max_height = min(max_height, computed_values.max_height().to_px(cell.box, containing_block.content_height()));
if (!computed_values.max_width().is_none())
if (!should_treat_max_width_as_none(cell.box))
max_width = min(max_width, computed_values.max_width().to_px(cell.box, containing_block.content_width()));
if (computed_values.height().is_percentage()) {
@ -350,7 +350,7 @@ void TableFormattingContext::compute_table_width()
// of resolved-table-width, and the used min-width of the table.
CSSPixels resolved_table_width = computed_values.width().to_px(table_box(), width_of_table_wrapper_containing_block);
used_width = max(resolved_table_width, used_min_width);
if (!computed_values.max_width().is_none())
if (!should_treat_max_width_as_none(table_box()))
used_width = min(used_width, computed_values.max_width().to_px(table_box(), width_of_table_wrapper_containing_block));
}