LibWeb: Clamp calculated steps() interval count using normal system

Previously we were doing this ad-hoc later in the process but we now
have the `calc` clamping system which can simplify things.

This reveals some false-positives in that we don't handle relative
lengths within these `calc`s but these are fixed in the next commit
This commit is contained in:
Callum Law 2025-10-10 14:32:29 +13:00 committed by Sam Atkins
commit ad41f053b8
Notes: github-actions[bot] 2025-10-20 10:29:14 +00:00
5 changed files with 25 additions and 23 deletions

View file

@ -320,7 +320,7 @@ EasingFunction EasingFunction::from_style_value(StyleValue const& style_value)
return CubicBezierEasingFunction { resolved_x1, resolved_y1, resolved_x2, resolved_y2, cubic_bezier.to_string(SerializationMode::Normal) };
},
[](EasingStyleValue::Steps const& steps) -> EasingFunction {
auto resolved_interval_count = max(steps.number_of_intervals.resolved({}).value_or(1), steps.position == StepPosition::JumpNone ? 2 : 1);
auto resolved_interval_count = steps.number_of_intervals.resolved({}).value_or(1);
return StepsEasingFunction { resolved_interval_count, steps.position, steps.to_string(SerializationMode::ResolvedValue) };
});