From fca07a64a818f7eb3ee26fe17a537fe0a21a3c3a 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 :^) (cherry picked from commit 28388f1fd24c0019d2c4be7900584c6c536527ad) --- Userland/Libraries/LibWeb/CSS/StyleComputer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index a3204cfd4181eb..dace2941e0b987 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -170,7 +170,8 @@ void FontLoader::resource_did_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);