LibGfx+LibWeb: Store Typeface and Font-related types in RefPtr to const

This commit is contained in:
Andrew Kaster 2025-04-15 15:48:14 -06:00 committed by Andrew Kaster
parent ffd0259bef
commit be2dd91289
Notes: github-actions[bot] 2025-04-16 16:44:15 +00:00
13 changed files with 28 additions and 28 deletions

View file

@ -229,7 +229,7 @@ void FontLoader::resource_did_load_or_fail()
m_style_computer.did_load_font(m_family_name);
}
RefPtr<Gfx::Font> FontLoader::font_with_point_size(float point_size)
RefPtr<Gfx::Font const> FontLoader::font_with_point_size(float point_size)
{
if (!m_vector_font) {
if (!resource())
@ -261,7 +261,7 @@ void FontLoader::start_loading_next_url()
set_resource(ResourceLoader::the().load_resource(Resource::Type::Generic, request));
}
ErrorOr<NonnullRefPtr<Gfx::Typeface>> FontLoader::try_load_font()
ErrorOr<NonnullRefPtr<Gfx::Typeface const>> FontLoader::try_load_font()
{
// FIXME: This could maybe use the format() provided in @font-face as well, since often the mime type is just application/octet-stream and we have to try every format
auto mime_type = MimeSniff::MimeType::parse(resource()->mime_type());
@ -295,7 +295,7 @@ struct StyleComputer::MatchingFontCandidate {
[[nodiscard]] RefPtr<Gfx::FontCascadeList const> font_with_point_size(float point_size) const
{
RefPtr<Gfx::FontCascadeList> font_list = Gfx::FontCascadeList::create();
auto font_list = Gfx::FontCascadeList::create();
if (auto* loader_list = loader_or_typeface.get_pointer<FontLoaderList*>(); loader_list) {
for (auto const& loader : **loader_list) {
if (auto font = loader->font_with_point_size(point_size); font)