Revert changes in sheet_set_methods macro

This commit is contained in:
Fernando Jiménez Moreno 2019-03-07 17:33:26 +01:00
parent efbfc0f939
commit 0ca4792dc6

View file

@ -441,12 +441,8 @@ where
/// We could simplify the setup moving invalidations to SheetCollection, but /// We could simplify the setup moving invalidations to SheetCollection, but
/// that would imply not sharing invalidations across origins of the same /// that would imply not sharing invalidations across origins of the same
/// documents, which is slightly annoying. /// documents, which is slightly annoying.
macro_rules! stylesheetset_impl { macro_rules! sheet_set_methods {
($set_name:expr, $set_type:ty) => { ($set_name:expr) => {
impl<S> $set_type
where
S: StylesheetInDocument + PartialEq + 'static,
{
fn collect_invalidations_for( fn collect_invalidations_for(
&mut self, &mut self,
device: Option<&Device>, device: Option<&Device>,
@ -502,7 +498,6 @@ macro_rules! stylesheetset_impl {
let collection = self.collection_for(&sheet, guard); let collection = self.collection_for(&sheet, guard);
collection.remove(&sheet) collection.remove(&sheet)
} }
}
}; };
} }
@ -527,6 +522,8 @@ where
self.collections.borrow_mut_for_origin(&origin) self.collections.borrow_mut_for_origin(&origin)
} }
sheet_set_methods!("DocumentStylesheetSet");
/// Returns the number of stylesheets in the set. /// Returns the number of stylesheets in the set.
pub fn len(&self) -> usize { pub fn len(&self) -> usize {
self.collections self.collections
@ -605,8 +602,6 @@ where
} }
} }
stylesheetset_impl!("DocumentStylesheetSet", DocumentStylesheetSet<S>);
/// The set of stylesheets effective for a given XBL binding or Shadow Root. /// The set of stylesheets effective for a given XBL binding or Shadow Root.
#[derive(MallocSizeOf)] #[derive(MallocSizeOf)]
pub struct AuthorStylesheetSet<S> pub struct AuthorStylesheetSet<S>
@ -671,6 +666,8 @@ where
&mut self.collection &mut self.collection
} }
sheet_set_methods!("AuthorStylesheetSet");
/// Iterate over the list of stylesheets. /// Iterate over the list of stylesheets.
pub fn iter(&self) -> StylesheetCollectionIterator<S> { pub fn iter(&self) -> StylesheetCollectionIterator<S> {
self.collection.iter() self.collection.iter()
@ -702,5 +699,3 @@ where
} }
} }
} }
stylesheetset_impl!("AuthorStylesheetSet", AuthorStylesheetSet<S>);