LibWeb/CSS: Add basic registered properties with initial values

Add global registry for registered properties and partial support
for `@property` rule. Enables registering properties with initial
values. Also adds basic retrieval via `var()`.

Note: This is not a complete `@property` implementation.
This commit is contained in:
norbiros 2025-07-17 14:51:22 +02:00 committed by Sam Atkins
commit 7ad01d28a8
Notes: github-actions[bot] 2025-07-18 10:13:56 +00:00
9 changed files with 73 additions and 20 deletions

View file

@ -145,6 +145,13 @@ GC::RootVector<GC::Ref<CSSRule>> Parser::convert_rules(Vector<Rule> const& raw_r
m_declared_namespaces.set(as<CSSNamespaceRule>(*rule).prefix());
break;
case CSSRule::Type::Property: {
auto& property_rule = as<CSSPropertyRule>(*rule);
if (m_document) {
const_cast<DOM::Document*>(m_document.ptr())->registered_custom_properties().set(property_rule.name(), property_rule);
}
[[fallthrough]];
}
default:
import_rules_valid = false;
namespace_rules_valid = false;