LibWeb: Use LengthPercentage for calc values in Transformation matrix

This commit is contained in:
Matthew Olsson 2024-05-25 12:03:59 -07:00 committed by Andreas Kling
parent e2b2b2439c
commit a8ef84f8c3
Notes: sideshowbarker 2024-07-17 11:30:05 +09:00
3 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1 @@
PASS! (Didn't crash)

View File

@ -0,0 +1,21 @@
<!-- https://github.com/SerenityOS/serenity/issues/23633 -->
<style>
div {
--some-var: -100px;
animation: anim 1s infinite;
}
@keyframes anim {
to {
transform: translateX(calc(var(--some-var) * -1));
}
}
</style>
<div></div>
<script src="../include.js"></script>
<script>
promiseTest(async () => {
await animationFrame();
println("PASS! (Didn't crash)");
});
</script>

View File

@ -870,7 +870,7 @@ static RefPtr<StyleValue const> interpolate_transform(DOM::Element& element, Sty
values.append(AngleOrCalculated { value->as_angle().angle() });
break;
case StyleValue::Type::Calculated:
values.append(AngleOrCalculated { value->as_calculated() });
values.append(LengthPercentage { value->as_calculated() });
break;
case StyleValue::Type::Length:
values.append(LengthPercentage { value->as_length().length() });