From 2e4b34b8c30dec858ff3862e0551b43f753401f1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 13 Sep 2021 21:44:34 +0200 Subject: [PATCH] LibWeb: Generate CSS::{first,last}_property_id constants These will allow us to iterate through all known CSS properties. --- .../LibWeb/Generate_CSS_PropertyID_h.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 bede1abac1..c86e09e4f5 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_h.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_h.cpp @@ -56,9 +56,16 @@ enum class PropertyID { Custom, )~~~"); + Optional first_property_id; + Optional last_property_id; + json.value().as_object().for_each_member([&](auto& name, auto& value) { VERIFY(value.is_object()); + if (!first_property_id.has_value()) + first_property_id = name; + last_property_id = name; + auto member_generator = generator.fork(); member_generator.set("name:titlecase", title_casify(name)); @@ -67,6 +74,9 @@ enum class PropertyID { )~~~"); }); + generator.set("first_property_id", title_casify(first_property_id.value())); + generator.set("last_property_id", title_casify(last_property_id.value())); + generator.append(R"~~~( }; @@ -76,6 +86,9 @@ bool is_inherited_property(PropertyID); bool is_pseudo_property(PropertyID); RefPtr property_initial_value(PropertyID); +constexpr PropertyID first_property_id = PropertyID::@first_property_id@; +constexpr PropertyID last_property_id = PropertyID::@last_property_id@; + enum class Quirk { // https://quirks.spec.whatwg.org/#the-hashless-hex-color-quirk HashlessHexColor,