aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/stylesheet_set.rs
diff options
context:
space:
mode:
authorBrad Werth <bwerth@mozilla.com>2017-06-19 10:23:00 -0700
committerBrad Werth <werth@efn.org>2017-06-20 12:24:39 -0700
commitc617649e679e19a7d65416b693c5444c0e88481e (patch)
tree9d893c0c74e304fe4e75c9f78ba5aa3696075045 /components/style/stylesheet_set.rs
parentb50cf33efd67fe319aaccb94b476d473901c79d8 (diff)
downloadservo-c617649e679e19a7d65416b693c5444c0e88481e.tar.gz
servo-c617649e679e19a7d65416b693c5444c0e88481e.zip
Add an update_stylesheet method to StylesheetSet.
MozReview-Commit-ID: KlRkApYL8wk
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");