diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp index 1b5d0ee768..dcf0c96b74 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp @@ -252,6 +252,32 @@ bool property_has_quirk(PropertyID property_id, Quirk quirk) } } +size_t property_maximum_value_count(PropertyID property_id) +{ + switch (property_id) { +)~~~"); + + properties.for_each_member([&](auto& name, auto& value) { + VERIFY(value.is_object()); + if (value.as_object().has("max-values")) { + auto max_values = value.as_object().get("max-values"); + VERIFY(max_values.is_number() && !max_values.is_double()); + auto property_generator = generator.fork(); + property_generator.set("name:titlecase", title_casify(name)); + property_generator.set("max_values", max_values.to_string()); + property_generator.append(R"~~~( + case PropertyID::@name:titlecase@: + return @max_values@; +)~~~"); + } + }); + + generator.append(R"~~~( + default: + return 1; + } +} + } // namespace Web::CSS )~~~"); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_h.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_h.cpp index 38a6cd435b..3ce193e714 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_h.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_h.cpp @@ -106,6 +106,8 @@ bool is_inherited_property(PropertyID); bool is_pseudo_property(PropertyID); RefPtr property_initial_value(PropertyID); +size_t property_maximum_value_count(PropertyID); + constexpr PropertyID first_property_id = PropertyID::@first_property_id@; constexpr PropertyID last_property_id = PropertyID::@last_property_id@; constexpr PropertyID first_shorthand_property_id = PropertyID::@first_shorthand_property_id@;