aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/selector_parser.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2023-06-06 23:27:20 +0200
committerOriol Brufau <obrufau@igalia.com>2023-06-09 10:22:25 +0200
commitfcc55f2156132efeb7d127a3559d5687f4e8945d (patch)
tree5c0484349b7618f8bce967e17f92b332acaf7af7 /components/style/selector_parser.rs
parentf9610e5898ee3474ad91720bc43540165e56cacd (diff)
downloadservo-fcc55f2156132efeb7d127a3559d5687f4e8945d.tar.gz
servo-fcc55f2156132efeb7d127a3559d5687f4e8945d.zip
style: Shrink maps if needed after stylist rebuilds
Hashbrown grows a lot sometimes making us waste a lot of memory. Shrink some of these maps after CascadeData rebuild / stylesheet collection invalidation. Differential Revision: https://phabricator.services.mozilla.com/D134716
Diffstat (limited to 'components/style/selector_parser.rs')
-rw-r--r--components/style/selector_parser.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/components/style/selector_parser.rs b/components/style/selector_parser.rs
index d28e333da04..f29cab9735d 100644
--- a/components/style/selector_parser.rs
+++ b/components/style/selector_parser.rs
@@ -170,9 +170,14 @@ impl<T> PerPseudoElementMap<T> {
}
/// Get an iterator for the entries.
- pub fn iter(&self) -> ::std::slice::Iter<Option<T>> {
+ pub fn iter(&self) -> std::slice::Iter<Option<T>> {
self.entries.iter()
}
+
+ /// Get a mutable iterator for the entries.
+ pub fn iter_mut(&mut self) -> std::slice::IterMut<Option<T>> {
+ self.entries.iter_mut()
+ }
}
/// Values for the :dir() pseudo class