mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-30 13:19:47 +00:00
LibWeb: Skip pending :has() invalidations if there are no :has()
`invalidate_style()` already tries to avoid scheduling invalidation for `:has()` by checking result of `may_have_has_selectors()`, but it might still result in unnecessary work because `may_have_has_selectors()` does not force building of rules cache. This change adds `have_has_selectors()` that forces building of rules cache and is invoked in `update_style()` to double-check whether we actually need to process scheduled `:has()` invalidations. This allows to skip ~100000 ancestor traversals on this WPT test: https://wpt.live/html/select/options-length-too-large.html
This commit is contained in:
committed by
Andreas Kling
parent
90ba4b16c2
commit
875a7141a3
@@ -3172,4 +3172,10 @@ bool StyleComputer::may_have_has_selectors() const
|
||||
return m_selector_insights->has_has_selectors;
|
||||
}
|
||||
|
||||
bool StyleComputer::have_has_selectors() const
|
||||
{
|
||||
build_rule_cache_if_needed();
|
||||
return m_selector_insights->has_has_selectors;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user