LibWeb: Treat percentage max-width as none during min-content sizing

...but only for non-replaced boxes. This is what CSS-SIZING-3 tells us
to do, and we were already doing it for width, but neglecting max-width.
This commit is contained in:
Andreas Kling 2025-09-28 12:48:41 +02:00 committed by Andreas Kling
parent 652e52d76a
commit f00f975cf4
Notes: github-actions[bot] 2025-09-28 17:26:15 +00:00
3 changed files with 43 additions and 1 deletions

View file

@ -1926,11 +1926,15 @@ bool FormattingContext::should_treat_max_width_as_none(Box const& box, Available
return true;
if (available_width.is_max_content() && max_width.is_max_content())
return true;
// https://drafts.csswg.org/css-sizing-3/#cyclic-percentage-contribution
if (max_width.contains_percentage()) {
if (available_width.is_max_content())
return true;
if (available_width.is_min_content())
if (available_width.is_min_content()) {
if (!box.is_replaced_box())
return true;
return false;
}
if (!m_state.get(*box.non_anonymous_containing_block()).has_definite_width())
return true;
}