diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-04-19 04:20:31 +0000 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-05-07 12:55:26 +0200 |
commit | c0b17cc84406e51549955d46b225277a14495e23 (patch) | |
tree | d97459f0986b23f2043af5243beb5834644b72e2 /components/style/stylesheet_set.rs | |
parent | 098eb300ac759a4db5cdedae0c9db1c5c005538c (diff) | |
download | servo-c0b17cc84406e51549955d46b225277a14495e23.tar.gz servo-c0b17cc84406e51549955d46b225277a14495e23.zip |
style: Don't keep two list of stylesheets in ServoStyleSet.
Just one set of stylesheets is enough. While at it, unify SheetType and Origin.
Differential Revision: https://phabricator.services.mozilla.com/D27564
Diffstat (limited to 'components/style/stylesheet_set.rs')
-rw-r--r-- | components/style/stylesheet_set.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/components/style/stylesheet_set.rs b/components/style/stylesheet_set.rs index d2c3ad0f88e..5e72f7a219f 100644 --- a/components/style/stylesheet_set.rs +++ b/components/style/stylesheet_set.rs @@ -468,7 +468,14 @@ where .fold(0, |s, (item, _)| s + item.len()) } + /// Returns the count of stylesheets for a given origin. + #[inline] + pub fn sheet_count(&self, origin: Origin) -> usize { + self.collections.borrow_for_origin(&origin).len() + } + /// Returns the `index`th stylesheet in the set for the given origin. + #[inline] pub fn get(&self, origin: Origin, index: usize) -> Option<&S> { self.collections.borrow_for_origin(&origin).get(index) } |