mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb: Support <custom-ident> in FontFaceSet::load()
This exposed a false positive in our test suite which has been fixed and made more robust
This commit is contained in:
Notes:
github-actions[bot]
2026-01-13 10:41:47 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/e114c7341e1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7420 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -15,6 +15,7 @@
|
||||
#include <LibWeb/CSS/FontFaceSet.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/CSS/PropertyID.h>
|
||||
#include <LibWeb/CSS/StyleValues/CustomIdentStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/ShorthandStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/StringStyleValue.h>
|
||||
@@ -229,14 +230,22 @@ static WebIDL::ExceptionOr<GC::Ref<JS::Set>> find_matching_font_faces(JS::Realm&
|
||||
// that this may be more than just a single font face.
|
||||
for (auto const& font_family : font_family_list.values()) {
|
||||
// FIXME: The matching below is super basic. We currently just match font family names by their string value.
|
||||
if (!font_family->is_string())
|
||||
continue;
|
||||
auto maybe_font_family_name = [&]() -> Optional<FlyString> {
|
||||
if (font_family->is_string())
|
||||
return font_family->as_string().string_value();
|
||||
|
||||
auto const& font_family_name = font_family->as_string().string_value();
|
||||
if (font_family->is_custom_ident())
|
||||
return font_family->as_custom_ident().custom_ident();
|
||||
|
||||
return {};
|
||||
}();
|
||||
|
||||
if (!maybe_font_family_name.has_value())
|
||||
continue;
|
||||
|
||||
for (auto font_face_value : *available_font_faces) {
|
||||
auto& font_face = as<FontFace>(font_face_value.key.as_object());
|
||||
if (font_face.family() != font_family_name)
|
||||
if (font_face.family() != maybe_font_family_name.value())
|
||||
continue;
|
||||
|
||||
matched_font_faces->set_add(font_face_value.key);
|
||||
|
||||
Reference in New Issue
Block a user