mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 22:30:31 +00:00
LibWeb: Limit sibling style invalidation by max distance
If an element is affected only by selectors using the direct sibling combinator `+`, we can calculate the maximum invalidation distance and use it to limit style invalidation. For example, the selector `.a + .b + .c` has a maximum invalidation distance of 2, meaning we can skip invalidating any element affected by this selector if it's more than two siblings away from the element that triggered the style invalidation. This change results in visible performance improvement when hovering PR list on GitHub.
This commit is contained in:
parent
46abdd1126
commit
84ecaaa75c
Notes:
github-actions[bot]
2025-03-10 17:57:49 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 84ecaaa75c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3891
6 changed files with 61 additions and 10 deletions
|
@ -271,12 +271,15 @@ public:
|
|||
bool can_use_fast_matches() const { return m_can_use_fast_matches; }
|
||||
bool can_use_ancestor_filter() const { return m_can_use_ancestor_filter; }
|
||||
|
||||
size_t sibling_invalidation_distance() const;
|
||||
|
||||
private:
|
||||
explicit Selector(Vector<CompoundSelector>&&);
|
||||
|
||||
Vector<CompoundSelector> m_compound_selectors;
|
||||
mutable Optional<u32> m_specificity;
|
||||
Optional<Selector::PseudoElement> m_pseudo_element;
|
||||
mutable Optional<size_t> m_sibling_invalidation_distance;
|
||||
bool m_can_use_fast_matches { false };
|
||||
bool m_can_use_ancestor_filter { false };
|
||||
bool m_contains_the_nesting_selector { false };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue