LibWeb: Implement functional pseudo-element parsing

"Functional" as in "it's a function token" and not "it works", because
the behaviour for these is unimplemented. :^)

This is modeled after the pseudo-class parsing, but with some changes
based on things I don't like about that implementation. I've
implemented the `<pt-name-selector>` parameter used by view-transitions
for now, but nothing else.
This commit is contained in:
Sam Atkins 2025-03-24 13:56:24 +00:00 committed by Andreas Kling
parent 5cf04a33ad
commit 88e11eea2d
Notes: github-actions[bot] 2025-03-25 07:56:12 +00:00
8 changed files with 237 additions and 43 deletions

View file

@ -586,7 +586,19 @@ void dump_selector(StringBuilder& builder, CSS::Selector const& selector, int in
}
if (simple_selector.type == CSS::Selector::SimpleSelector::Type::PseudoElement) {
builder.appendff(" pseudo_element={}", simple_selector.pseudo_element().name());
auto const& pseudo_element = simple_selector.pseudo_element();
builder.appendff(" pseudo_element={}", CSS::pseudo_element_name(pseudo_element.type()));
auto pseudo_element_metadata = CSS::pseudo_element_metadata(pseudo_element.type());
switch (pseudo_element_metadata.parameter_type) {
case CSS::PseudoElementMetadata::ParameterType::None:
break;
case CSS::PseudoElementMetadata::ParameterType::PTNameSelector: {
auto const& [is_universal, value] = pseudo_element.pt_name_selector();
builder.appendff("(is_universal={}, value='{}')", is_universal, value);
break;
}
}
}
if (simple_selector.type == CSS::Selector::SimpleSelector::Type::Attribute) {