style: Make a wrapper struct for extra matching data

No behavior change but we're about to add some extra field to it.

Differential Revision: https://phabricator.services.mozilla.com/D159850
This commit is contained in:
Emilio Cobos Álvarez 2022-10-20 14:24:35 +00:00 committed by Martin Robinson
parent b89c2be4bd
commit a62f6c78b2
3 changed files with 13 additions and 6 deletions

View file

@ -17,6 +17,7 @@ use style_traits::dom::DocumentState;
/// A struct holding the members necessary to invalidate document state
/// selectors.
#[derive(Debug)]
pub struct InvalidationMatchingData {
/// The document state that has changed, which makes it always match.
pub document_state: DocumentState,
@ -43,7 +44,7 @@ impl<'a, E: TElement, I> DocumentStateInvalidationProcessor<'a, E, I> {
/// Creates a new DocumentStateInvalidationProcessor.
#[inline]
pub fn new(rules: I, document_states_changed: DocumentState, quirks_mode: QuirksMode) -> Self {
let mut matching_context = MatchingContext::new_for_visited(
let mut matching_context = MatchingContext::<'a, E::Impl>::new_for_visited(
MatchingMode::Normal,
None,
None,
@ -52,9 +53,7 @@ impl<'a, E: TElement, I> DocumentStateInvalidationProcessor<'a, E, I> {
NeedsSelectorFlags::No,
);
matching_context.extra_data = InvalidationMatchingData {
document_state: document_states_changed,
};
matching_context.extra_data.invalidation_data.document_state = document_states_changed;
Self {
rules,