mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-22 16:09:23 +00:00
LibWeb: Clamp calculated cubic-bezier()
X coords 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 commit is contained in:
parent
ef4f01ea44
commit
06a57a280d
Notes:
github-actions[bot]
2025-10-20 10:29:21 +00:00
Author: https://github.com/Calme1709
Commit: 06a57a280d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6459
Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 11 additions and 15 deletions
|
@ -116,18 +116,7 @@ String EasingStyleValue::CubicBezier::to_string(SerializationMode mode) const
|
|||
} else if (*this == CubicBezier::ease_in_out()) {
|
||||
builder.append("ease-in-out"sv);
|
||||
} else {
|
||||
auto x1_value = x1;
|
||||
auto y1_value = y1;
|
||||
auto x2_value = x2;
|
||||
auto y2_value = y2;
|
||||
if (mode == SerializationMode::ResolvedValue) {
|
||||
x1_value = clamp(x1_value.resolved({}).value_or(0.0), 0.0, 1.0);
|
||||
x2_value = clamp(x2_value.resolved({}).value_or(0.0), 0.0, 1.0);
|
||||
y1_value = y1_value.resolved({}).value_or(0.0);
|
||||
y2_value = y2_value.resolved({}).value_or(0.0);
|
||||
}
|
||||
builder.appendff("cubic-bezier({}, {}, {}, {})",
|
||||
x1_value.to_string(mode), y1_value.to_string(mode), x2_value.to_string(mode), y2_value.to_string(mode));
|
||||
builder.appendff("cubic-bezier({}, {}, {}, {})", x1.to_string(mode), y1.to_string(mode), x2.to_string(mode), y2.to_string(mode));
|
||||
}
|
||||
return MUST(builder.to_string());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue