LibWeb: Prevent max-width expanding the width

This commit is contained in:
Emil Militzer 2023-07-11 16:22:25 +02:00 committed by Andreas Kling
commit bf3144fcff
Notes: sideshowbarker 2024-07-16 23:34:49 +09:00
3 changed files with 14 additions and 1 deletions

View file

@ -255,7 +255,7 @@ void BlockFormattingContext::compute_width(Box const& box, AvailableSpace const&
// but this time using the computed value of 'max-width' as the computed value for 'width'.
if (!should_treat_max_width_as_none(box, available_space.width)) {
auto max_width = calculate_inner_width(box, remaining_available_space.width, computed_values.max_width());
auto used_width_px = used_width.is_auto() ? remaining_available_space.width.to_px() : used_width.to_px(box);
auto used_width_px = used_width.is_auto() ? CSSPixels { 0 } : used_width.to_px(box);
if (used_width_px > max_width.to_px(box)) {
used_width = try_compute_width(max_width);
}