mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
LibWeb: Load alternative font urls if others fail
We don't support all parts of the font formats we assume as "supported" in the CSS parser. For example, if an open type font has a CFF table, we reject loading it. This meant that until now, when such an unsupported-supported font url was first in the list of urls, we couldn't load it at all, even when we would support a later url. To resolve that, try loading all font urls one after each other, in case we are not able to load the higher priority one. This also resolves a FIXME related to spec compliant url prioritization. Our CSS parser already filters and prioritizes font src urls in compliance with the spec. However, we still had to resort to brittle file extension matching, because some websites don't set the `format` and if the first url in a src list happened to be one we don't support, the font could not be loaded at all. This now is unnecessary because we can try and discard the urls instead.
This commit is contained in:
parent
1dc074fc18
commit
3a45bba4e0
2 changed files with 23 additions and 26 deletions
|
@ -5435,6 +5435,10 @@ Vector<FontFace::Source> Parser::parse_font_face_src(TokenStream<ComponentValue>
|
|||
// FIXME: Implement optional tech() function from CSS-Fonts-4.
|
||||
if (auto maybe_url = parse_url_function(first, AllowedDataUrlType::Font); maybe_url.has_value()) {
|
||||
auto url = maybe_url.release_value();
|
||||
if (!url.is_valid()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Optional<FlyString> format;
|
||||
|
||||
source_tokens.skip_whitespace();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue