mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb: Add Percentage::from_style_value
This commit is contained in:
Notes:
github-actions[bot]
2026-03-30 13:07:16 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/149acdd7c5e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8676 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -301,16 +301,6 @@ EasingFunction EasingFunction::ease()
|
||||
|
||||
EasingFunction EasingFunction::from_style_value(StyleValue const& style_value)
|
||||
{
|
||||
auto const resolve_percentage = [](StyleValue const& style_value) {
|
||||
if (style_value.is_percentage())
|
||||
return style_value.as_percentage().percentage().as_fraction();
|
||||
|
||||
if (style_value.is_calculated())
|
||||
return style_value.as_calculated().resolve_percentage({})->as_fraction();
|
||||
|
||||
VERIFY_NOT_REACHED();
|
||||
};
|
||||
|
||||
if (style_value.is_easing()) {
|
||||
return style_value.as_easing().function().visit(
|
||||
[&](EasingStyleValue::Linear const& linear) -> EasingFunction {
|
||||
@@ -321,7 +311,7 @@ EasingFunction EasingFunction::from_style_value(StyleValue const& style_value)
|
||||
|
||||
Optional<double> input;
|
||||
if (control_point.input)
|
||||
input = resolve_percentage(*control_point.input);
|
||||
input = Percentage::from_style_value(*control_point.input).as_fraction();
|
||||
|
||||
resolved_control_points.append({ input, output });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user