LibWeb: Stop passing Realm unnecessarily to parse CSS properties

Also use the parse_css_value() helper in cases where we previously
constructed a Parser manually.
This commit is contained in:
Sam Atkins
2024-12-05 11:52:43 +00:00
committed by Alexander Kalenik
parent ee9db99961
commit bc77f84359
11 changed files with 20 additions and 46 deletions

View File

@@ -22,14 +22,12 @@ WebIDL::ExceptionOr<String> escape(JS::VM&, StringView identifier)
}
// https://www.w3.org/TR/css-conditional-3/#dom-css-supports
bool supports(JS::VM& vm, StringView property, StringView value)
bool supports(JS::VM&, StringView property, StringView value)
{
auto& realm = *vm.current_realm();
// 1. If property is an ASCII case-insensitive match for any defined CSS property that the UA supports,
// and value successfully parses according to that propertys grammar, return true.
if (auto property_id = property_id_from_string(property); property_id.has_value()) {
if (parse_css_value(Parser::ParsingContext { realm }, value, property_id.value()))
if (parse_css_value(Parser::ParsingContext {}, value, property_id.value()))
return true;
}