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
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

@ -127,13 +127,15 @@ This generated `PsuedoElement.h` and `PseudoElement.cpp`.
Each entry has the following properties:
| Field | Required | Default | Description |
|----------------------|----------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `spec` | No | Nothing | Link to the spec definition, for reference. Not used in generated code. |
| `alias-for` | No | Nothing | Use to specify that this should be treated as an alias for the named pseudo-element. |
| `is-generated` | No | `false` | Whether this is a [generated pseudo-element.](https://drafts.csswg.org/css-pseudo-4/#generated-content) |
| `is-allowed-in-has` | No | `false` | Whether this is a [`:has`-allowed pseudo-element.](https://drafts.csswg.org/selectors/#has-allowed-pseudo-element) |
| `property-whitelist` | No | Nothing | Some pseudo-elements only permit certain properties. If so, name them in an array here. Some special values are allowed here for categories of properties - see below. |
| Field | Required | Default | Description |
|----------------------|----------|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `alias-for` | No | Nothing | Use to specify that this should be treated as an alias for the named pseudo-element. |
| `function-syntax` | No | Nothing | Syntax for the function arguments if this is a function-type pseudo-element. Copied directly from the spec. |
| `is-generated` | No | `false` | Whether this is a [generated pseudo-element.](https://drafts.csswg.org/css-pseudo-4/#generated-content) |
| `is-allowed-in-has` | No | `false` | Whether this is a [`:has`-allowed pseudo-element.](https://drafts.csswg.org/selectors/#has-allowed-pseudo-element) |
| `property-whitelist` | No | Nothing | Some pseudo-elements only permit certain properties. If so, name them in an array here. Some special values are allowed here for categories of properties - see below. |
| `spec` | No | Nothing | Link to the spec definition, for reference. Not used in generated code. |
| `type` | No | `"identifier"` | What type of pseudo-element is this. Either "identifier", "function", or "both". |
The generated code provides:
- A `PseudoElement` enum listing every pseudo-element name