LibWeb: Don't crash when encountering a resolution in a calculation

calc() seems to support resolutions by now.

The change allows us to pass this WPT test:
http://wpt.live/css/css-values/round-mod-rem-invalid.html
This commit is contained in:
Glenn Skrzypczak 2024-10-12 23:30:49 +02:00 committed by Andrew Kaster
parent 7ed08a401f
commit 3804c4dea1
Notes: github-actions[bot] 2024-10-13 04:23:56 +00:00

View file

@ -7,6 +7,7 @@
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
* Copyright (c) 2024, Tommy van der Vorst <tommy@pixelspark.nl>
* Copyright (c) 2024, Matthew Olsson <mattco@serenityos.org>
* Copyright (c) 2024, Glenn Skrzypczak <glenn.skrzypczak@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -8437,7 +8438,8 @@ OwnPtr<CalculationNode> Parser::parse_a_calculation(Vector<ComponentValue> const
values.append({ NumericCalculationNode::create(dimension->length()) });
else if (dimension->is_percentage())
values.append({ NumericCalculationNode::create(dimension->percentage()) });
// FIXME: Resolutions, once calc() supports them.
else if (dimension->is_resolution())
values.append({ NumericCalculationNode::create(dimension->resolution()) });
else if (dimension->is_time())
values.append({ NumericCalculationNode::create(dimension->time()) });
else if (dimension->is_flex()) {