diff --git a/Meta/CMake/libweb_generators.cmake b/Meta/CMake/libweb_generators.cmake index 023c301bebe..3e2d8c708f6 100644 --- a/Meta/CMake/libweb_generators.cmake +++ b/Meta/CMake/libweb_generators.cmake @@ -29,9 +29,9 @@ function (generate_css_implementation) arguments -j "${LIBWEB_INPUT_FOLDER}/CSS/EnvironmentVariables.json" ) - invoke_cpp_generator( + invoke_py_generator( "MathFunctions.cpp" - Lagom::GenerateCSSMathFunctions + "generate_libweb_css_math_functions.py" "${LIBWEB_INPUT_FOLDER}/CSS/MathFunctions.json" "CSS/MathFunctions.h" "CSS/MathFunctions.cpp" diff --git a/Meta/Generators/generate_libweb_css_math_functions.py b/Meta/Generators/generate_libweb_css_math_functions.py new file mode 100644 index 00000000000..470257b74a7 --- /dev/null +++ b/Meta/Generators/generate_libweb_css_math_functions.py @@ -0,0 +1,446 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2022-2026, Sam Atkins +# Copyright (c) 2026-present, the Ladybird developers. +# +# SPDX-License-Identifier: BSD-2-Clause + +import argparse +import json +import sys + +from pathlib import Path +from typing import TextIO + +sys.path.append(str(Path(__file__).resolve().parent.parent)) + +from Utils.utils import title_casify + +TYPE_CHECKS = { + "": "matches_angle(percentages_resolve_as)", + "": "matches_dimension()", + "": "matches_flex(percentages_resolve_as)", + "": "matches_frequency(percentages_resolve_as)", + "": "matches_length(percentages_resolve_as)", + "": "matches_number(percentages_resolve_as)", + "": "matches_percentage()", + "": "matches_resolution(percentages_resolve_as)", + "