Skip to content

Commit

Permalink
LibWeb/CSS: Parse calc() as intermediate types instead of UnparsedCN
Browse files Browse the repository at this point in the history
Previously we created a tree of CalculationNodes with dummy
UnparsedCalculationNode children, and then swapped those with the real
children. This matched the spec closely but had the unfortunate
downside that CalculationNodes couldn't be immutable, and couldn't know
their properties at construct-time. UnparsedCalculationNode is also a
footgun, as if it gets left in the tree accidentally we would VERIFY().

So instead, let's parse the calc() tree into an intermediate format, and
then convert each node in that tree, depth-first, into its
corresponding CalculationNode. This means each CalculationNode knows
what its children are when it is constructed, and they never change.

Apart from deleting UnparsedCalculationNode, we can also get rid of the
for_each_child_node() method that was only used by this "replace the
children" code.
  • Loading branch information
AtkinsSJ committed Dec 17, 2024
1 parent 52bddb6 commit a42a6d8
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 336 deletions.
Loading

0 comments on commit a42a6d8

Please sign in to comment.