diff options
author | David Shin <dshin@mozilla.com> | 2023-05-25 14:35:18 +0000 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2023-11-24 08:57:14 +0100 |
commit | ff8100d3963ac88fa0001bec40472134dbb4394b (patch) | |
tree | 7f6485012d046f07afd2cc7eda7f8b44b8a214c6 /components/selectors/context.rs | |
parent | 5c0897c8eb6ef789dd14918b9b427935a244a847 (diff) | |
download | servo-ff8100d3963ac88fa0001bec40472134dbb4394b.tar.gz servo-ff8100d3963ac88fa0001bec40472134dbb4394b.zip |
style: Correct style sharing handling for any element that considered `:has()` in selector matching
For any element that anchors a `:has()` selector (i.e. Matches a selector that
contains a `:has()` on its rightmost side), we prevent style sharing altogether,
as evaluation of the `:has()` selector is required in the first place to
determine style sharing.
On the other hand, any element matching a rule containing `:has()` without
anchoring it can do style sharing for siblings, but not cousins.
Differential Revision: https://phabricator.services.mozilla.com/D176836
Diffstat (limited to 'components/selectors/context.rs')
-rw-r--r-- | components/selectors/context.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/components/selectors/context.rs b/components/selectors/context.rs index 8abfebbf78a..fc620baa08f 100644 --- a/components/selectors/context.rs +++ b/components/selectors/context.rs @@ -146,6 +146,7 @@ where /// The current element we're anchoring on for evaluating the relative selector. current_relative_selector_anchor: Option<OpaqueElement>, + pub considered_relative_selector: bool, quirks_mode: QuirksMode, needs_selector_flags: NeedsSelectorFlags, @@ -199,6 +200,7 @@ where pseudo_element_matching_fn: None, extra_data: Default::default(), current_relative_selector_anchor: None, + considered_relative_selector: false, _impl: ::std::marker::PhantomData, } } @@ -332,6 +334,7 @@ where self.current_relative_selector_anchor = Some(anchor); let result = self.nest(f); self.current_relative_selector_anchor = original_relative_selector_anchor; + self.considered_relative_selector = true; result } |