LibWeb: Cache the font in StyleComputer::initial_font()

This function is bogus, but it's still getting called a lot during media
query evaluation, so let's at least cache the font instead of recreating
it every single time.
This commit is contained in:
Andreas Kling 2025-06-11 12:13:29 +02:00 committed by Andreas Kling
parent 07ff75bbec
commit ea0bfda1b9
Notes: github-actions[bot] 2025-06-11 14:26:40 +00:00

View file

@ -2232,7 +2232,8 @@ void StyleComputer::compute_font(ComputedProperties& style, DOM::Element const*
Gfx::Font const& StyleComputer::initial_font() const
{
// FIXME: This is not correct.
return ComputedProperties::font_fallback(false, false, 12);
static auto font = ComputedProperties::font_fallback(false, false, 12);
return font;
}
void StyleComputer::absolutize_values(ComputedProperties& style, GC::Ptr<DOM::Element const> element) const