LibWeb/CSS: Generate property-filtering code for pseudo-elements

Pseudo-elements have specific rules about which CSS properties can be
applied to them. This is a first step to supporting that.

- If a property whitelist isn't present, all properties are allowed.
- Properties are named as in CSS.
- Names of property groups are prefixed with `#`, which makes this match
  the spec more clearly. These groups are implemented directly in the
  code generator for now.
- Any property name beginning with "FIXME:" is ignored, so we can mark
  properties we don't implement yet.
This commit is contained in:
Sam Atkins 2025-03-20 14:55:52 +00:00
commit 1108988656
Notes: github-actions[bot] 2025-03-24 09:51:00 +00:00
2 changed files with 287 additions and 4 deletions

View file

@ -50,19 +50,61 @@
"spec": "https://drafts.csswg.org/css-forms-1/#selectordef-fill"
},
"first-letter": {
"spec": "https://drafts.csswg.org/css-pseudo-4/#selectordef-first-letter"
"spec": "https://drafts.csswg.org/css-pseudo-4/#selectordef-first-letter",
"property-whitelist": [
"#font-properties",
"color",
"opacity",
"#background-properties",
"#inline-typesetting-properties",
"#text-decoration-properties",
"#inline-layout-properties",
"#margin-properties",
"#padding-properties",
"#border-properties",
"box-shadow"
]
},
"first-line": {
"spec": "https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line"
"spec": "https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line",
"property-whitelist": [
"#font-properties",
"color",
"opacity",
"#background-properties",
"#inline-typesetting-properties",
"#text-decoration-properties",
"FIXME: ruby-position",
"#inline-layout-properties"
]
},
"marker": {
"spec": "https://drafts.csswg.org/css-pseudo-4/#selectordef-marker"
},
"placeholder": {
"spec": "https://drafts.csswg.org/css-pseudo-4/#selectordef-placeholder"
"spec": "https://drafts.csswg.org/css-pseudo-4/#selectordef-placeholder",
"property-whitelist": [
"#font-properties",
"color",
"opacity",
"#background-properties",
"#inline-typesetting-properties",
"#text-decoration-properties",
"FIXME: ruby-position"
]
},
"selection": {
"spec": "https://drafts.csswg.org/css-pseudo-4/#selectordef-selection"
"spec": "https://drafts.csswg.org/css-pseudo-4/#selectordef-selection",
"property-whitelist": [
"color",
"background-color",
"#text-decoration-properties",
"text-shadow",
"FIXME: stroke-color",
"FIXME: fill-color",
"stroke-width",
"#custom-properties"
]
},
"thumb": {
"spec": "https://drafts.csswg.org/css-forms-1/#selectordef-thumb"