aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/stylesheet_set.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/style/stylesheet_set.rs')
-rw-r--r--components/style/stylesheet_set.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/components/style/stylesheet_set.rs b/components/style/stylesheet_set.rs
index 15bbf285a69..8c66d51c3b0 100644
--- a/components/style/stylesheet_set.rs
+++ b/components/style/stylesheet_set.rs
@@ -137,6 +137,23 @@ impl StylesheetSet {
guard)
}
+ /// Update the sheet that matches the unique_id.
+ pub fn update_stylesheet(
+ &mut self,
+ sheet: &Arc<Stylesheet>,
+ unique_id: u64)
+ {
+ // Since this function doesn't set self.dirty, or call
+ // self.invalidations.collect_invalidations_for, it should
+ // only be called in the case where sheet is a clone of
+ // the sheet it is updating.
+ debug!("StylesheetSet::update_stylesheet");
+ if let Some(entry) = self.entries.iter_mut().find(
+ |e| e.unique_id == unique_id) {
+ entry.sheet = sheet.clone();
+ }
+ }
+
/// Remove a given stylesheet from the set.
pub fn remove_stylesheet(&mut self, unique_id: u64) {
debug!("StylesheetSet::remove_stylesheet");