mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Make MatchingContext generic over SelectorImpl.
This will help Xidorn implement tree pseudos, and in general makes sense, allowing to put specific matching data in a selectors implementation.
This commit is contained in:
parent
4cf2ce66fc
commit
b0e54968ec
9 changed files with 121 additions and 85 deletions
|
@ -162,17 +162,20 @@ impl SelectorMap<Rule> {
|
|||
///
|
||||
/// Extract matching rules as per element's ID, classes, tag name, etc..
|
||||
/// Sort the Rules at the end to maintain cascading order.
|
||||
pub fn get_all_matching_rules<E, V, F>(&self,
|
||||
element: &E,
|
||||
rule_hash_target: &E,
|
||||
matching_rules_list: &mut V,
|
||||
context: &mut MatchingContext,
|
||||
quirks_mode: QuirksMode,
|
||||
flags_setter: &mut F,
|
||||
cascade_level: CascadeLevel)
|
||||
where E: TElement,
|
||||
V: VecLike<ApplicableDeclarationBlock>,
|
||||
F: FnMut(&E, ElementSelectorFlags),
|
||||
pub fn get_all_matching_rules<E, V, F>(
|
||||
&self,
|
||||
element: &E,
|
||||
rule_hash_target: &E,
|
||||
matching_rules_list: &mut V,
|
||||
context: &mut MatchingContext<E::Impl>,
|
||||
quirks_mode: QuirksMode,
|
||||
flags_setter: &mut F,
|
||||
cascade_level: CascadeLevel,
|
||||
)
|
||||
where
|
||||
E: TElement,
|
||||
V: VecLike<ApplicableDeclarationBlock>,
|
||||
F: FnMut(&E, ElementSelectorFlags),
|
||||
{
|
||||
if self.is_empty() {
|
||||
return
|
||||
|
@ -223,15 +226,18 @@ impl SelectorMap<Rule> {
|
|||
}
|
||||
|
||||
/// Adds rules in `rules` that match `element` to the `matching_rules` list.
|
||||
fn get_matching_rules<E, V, F>(element: &E,
|
||||
rules: &[Rule],
|
||||
matching_rules: &mut V,
|
||||
context: &mut MatchingContext,
|
||||
flags_setter: &mut F,
|
||||
cascade_level: CascadeLevel)
|
||||
where E: TElement,
|
||||
V: VecLike<ApplicableDeclarationBlock>,
|
||||
F: FnMut(&E, ElementSelectorFlags),
|
||||
fn get_matching_rules<E, V, F>(
|
||||
element: &E,
|
||||
rules: &[Rule],
|
||||
matching_rules: &mut V,
|
||||
context: &mut MatchingContext<E::Impl>,
|
||||
flags_setter: &mut F,
|
||||
cascade_level: CascadeLevel,
|
||||
)
|
||||
where
|
||||
E: TElement,
|
||||
V: VecLike<ApplicableDeclarationBlock>,
|
||||
F: FnMut(&E, ElementSelectorFlags),
|
||||
{
|
||||
for rule in rules {
|
||||
if matches_selector(&rule.selector,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue