mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:17:42 +00:00
LibWeb: Cache the default font if we fail to find the specified font
This is a hack to stop chewing CPU on sites that use a font we don't have and have a lot of text or changes text often. Examples are the Serenity 2nd birthday page and the JS specification.
This commit is contained in:
parent
a5bf6cfff9
commit
4155de2572
1 changed files with 3 additions and 1 deletions
|
@ -174,7 +174,9 @@ void StyleProperties::load_font() const
|
||||||
m_font = Gfx::Font::default_bold_font();
|
m_font = Gfx::Font::default_bold_font();
|
||||||
else
|
else
|
||||||
m_font = Gfx::Font::default_font();
|
m_font = Gfx::Font::default_font();
|
||||||
return;
|
// FIXME: This is a hack to stop chewing CPU on sites that use a font we don't have and have a lot of text
|
||||||
|
// or changes text often. Examples are the Serenity 2nd birthday page and the JS specification.
|
||||||
|
FontCache::the().set({ font_family, font_weight }, *m_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
float StyleProperties::line_height(const LayoutNode& layout_node) const
|
float StyleProperties::line_height(const LayoutNode& layout_node) const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue