From 28388f1fd24c0019d2c4be7900584c6c536527ad Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Fri, 20 Dec 2024 14:54:08 +0000 Subject: [PATCH] LibWeb/CSS: Don't overwrite active font load when requesting a pt size start_loading_next_url() is a no-op if there's a pending resource load, but not if that resource load has successfully loaded already. There is a delay between the font resource loading, and it being processed into a vector font. Calling font_with_point_size() in that gap would previously erase the previously-loaded font, if the font had multiple URLs to choose from. This fixes the icon font on mods.factorio.com :^) --- Libraries/LibWeb/CSS/StyleComputer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Libraries/LibWeb/CSS/StyleComputer.cpp b/Libraries/LibWeb/CSS/StyleComputer.cpp index 963354c0dbd..5b75bb0c99e 100644 --- a/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -228,7 +228,8 @@ void FontLoader::resource_did_load_or_fail() RefPtr FontLoader::font_with_point_size(float point_size) { if (!m_vector_font) { - start_loading_next_url(); + if (!resource()) + start_loading_next_url(); return nullptr; } return m_vector_font->scaled_font(point_size);