mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-16 15:30:09 +00:00
LibWeb: Avoid full tree traversal for non-subject :has()
invalidation
Instead of checking all elements in a document for containment in `:has()` invalidation set, we could narrow this down to ancestors and ancestor siblings, like we already do for subject `:has()` invalidation. This change brings great improvement on GitHub that has selectors with non-subject `:has()` and sibling combinators (e.g., `.a:has(.b) ~ .c`) which prior to this change meant style invalidation for whole document.
This commit is contained in:
parent
604400f758
commit
327dc8e82a
Notes:
github-actions[bot]
2025-02-13 15:25:48 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 327dc8e82a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3552
6 changed files with 42 additions and 54 deletions
|
@ -428,9 +428,14 @@ public:
|
|||
bool matches_link_pseudo_class() const;
|
||||
bool matches_local_link_pseudo_class() const;
|
||||
|
||||
void invalidate_style_if_affected_by_has();
|
||||
|
||||
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; }
|
||||
|
||||
bool affected_by_has_pseudo_class_in_non_subject_position() const { return m_affected_by_has_pseudo_class_in_non_subject_position; }
|
||||
void set_affected_by_has_pseudo_class_in_non_subject_position(bool value) { m_affected_by_has_pseudo_class_in_non_subject_position = value; }
|
||||
|
||||
bool affected_by_has_pseudo_class_with_relative_selector_that_has_sibling_combinator() const { return m_affected_by_has_pseudo_class_with_relative_selector_that_has_sibling_combinator; }
|
||||
void set_affected_by_has_pseudo_class_with_relative_selector_that_has_sibling_combinator(bool value) { m_affected_by_has_pseudo_class_with_relative_selector_that_has_sibling_combinator = value; }
|
||||
|
||||
|
@ -539,6 +544,7 @@ private:
|
|||
bool m_rendered_in_top_layer : 1 { false };
|
||||
bool m_style_uses_css_custom_properties { false };
|
||||
bool m_affected_by_has_pseudo_class_in_subject_position : 1 { false };
|
||||
bool m_affected_by_has_pseudo_class_in_non_subject_position : 1 { false };
|
||||
bool m_affected_by_sibling_combinator : 1 { false };
|
||||
bool m_affected_by_first_or_last_child_pseudo_class : 1 { false };
|
||||
bool m_affected_by_nth_child_pseudo_class : 1 { false };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue