Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb/CSS: Parse calc() as intermediate types instead of UnparsedCN
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