aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/traversal.rs
diff options
context:
space:
mode:
authorDavid Shin <dshin@mozilla.com>2023-05-25 14:35:18 +0000
committerMartin Robinson <mrobinson@igalia.com>2023-11-24 08:57:14 +0100
commitff8100d3963ac88fa0001bec40472134dbb4394b (patch)
tree7f6485012d046f07afd2cc7eda7f8b44b8a214c6 /components/style/traversal.rs
parent5c0897c8eb6ef789dd14918b9b427935a244a847 (diff)
downloadservo-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/style/traversal.rs')
-rw-r--r--components/style/traversal.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/components/style/traversal.rs b/components/style/traversal.rs
index 5102a5d1751..19329d9f517 100644
--- a/components/style/traversal.rs
+++ b/components/style/traversal.rs
@@ -222,7 +222,10 @@ pub trait DomTraversal<E: TElement>: Sync {
if traversal_flags.for_animation_only() {
return data.map_or(false, |d| d.has_styles()) &&
(el.has_animation_only_dirty_descendants() ||
- data.as_ref().unwrap().hint.has_animation_hint_or_recascade());
+ data.as_ref()
+ .unwrap()
+ .hint
+ .has_animation_hint_or_recascade());
}
// Non-incremental layout visits every node.
@@ -420,7 +423,8 @@ pub fn recalc_style_at<E, D, F>(
// Compute style for this element if necessary.
if let Some(restyle_kind) = restyle_kind {
- child_restyle_requirement = compute_style(traversal_data, context, element, data, restyle_kind);
+ child_restyle_requirement =
+ compute_style(traversal_data, context, element, data, restyle_kind);
if !element.matches_user_and_content_rules() {
// We must always cascade native anonymous subtrees, since they