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

LibWeb: Resolve calc() values in CSS transform

There are two parts to this fix:

- First, StyleProperties::transformations() would previously omit calc()
  values entirely when returning the list of transformations. This was
  very confusing to StackingContext which then tried to index into the
  list based on faulty assumptions. Fix this by emitting calc values.

- Second, StackingContext::get_transformation_matrix() now always calls
  resolve() on length-percentages. This takes care of actually resolving
  calc() values. If no reference value for percentages is provided, we
  default to 0px.

This stops LibWeb from asserting on websites with calc() in transform
values, such as https://qt.io/ :^)
This commit is contained in:
Andreas Kling 2023-07-15 10:23:43 +02:00
parent 2a563b9de6
commit 3ec9fd0aae
4 changed files with 14 additions and 7 deletions

View file

@ -0,0 +1,8 @@
<style>
body {
transform: translate3d(calc(50px), calc(100px), calc(0px));
border: 1px solid black;
width: 100px;
height: 100px;
}
</style>