1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +00:00

LibWeb: Fix infinite recursion when grid has "max-width: max-content"

With this change "max-width: max-content" is treated as "none" when
the available width is also "max-content". This fix prevents a stack
overflow in the grid track size maximization algorithm by avoiding
recursive calls to calculate_max_width() when determining the maximum
grid container size.
This commit is contained in:
Aliaksandr Kalenik 2024-02-20 21:50:48 +01:00 committed by Andreas Kling
parent 8e2102fb73
commit aee5120078
4 changed files with 43 additions and 10 deletions

View file

@ -1857,6 +1857,8 @@ bool FormattingContext::should_treat_max_width_as_none(Box const& box, Available
auto const& max_width = box.computed_values().max_width();
if (max_width.is_none())
return true;
if (available_width.is_max_content() && max_width.is_max_content())
return true;
if (box.is_absolutely_positioned())
return false;
if (max_width.contains_percentage()) {