From 644b502b0d409f85423c1ae164d1cc106ddf0f89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 22 Oct 2017 13:11:18 +0200 Subject: [PATCH] style: Ensure QuerySelector only processes the light tree. MozReview-Commit-ID: 7Nw1SEuWNaC --- components/style/dom_apis.rs | 2 ++ components/style/invalidation/element/invalidator.rs | 10 ++++++++++ 2 files changed, 12 insertions(+) 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() {