aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/invalidation/element/state_and_attributes.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2023-08-12 00:26:15 +0200
committerMartin Robinson <mrobinson@igalia.com>2023-08-16 17:46:41 +0200
commit4878422c937222fbf696e52ebdc4f3166a0fb9ae (patch)
tree5761039ce7f21460eb0a4c189e37ccbd37e3a810 /components/style/invalidation/element/state_and_attributes.rs
parentdb538456940bc9e0beecbccb3a0e7f8b159b0eeb (diff)
downloadservo-4878422c937222fbf696e52ebdc4f3166a0fb9ae.tar.gz
servo-4878422c937222fbf696e52ebdc4f3166a0fb9ae.zip
style: Simplify selector flags setup even more
In my investigation for bug 1766439, I am digging into why selector matching regressed. It doesn't help that the selector-matching code is instantiated a gazillion times (so there's a ton of copies of the relevant functions). This was needed in the past because we had different ways of setting the selector flags on elements, but I unified that recently and now we only need to either set them or not. That is the kind of thing that MatchingContext is really good for, so pass that instead on MatchingContext creation. Differential Revision: https://phabricator.services.mozilla.com/D145428
Diffstat (limited to 'components/style/invalidation/element/state_and_attributes.rs')
-rw-r--r--components/style/invalidation/element/state_and_attributes.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/components/style/invalidation/element/state_and_attributes.rs b/components/style/invalidation/element/state_and_attributes.rs
index bbb1fb46a80..1d02d52947b 100644
--- a/components/style/invalidation/element/state_and_attributes.rs
+++ b/components/style/invalidation/element/state_and_attributes.rs
@@ -19,8 +19,7 @@ use crate::selector_parser::Snapshot;
use crate::stylesheets::origin::OriginSet;
use crate::{Atom, WeakAtom};
use selectors::attr::CaseSensitivity;
-use selectors::matching::matches_selector;
-use selectors::matching::{MatchingContext, MatchingMode, VisitedHandlingMode};
+use selectors::matching::{matches_selector, MatchingContext, MatchingMode, VisitedHandlingMode, NeedsSelectorFlags};
use selectors::NthIndexCache;
use smallvec::SmallVec;
@@ -67,6 +66,7 @@ impl<'a, 'b: 'a, E: TElement + 'b> StateAndAttrInvalidationProcessor<'a, 'b, E>
Some(nth_index_cache),
VisitedHandlingMode::AllLinksVisitedAndUnvisited,
shared_context.quirks_mode(),
+ NeedsSelectorFlags::No,
);
Self {
@@ -84,7 +84,7 @@ pub fn check_dependency<E, W>(
dependency: &Dependency,
element: &E,
wrapper: &W,
- mut context: &mut MatchingContext<'_, E::Impl>,
+ context: &mut MatchingContext<'_, E::Impl>,
) -> bool
where
E: TElement,
@@ -95,8 +95,7 @@ where
dependency.selector_offset,
None,
element,
- &mut context,
- &mut |_, _| {},
+ context,
);
let matched_then = matches_selector(
@@ -104,8 +103,7 @@ where
dependency.selector_offset,
None,
wrapper,
- &mut context,
- &mut |_, _| {},
+ context,
);
matched_then != matches_now