commit 859f65a96951e43a48f80453e7f597e5244e14cc parent cd411dbc377c50d249ad3986c401fd5d1bce60cc Author: Diego Escalante <descalante@mozilla.com> Date: Thu, 30 Oct 2025 02:47:32 +0000 Bug 1995063 - Check if dependencies are at the subject with Selector::is_rightmost instead of selector_offset == 0. r=dshin,firefox-style-system-reviewers Differential Revision: https://phabricator.services.mozilla.com/D270592 Diffstat:
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/servo/components/style/invalidation/element/invalidator.rs b/servo/components/style/invalidation/element/invalidator.rs @@ -355,7 +355,7 @@ impl<'a> Invalidation<'a> { host: Option<OpaqueElement>, scope: Option<OpaqueElement>, ) -> Self { - if dependency.selector_offset == 0 { + if dependency.selector.is_rightmost(dependency.selector_offset) { return Self::new_subject_invalidation(dependency, host, scope); } @@ -1189,7 +1189,7 @@ where invalidation_kind, DependencyInvalidationKind::Normal(NormalDependencyInvalidationKind::Element) ) || (matches!(invalidation_kind, DependencyInvalidationKind::Scope(_)) - && cur_dependency.selector_offset == 0) + && cur_dependency.selector.is_rightmost(cur_dependency.selector_offset)) { // Add to dependency stack to process its next dependencies. to_process.push(cur_dependency); @@ -1429,7 +1429,7 @@ pub fn note_scope_dependency_force_at_subject<'selectors>( let mut invalidations: Vec<Invalidation> = Vec::new(); if let Some(next) = dependency.next.as_ref() { for dep in next.slice() { - if dep.selector_offset == 0 && !traversed_non_subject { + if dep.selector.is_rightmost(dep.selector_offset) && !traversed_non_subject { continue; } diff --git a/servo/components/style/invalidation/element/relative_selector.rs b/servo/components/style/invalidation/element/relative_selector.rs @@ -1123,7 +1123,7 @@ where let invalidation_kind = d.invalidation_kind(); if let DependencyInvalidationKind::Scope(scope_kind) = invalidation_kind { - if d.selector_offset == 0 { + if d.selector.is_rightmost(d.selector_offset) { if scope_kind == ScopeDependencyInvalidationKind::ScopeEnd { let invalidations = note_scope_dependency_force_at_subject( d, diff --git a/servo/components/style/invalidation/element/state_and_attributes.rs b/servo/components/style/invalidation/element/state_and_attributes.rs @@ -607,7 +607,7 @@ where } } - if dependency.selector_offset == 0 { + if dependency.selector.is_rightmost(dependency.selector_offset) { let force_add = any_next_has_scope_in_negation(dependency); if scope_kind == ScopeDependencyInvalidationKind::ScopeEnd || force_add { let invalidations = note_scope_dependency_force_at_subject(