LibWeb/CSS: Use CSS::URL for font-fetching

ParsedFontFace and FontLoader now both keep track of which
CSSStyleSheet (if any) was the source of the font-face, so the URLs can
be completed correctly.
This commit is contained in:
Sam Atkins 2025-05-02 12:07:22 +01:00
commit 9e2e796f2d
Notes: github-actions[bot] 2025-05-03 11:02:47 +00:00
9 changed files with 38 additions and 31 deletions

View file

@ -728,12 +728,15 @@ void dump_font_face_rule(StringBuilder& builder, CSS::CSSFontFaceRule const& rul
indent(builder, indent_levels + 1);
builder.append("sources:\n"sv);
for (auto const& source : font_face.sources()) {
for (auto const& [local_or_url, format] : font_face.sources()) {
indent(builder, indent_levels + 2);
if (source.local_or_url.has<URL::URL>())
builder.appendff("url={}, format={}\n", source.local_or_url.get<URL::URL>(), source.format.value_or("???"_string));
else
builder.appendff("local={}\n", source.local_or_url.get<FlyString>());
local_or_url.visit(
[&builder, &format](CSS::URL const& url) {
builder.appendff("url={}, format={}\n", url, format.value_or("???"_string));
},
[&builder](FlyString const& local) {
builder.appendff("local={}\n", local);
});
}
indent(builder, indent_levels + 1);