LibWeb: Correctly resolve percentages against relative lengths in calcs

Previously we would always assume the percentage was 100%
This commit is contained in:
Callum Law 2025-07-17 19:29:56 +12:00 committed by Sam Atkins
commit 1ca511b627
Notes: github-actions[bot] 2025-09-19 09:09:20 +00:00

View file

@ -3269,7 +3269,7 @@ NonnullRefPtr<CalculationNode const> simplify_a_calculation_tree(CalculationNode
if (length.is_absolute())
return NumericCalculationNode::create(Length::make_px(length.absolute_length_to_px()).percentage_of(*percentage), context);
if (resolution_context.length_resolution_context.has_value())
return NumericCalculationNode::create(Length::make_px(length.to_px(resolution_context.length_resolution_context.value())), context);
return NumericCalculationNode::create(Length::make_px(length.to_px(resolution_context.length_resolution_context.value())).percentage_of(*percentage), context);
return nullptr;
},
[&](Time const& time) -> RefPtr<NumericCalculationNode const> {