1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

LibWeb: Allow percentages on CSS transform scale functions

This commit is contained in:
Bastiaan van der Plaat 2024-01-08 18:51:19 +01:00 committed by Andreas Kling
parent 57ea3e160a
commit c443f80137
9 changed files with 63 additions and 11 deletions

View file

@ -35,8 +35,10 @@ ErrorOr<Gfx::FloatMatrix4x4> Transformation::to_matrix(Optional<Painting::Painta
return value.value().to_radians();
return Error::from_string_literal("Transform contains non absolute units");
},
[](double value) -> ErrorOr<float> {
return value;
[&](CSS::NumberPercentage const& value) -> ErrorOr<float> {
if (value.is_percentage())
return value.percentage().as_fraction();
return value.number().value();
});
};