LibWeb: Dont load a style sheet's fonts until it has an owning document

We need a style sheet to have an owning document to load it's fonts (to
generate a length resolution context).

Fixes #6445
This commit is contained in:
Callum Law 2025-10-16 01:30:31 +13:00 committed by Tim Ledbetter
commit 2af071380e
Notes: github-actions[bot] 2025-10-16 09:28:36 +00:00
5 changed files with 28 additions and 6 deletions

View file

@ -117,7 +117,6 @@ void StyleSheetList::add_sheet(CSSStyleSheet& sheet)
}
document().style_computer().invalidate_rule_cache();
document().style_computer().load_fonts_from_sheet(sheet);
document_or_shadow_root().invalidate_style(DOM::StyleInvalidationReason::StyleSheetListAddSheet);
}
@ -132,7 +131,6 @@ void StyleSheetList::remove_sheet(CSSStyleSheet& sheet)
return;
}
m_document_or_shadow_root->document().style_computer().unload_fonts_from_sheet(sheet);
m_document_or_shadow_root->document().style_computer().invalidate_rule_cache();
document_or_shadow_root().invalidate_style(DOM::StyleInvalidationReason::StyleSheetListRemoveSheet);
}