LibWeb: Generate pseudo-element code from JSON

Initially, this generates the enum and to/from-string functions. The
JSON itself contains more data than that, but it's unused for now.
This commit is contained in:
Sam Atkins 2025-03-19 14:58:22 +00:00
parent 0ed2e71801
commit ffa1dba96a
Notes: github-actions[bot] 2025-03-24 09:51:30 +00:00
14 changed files with 244 additions and 106 deletions

View file

@ -1401,7 +1401,7 @@ void Element::serialize_pseudo_elements_as_json(JsonArraySerializer<StringBuilde
if (!pseudo_element)
continue;
auto object = MUST(children_array.add_object());
MUST(object.add("name"sv, MUST(String::formatted("::{}", CSS::Selector::PseudoElementSelector::name(static_cast<CSS::PseudoElement>(i))))));
MUST(object.add("name"sv, MUST(String::formatted("::{}", CSS::pseudo_element_name(static_cast<CSS::PseudoElement>(i))))));
MUST(object.add("type"sv, "pseudo-element"));
MUST(object.add("parent-id"sv, unique_id().value()));
MUST(object.add("pseudo-element"sv, i));