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
commit bc77f84359
Notes: github-actions[bot] 2024-12-05 19:00:42 +00:00
11 changed files with 20 additions and 46 deletions

View file

@ -174,8 +174,7 @@ WebIDL::CallbackType* FontFaceSet::onloadingerror()
static WebIDL::ExceptionOr<GC::Ref<JS::Set>> find_matching_font_faces(JS::Realm& realm, FontFaceSet& font_face_set, String const& font, String const&)
{
// 1. Parse font using the CSS value syntax of the font property. If a syntax error occurs, return a syntax error.
auto parser = CSS::Parser::Parser::create(CSS::Parser::ParsingContext(realm), font);
auto property = parser.parse_as_css_value(PropertyID::Font);
auto property = parse_css_value(CSS::Parser::ParsingContext(), font, PropertyID::Font);
if (!property)
return WebIDL::SyntaxError::create(realm, "Unable to parse font"_string);