LibWeb/CSS: Parse and use tech() in @font-face { src }

This commit is contained in:
Sam Atkins 2025-06-03 12:32:05 +01:00
commit d611806f18
Notes: github-actions[bot] 2025-06-05 11:39:21 +00:00
10 changed files with 131 additions and 35 deletions

View file

@ -9,10 +9,11 @@
namespace Web::CSS {
FontSourceStyleValue::FontSourceStyleValue(Source source, Optional<FlyString> format)
FontSourceStyleValue::FontSourceStyleValue(Source source, Optional<FlyString> format, Vector<FontTech> tech)
: StyleValueWithDefaultOperators(Type::FontSource)
, m_source(move(source))
, m_format(move(format))
, m_tech(move(tech))
{
}
@ -36,7 +37,6 @@ String FontSourceStyleValue::to_string(SerializationMode) const
},
[this](URL const& url) {
// <url> [ format(<font-format>)]? [ tech( <font-tech>#)]?
// FIXME: tech()
StringBuilder builder;
builder.append(url.to_string());
@ -46,6 +46,14 @@ String FontSourceStyleValue::to_string(SerializationMode) const
builder.append(")"sv);
}
if (!m_tech.is_empty()) {
builder.append(" tech("sv);
serialize_a_comma_separated_list(builder, m_tech, [](auto& builder, FontTech const tech) {
return builder.append(CSS::to_string(tech));
});
builder.append(")"sv);
}
return builder.to_string_without_validation();
});
}