mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
LibWeb: Load fonts from style sheet once when sheet is added
Previously, we were running the "load fonts if needed" machine at the start of every style computation. That was a lot of unnecessary work, especially on sites with lots of style rules, since we had to traverse every style sheet to see if any @font-face rules needed loading. With this patch, we now load fonts once per sheet, right after adding it to a document's style sheet list.
This commit is contained in:
parent
5b72a9cb11
commit
6e70670e0b
3 changed files with 19 additions and 20 deletions
|
@ -13,9 +13,10 @@ void StyleSheetList::add_sheet(NonnullRefPtr<CSSStyleSheet> sheet)
|
|||
{
|
||||
VERIFY(!m_sheets.contains_slow(sheet));
|
||||
sheet->set_style_sheet_list({}, this);
|
||||
m_sheets.append(move(sheet));
|
||||
m_sheets.append(sheet);
|
||||
|
||||
m_document.style_computer().invalidate_rule_cache();
|
||||
m_document.style_computer().load_fonts_from_sheet(*sheet);
|
||||
m_document.invalidate_style();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue