mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Only invalidate shadow root when style sheet inside changes
We don't have to invalidate style for the entire document when a style sheet changes inside of a shadow root. To make this possible, StyleSheetList now keeps track of which Document-or-ShadowRoot it corresponds to, instead of just tracking the containing Document. This avoids a lot of style recomputation on pages with lots of shadow DOM content (like GitHub).
This commit is contained in:
parent
e71ed67069
commit
4bc3055c0f
Notes:
github-actions[bot]
2024-08-20 14:11:28 +00:00
Author: https://github.com/awesomekling
Commit: 4bc3055c0f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1139
Reviewed-by: https://github.com/AtkinsSJ
5 changed files with 37 additions and 25 deletions
|
@ -155,7 +155,7 @@ WebIDL::ExceptionOr<unsigned> CSSStyleSheet::insert_rule(StringView rule, unsign
|
|||
|
||||
if (m_style_sheet_list) {
|
||||
m_style_sheet_list->document().style_computer().invalidate_rule_cache();
|
||||
m_style_sheet_list->document().invalidate_style();
|
||||
m_style_sheet_list->document_or_shadow_root().invalidate_style();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ WebIDL::ExceptionOr<void> CSSStyleSheet::delete_rule(unsigned index)
|
|||
if (!result.is_exception()) {
|
||||
if (m_style_sheet_list) {
|
||||
m_style_sheet_list->document().style_computer().invalidate_rule_cache();
|
||||
m_style_sheet_list->document().invalidate_style();
|
||||
m_style_sheet_list->document_or_shadow_root().invalidate_style();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue