mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-18 00:09:44 +00:00
LibWeb: Use invalidation sets for :has() invalidation
Prior to this change, we invalidated all elements in the document if it used any selectors with :has(). This change aims to improve that by applying a combination of techniques: - Collect metadata for each element if it was matched against a selector with :has() in the subject position. This is needed to invalidate all elements that could be affected by selectors like `div:has(.a:empty)` because they are not covered by the invalidation sets. - Use invalidation sets to invalidate elements that are affected by selectors with :has() in a non-subject position. Selectors like `.a:has(.b) + .c` still cause whole-document invalidation because invalidation sets cover only descendants, not siblings. As a result, there is no performance improvement on github.com due to this limitation. However, youtube.com and discord.com benefit from this change.
This commit is contained in:
parent
e33037ad52
commit
d762d16938
Notes:
github-actions[bot]
2025-01-29 08:31:17 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: d762d16938
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3391
8 changed files with 56 additions and 9 deletions
|
@ -411,6 +411,9 @@ public:
|
|||
bool has_style_containment() const;
|
||||
bool has_paint_containment() const;
|
||||
|
||||
bool affected_by_has_pseudo_class_in_subject_position() const { return m_affected_by_has_pseudo_class_in_subject_position; }
|
||||
void set_affected_by_has_pseudo_class_in_subject_position(bool value) { m_affected_by_has_pseudo_class_in_subject_position = value; }
|
||||
|
||||
protected:
|
||||
Element(Document&, DOM::QualifiedName);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
@ -500,6 +503,7 @@ private:
|
|||
|
||||
bool m_in_top_layer { false };
|
||||
bool m_style_uses_css_custom_properties { false };
|
||||
bool m_affected_by_has_pseudo_class_in_subject_position { false };
|
||||
|
||||
OwnPtr<CSS::CountersSet> m_counters_set;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue