mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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
This commit is contained in:
parent
5c0897c8eb
commit
ff8100d396
9 changed files with 91 additions and 6 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue