1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:18:13 +00:00

LibWeb: Support flex items with calc() main size containing percentages

If a flex item's main size is a CSS calc() value that resolves to a
length and contains a percentage, we can only resolve it when we have
the corresponding reference size for the containing block.
This commit is contained in:
Andreas Kling 2023-06-02 15:34:26 +02:00
parent d6c3cbd958
commit 06617a982e
3 changed files with 38 additions and 3 deletions

View file

@ -623,10 +623,13 @@ void FlexFormattingContext::determine_flex_base_size_and_hypothetical_main_size(
if (flex_basis.length_percentage->is_calculated()) {
auto const& calc_value = *flex_basis.length_percentage->calculated();
if (calc_value.resolves_to_length())
return true;
if (calc_value.resolves_to_percentage() || (calc_value.resolves_to_length() && calc_value.contains_percentage()))
if (calc_value.resolves_to_percentage())
return can_resolve_percentages;
if (calc_value.resolves_to_length()) {
if (calc_value.contains_percentage())
return can_resolve_percentages;
return true;
}
return false;
}
VERIFY(flex_basis.length_percentage->is_percentage());