mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Hide LocalMatchingContext.
This type is a lot of complexity related to a very specific thing such as the hover and active quirk. Instead of that, move `nesting_level` to `MatchingContext`, and simplify all this computing whether the quirk applies upfront, for each complex selector we test. This is less error-prone, and also allows simplifying more stuff in a bit.
This commit is contained in:
parent
48c85151dc
commit
11485edc9e
7 changed files with 175 additions and 183 deletions
|
@ -102,6 +102,9 @@ pub struct MatchingContext<'a> {
|
|||
/// See https://drafts.csswg.org/selectors-4/#scope-pseudo
|
||||
pub scope_element: Option<OpaqueElement>,
|
||||
|
||||
/// The current nesting level of selectors that we're matching.
|
||||
pub nesting_level: usize,
|
||||
|
||||
quirks_mode: QuirksMode,
|
||||
classes_and_ids_case_sensitivity: CaseSensitivity,
|
||||
}
|
||||
|
@ -140,6 +143,7 @@ impl<'a> MatchingContext<'a> {
|
|||
relevant_link_found: false,
|
||||
classes_and_ids_case_sensitivity: quirks_mode.classes_and_ids_case_sensitivity(),
|
||||
scope_element: None,
|
||||
nesting_level: 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue