mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: Make the SelectorMap API slightly nicer.
This commit is contained in:
parent
52f962c387
commit
7861ec1d5b
3 changed files with 7 additions and 7 deletions
|
@ -341,7 +341,7 @@ where
|
||||||
self.quirks_mode,
|
self.quirks_mode,
|
||||||
self.removed_id,
|
self.removed_id,
|
||||||
self.classes_removed,
|
self.classes_removed,
|
||||||
&mut |dependency| {
|
|dependency| {
|
||||||
self.scan_dependency(dependency, VisitedDependent::No);
|
self.scan_dependency(dependency, VisitedDependent::No);
|
||||||
true
|
true
|
||||||
},
|
},
|
||||||
|
@ -358,7 +358,7 @@ where
|
||||||
self.quirks_mode,
|
self.quirks_mode,
|
||||||
self.removed_id,
|
self.removed_id,
|
||||||
self.classes_removed,
|
self.classes_removed,
|
||||||
&mut |dependency| {
|
|dependency| {
|
||||||
if !dependency.state.intersects(state_changes) {
|
if !dependency.state.intersects(state_changes) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,7 @@ impl<T: SelectorMapEntry> SelectorMap<T> {
|
||||||
/// FIXME(bholley) This overlaps with SelectorMap<Rule>::get_all_matching_rules,
|
/// FIXME(bholley) This overlaps with SelectorMap<Rule>::get_all_matching_rules,
|
||||||
/// but that function is extremely hot and I'd rather not rearrange it.
|
/// but that function is extremely hot and I'd rather not rearrange it.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn lookup<'a, E, F>(&'a self, element: E, quirks_mode: QuirksMode, f: &mut F) -> bool
|
pub fn lookup<'a, E, F>(&'a self, element: E, quirks_mode: QuirksMode, mut f: F) -> bool
|
||||||
where
|
where
|
||||||
E: TElement,
|
E: TElement,
|
||||||
F: FnMut(&'a T) -> bool
|
F: FnMut(&'a T) -> bool
|
||||||
|
@ -361,14 +361,14 @@ impl<T: SelectorMapEntry> SelectorMap<T> {
|
||||||
quirks_mode: QuirksMode,
|
quirks_mode: QuirksMode,
|
||||||
additional_id: Option<&Atom>,
|
additional_id: Option<&Atom>,
|
||||||
additional_classes: &[Atom],
|
additional_classes: &[Atom],
|
||||||
f: &mut F,
|
mut f: F,
|
||||||
) -> bool
|
) -> bool
|
||||||
where
|
where
|
||||||
E: TElement,
|
E: TElement,
|
||||||
F: FnMut(&'a T) -> bool
|
F: FnMut(&'a T) -> bool
|
||||||
{
|
{
|
||||||
// Do the normal lookup.
|
// Do the normal lookup.
|
||||||
if !self.lookup(element, quirks_mode, f) {
|
if !self.lookup(element, quirks_mode, |entry| f(entry)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1475,7 +1475,7 @@ impl Stylist {
|
||||||
data.selectors_for_cache_revalidation.lookup(
|
data.selectors_for_cache_revalidation.lookup(
|
||||||
element,
|
element,
|
||||||
self.quirks_mode,
|
self.quirks_mode,
|
||||||
&mut |selector_and_hashes| {
|
|selector_and_hashes| {
|
||||||
results.push(matches_selector(
|
results.push(matches_selector(
|
||||||
&selector_and_hashes.selector,
|
&selector_and_hashes.selector,
|
||||||
selector_and_hashes.selector_offset,
|
selector_and_hashes.selector_offset,
|
||||||
|
@ -1493,7 +1493,7 @@ impl Stylist {
|
||||||
stylist.cascade_data.author.selectors_for_cache_revalidation.lookup(
|
stylist.cascade_data.author.selectors_for_cache_revalidation.lookup(
|
||||||
element,
|
element,
|
||||||
stylist.quirks_mode,
|
stylist.quirks_mode,
|
||||||
&mut |selector_and_hashes| {
|
|selector_and_hashes| {
|
||||||
results.push(matches_selector(
|
results.push(matches_selector(
|
||||||
&selector_and_hashes.selector,
|
&selector_and_hashes.selector,
|
||||||
selector_and_hashes.selector_offset,
|
selector_and_hashes.selector_offset,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue