mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
parent
d6bafde971
commit
b118ba72d0
11 changed files with 70 additions and 298 deletions
|
@ -479,6 +479,12 @@ impl Stylist {
|
|||
.map(|(d, _)| d.selectors_for_cache_revalidation.len()).sum()
|
||||
}
|
||||
|
||||
/// Returns the number of entries in invalidation maps.
|
||||
pub fn num_invalidations(&self) -> usize {
|
||||
self.cascade_data.iter_origins()
|
||||
.map(|(d, _)| d.invalidation_map.len()).sum()
|
||||
}
|
||||
|
||||
/// Invokes `f` with the `InvalidationMap` for each origin.
|
||||
///
|
||||
/// NOTE(heycam) This might be better as an `iter_invalidation_maps`, once
|
||||
|
@ -1906,32 +1912,6 @@ impl CascadeData {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
fn begin_mutation(&mut self, rebuild_kind: &SheetRebuildKind) {
|
||||
self.element_map.begin_mutation();
|
||||
self.pseudos_map.for_each(|m| m.begin_mutation());
|
||||
if rebuild_kind.should_rebuild_invalidation() {
|
||||
self.invalidation_map.begin_mutation();
|
||||
self.selectors_for_cache_revalidation.begin_mutation();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
fn begin_mutation(&mut self, _: &SheetRebuildKind) {}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
fn end_mutation(&mut self, rebuild_kind: &SheetRebuildKind) {
|
||||
self.element_map.end_mutation();
|
||||
self.pseudos_map.for_each(|m| m.end_mutation());
|
||||
if rebuild_kind.should_rebuild_invalidation() {
|
||||
self.invalidation_map.end_mutation();
|
||||
self.selectors_for_cache_revalidation.end_mutation();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
fn end_mutation(&mut self, _: &SheetRebuildKind) {}
|
||||
|
||||
/// Collects all the applicable media query results into `results`.
|
||||
///
|
||||
/// This duplicates part of the logic in `add_stylesheet`, which is
|
||||
|
@ -1995,7 +1975,6 @@ impl CascadeData {
|
|||
self.effective_media_query_results.saw_effective(stylesheet);
|
||||
}
|
||||
|
||||
self.begin_mutation(&rebuild_kind);
|
||||
for rule in stylesheet.effective_rules(device, guard) {
|
||||
match *rule {
|
||||
CssRule::Style(ref locked) => {
|
||||
|
@ -2026,11 +2005,7 @@ impl CascadeData {
|
|||
None => &mut self.element_map,
|
||||
Some(pseudo) => {
|
||||
self.pseudos_map
|
||||
.get_or_insert_with(&pseudo.canonical(), || {
|
||||
let mut map = Box::new(SelectorMap::new());
|
||||
map.begin_mutation();
|
||||
map
|
||||
})
|
||||
.get_or_insert_with(&pseudo.canonical(), || Box::new(SelectorMap::new()))
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2125,7 +2100,6 @@ impl CascadeData {
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
self.end_mutation(&rebuild_kind);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue