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>
This commit is contained in:
Emilio Cobos Álvarez 2017-08-22 15:13:18 +02:00
parent e1517d62af
commit 029ab24671
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -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.