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

@ -137,15 +137,10 @@ String EasingStyleValue::Steps::to_string(SerializationMode mode) const
return {};
return CSS::to_string(this->position);
}();
auto intervals = number_of_intervals;
if (mode == SerializationMode::ResolvedValue) {
auto resolved_value = number_of_intervals.resolved({}).value_or(1);
intervals = max(resolved_value, this->position == StepPosition::JumpNone ? 2 : 1);
}
if (position.has_value()) {
builder.appendff("steps({}, {})", intervals.to_string(mode), position.value());
builder.appendff("steps({}, {})", number_of_intervals.to_string(mode), position.value());
} else {
builder.appendff("steps({})", intervals.to_string(mode));
builder.appendff("steps({})", number_of_intervals.to_string(mode));
}
}
return MUST(builder.to_string());