aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/stylesheet_set.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-08-22 15:13:18 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-08-23 09:26:22 +0200
commit029ab24671bf4aad29d8759e65ac65b05323f4dd (patch)
treef503887780e8bd443b59d7c3e5f5ff782e85b5f7 /components/style/stylesheet_set.rs
parente1517d62af779b6760467a9ba91865bb8d2aff65 (diff)
downloadservo-029ab24671bf4aad29d8759e65ac65b05323f4dd.tar.gz
servo-029ab24671bf4aad29d8759e65ac65b05323f4dd.zip
style: Add a no-op constructor of StyleSheetEntry, in preparation for more changes.
MozReview-Commit-ID: 6Kz0S7YYmFC Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
Diffstat (limited to 'components/style/stylesheet_set.rs')
-rw-r--r--components/style/stylesheet_set.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/components/style/stylesheet_set.rs b/components/style/stylesheet_set.rs
index 4158cf0b796..82872d4473f 100644
--- a/components/style/stylesheet_set.rs
+++ b/components/style/stylesheet_set.rs
@@ -14,13 +14,22 @@ use stylesheets::{Origin, OriginSet, StylesheetInDocument};
/// Entry for a StylesheetSet. We don't bother creating a constructor, because
/// there's no sensible defaults for the member variables.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
-pub struct StylesheetSetEntry<S>
+struct StylesheetSetEntry<S>
where
S: StylesheetInDocument + PartialEq + 'static,
{
sheet: S,
}
+impl<S> StylesheetSetEntry<S>
+where
+ S: StylesheetInDocument + PartialEq + 'static,
+{
+ fn new(sheet: S) -> Self {
+ Self { sheet }
+ }
+}
+
/// A iterator over the stylesheets of a list of entries in the StylesheetSet.
#[derive(Clone)]
pub struct StylesheetIterator<'a, S>(slice::Iter<'a, StylesheetSetEntry<S>>)
@@ -119,7 +128,7 @@ where
debug!("StylesheetSet::append_stylesheet");
self.remove_stylesheet_if_present(&sheet);
self.collect_invalidations_for(device, &sheet, guard);
- self.entries.push(StylesheetSetEntry { sheet });
+ self.entries.push(StylesheetSetEntry::new(sheet));
}
/// Prepend a new stylesheet to the current set.
@@ -132,7 +141,7 @@ where
debug!("StylesheetSet::prepend_stylesheet");
self.remove_stylesheet_if_present(&sheet);
self.collect_invalidations_for(device, &sheet, guard);
- self.entries.insert(0, StylesheetSetEntry { sheet });
+ self.entries.insert(0, StylesheetSetEntry::new(sheet));
}
/// Insert a given stylesheet before another stylesheet in the document.
@@ -149,7 +158,7 @@ where
entry.sheet == before_sheet
}).expect("`before_sheet` stylesheet not found");
self.collect_invalidations_for(device, &sheet, guard);
- self.entries.insert(index, StylesheetSetEntry { sheet });
+ self.entries.insert(index, StylesheetSetEntry::new(sheet));
}
/// Remove a given stylesheet from the set.