mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Semantics for ProtectedHashMap.
MozReview-Commit-ID: K0m65uZi7iw
This commit is contained in:
parent
e2c0ca5110
commit
98f370130d
9 changed files with 311 additions and 8 deletions
|
@ -1870,6 +1870,32 @@ 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
|
||||
|
@ -1933,6 +1959,7 @@ 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) => {
|
||||
|
@ -1969,8 +1996,11 @@ impl CascadeData {
|
|||
None => &mut self.element_map,
|
||||
Some(pseudo) => {
|
||||
self.pseudos_map
|
||||
.get_or_insert_with(&pseudo.canonical(), || Box::new(SelectorMap::new()))
|
||||
.expect("Unexpected tree pseudo-element?")
|
||||
.get_or_insert_with(&pseudo.canonical(), || {
|
||||
let mut map = Box::new(SelectorMap::new());
|
||||
map.begin_mutation();
|
||||
map
|
||||
}).expect("Unexpected tree pseudo-element?")
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2064,6 +2094,7 @@ impl CascadeData {
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
self.end_mutation(&rebuild_kind);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue