LibWeb/CSS: Support calculated percentages in line-height

Without this, the imported test will crash once we implement
`CSSUnitValue::create_an_internal_representation()`.
This commit is contained in:
Sam Atkins 2025-10-06 10:39:06 +01:00 committed by Andreas Kling
commit bd545af210
Notes: github-actions[bot] 2025-10-09 14:17:34 +00:00
3 changed files with 74 additions and 1 deletions

View file

@ -3592,7 +3592,7 @@ NonnullRefPtr<StyleValue const> StyleComputer::compute_line_height(NonnullRefPtr
return specified_value->absolutized(computation_context);
// NOTE: We also support calc()'d lengths (percentages resolve to lengths so we don't have to handle them separately)
if (specified_value->is_calculated() && specified_value->as_calculated().resolves_to_length())
if (specified_value->is_calculated() && specified_value->as_calculated().resolves_to_length_percentage())
return LengthStyleValue::create(specified_value->as_calculated().resolve_length(CalculationResolutionContext::from_computation_context(computation_context, Length(1, LengthUnit::Em))).value());
// <number [0,∞]>