diff --git a/components/style/dom_apis.rs b/components/style/dom_apis.rs index 5a096dac1a6..c1aafed6b74 100644 --- a/components/style/dom_apis.rs +++ b/components/style/dom_apis.rs @@ -133,6 +133,8 @@ where Q: SelectorQuery, Q::Output: 'a, { + fn light_tree_only(&self) -> bool { true } + fn collect_invalidations( &mut self, element: E, diff --git a/components/style/invalidation/element/invalidator.rs b/components/style/invalidation/element/invalidator.rs index 6d29f9b273b..79052a31f9e 100644 --- a/components/style/invalidation/element/invalidator.rs +++ b/components/style/invalidation/element/invalidator.rs @@ -24,6 +24,11 @@ where /// that would originate it. fn invalidates_on_eager_pseudo_element(&self) -> bool { false } + /// Whether the invalidation processor only cares about light-tree + /// descendants of a given element, that is, doesn't invalidate + /// pseudo-elements, NAC, or XBL anon content. + fn light_tree_only(&self) -> bool { false } + /// The matching context that should be used to process invalidations. fn matching_context(&mut self) -> &mut MatchingContext<'a, E::Impl>; @@ -460,6 +465,11 @@ where } } + if self.processor.light_tree_only() { + let node = self.element.as_node(); + return self.invalidate_dom_descendants_of(node, invalidations); + } + let mut any_descendant = false; if let Some(anon_content) = self.element.xbl_binding_anonymous_content() {