style: Rename StylesheetSet to DocumentStylesheetSet. draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 08 Feb 2018 11:55:50 +0100
changeset 752871 0f91743fc541bb1f1efe3ff2c9139d2d7179c6b1
parent 752870 ba743f9fdfa27d348500e4b5366c504e45f8ff86
child 752872 37611524b428b2c599ee0088686d3ed4e7825940
push id98405
push userbmo:emilio@crisal.io
push dateFri, 09 Feb 2018 01:50:06 +0000
milestone60.0a1
style: Rename StylesheetSet to DocumentStylesheetSet. MozReview-Commit-ID: 5Xl1eRLu1VF
servo/components/style/stylesheet_set.rs
servo/components/style/stylist.rs
--- a/servo/components/style/stylesheet_set.rs
+++ b/servo/components/style/stylesheet_set.rs
@@ -365,40 +365,40 @@ where
     /// Returns an iterator over the current list of stylesheets.
     fn iter(&self) -> StylesheetCollectionIterator<S> {
         StylesheetCollectionIterator(self.entries.iter())
     }
 }
 
 /// The set of stylesheets effective for a given document.
 #[cfg_attr(feature = "servo", derive(MallocSizeOf))]
-pub struct StylesheetSet<S>
+pub struct DocumentStylesheetSet<S>
 where
     S: StylesheetInDocument + PartialEq + 'static,
 {
     /// The collections of sheets per each origin.
     collections: PerOrigin<SheetCollection<S>>,
 
     /// The invalidations for stylesheets added or removed from this document.
     invalidations: StylesheetInvalidationSet,
 
     /// The origins whose stylesheets have changed so far.
     origins_dirty: OriginSet,
 
     /// Has author style been disabled?
     author_style_disabled: bool,
 }
 
-impl<S> StylesheetSet<S>
+impl<S> DocumentStylesheetSet<S>
 where
     S: StylesheetInDocument + PartialEq + 'static,
 {
     /// Create a new empty StylesheetSet.
     pub fn new() -> Self {
-        StylesheetSet {
+        Self {
             collections: Default::default(),
             invalidations: StylesheetInvalidationSet::new(),
             origins_dirty: OriginSet::empty(),
             author_style_disabled: false,
         }
     }
 
     /// Returns the number of stylesheets in the set.
@@ -433,45 +433,45 @@ where
     ///
     /// No device implies not computing invalidations.
     pub fn append_stylesheet(
         &mut self,
         device: Option<&Device>,
         sheet: S,
         guard: &SharedRwLockReadGuard
     ) {
-        debug!("StylesheetSet::append_stylesheet");
+        debug!("DocumentStylesheetSet::append_stylesheet");
         self.collect_invalidations_for(device, &sheet, guard);
         let origin = sheet.contents(guard).origin;
         self.collections.borrow_mut_for_origin(&origin).append(sheet);
     }
 
     /// Prepend a new stylesheet to the current set.
     pub fn prepend_stylesheet(
         &mut self,
         device: Option<&Device>,
         sheet: S,
         guard: &SharedRwLockReadGuard
     ) {
-        debug!("StylesheetSet::prepend_stylesheet");
+        debug!("DocumentStylesheetSet::prepend_stylesheet");
         self.collect_invalidations_for(device, &sheet, guard);
 
         let origin = sheet.contents(guard).origin;
         self.collections.borrow_mut_for_origin(&origin).prepend(sheet)
     }
 
     /// Insert a given stylesheet before another stylesheet in the document.
     pub fn insert_stylesheet_before(
         &mut self,
         device: Option<&Device>,
         sheet: S,
         before_sheet: S,
         guard: &SharedRwLockReadGuard,
     ) {
-        debug!("StylesheetSet::insert_stylesheet_before");
+        debug!("DocumentStylesheetSet::insert_stylesheet_before");
         self.collect_invalidations_for(device, &sheet, guard);
 
         let origin = sheet.contents(guard).origin;
         self.collections
             .borrow_mut_for_origin(&origin)
             .insert_before(sheet, &before_sheet)
     }
 
@@ -486,17 +486,17 @@ where
         self.collect_invalidations_for(device, &sheet, guard);
 
         let origin = sheet.contents(guard).origin;
         self.collections.borrow_mut_for_origin(&origin).remove(&sheet)
     }
 
     /// Notes that the author style has been disabled for this document.
     pub fn set_author_style_disabled(&mut self, disabled: bool) {
-        debug!("StylesheetSet::set_author_style_disabled");
+        debug!("DocumentStylesheetSet::set_author_style_disabled");
         if self.author_style_disabled == disabled {
             return;
         }
         self.author_style_disabled = disabled;
         self.invalidations.invalidate_fully();
         self.origins_dirty |= Origin::Author;
     }
 
@@ -512,17 +512,17 @@ where
         document_element: Option<E>,
         snapshots: Option<&SnapshotMap>,
     ) -> StylesheetFlusher<'a, S>
     where
         E: TElement,
     {
         use std::mem;
 
-        debug!("StylesheetSet::flush");
+        debug!("DocumentStylesheetSet::flush");
 
         let had_invalidations =
             self.invalidations.flush(document_element, snapshots);
 
         let origins_dirty =
             mem::replace(&mut self.origins_dirty, OriginSet::empty());
 
         let mut origin_data_validity = PerOrigin::<OriginValidity>::default();
@@ -541,17 +541,17 @@ where
         }
     }
 
     /// Flush stylesheets, but without running any of the invalidation passes.
     #[cfg(feature = "servo")]
     pub fn flush_without_invalidation(&mut self) -> OriginSet {
         use std::mem;
 
-        debug!("StylesheetSet::flush_without_invalidation");
+        debug!("DocumentStylesheetSet::flush_without_invalidation");
 
         self.invalidations.clear();
         mem::replace(&mut self.origins_dirty, OriginSet::empty())
     }
 
     /// Return an iterator over the flattened view of all the stylesheets.
     pub fn iter(&self) -> StylesheetIterator<S> {
         StylesheetIterator {
--- a/servo/components/style/stylist.rs
+++ b/servo/components/style/stylist.rs
@@ -36,17 +36,17 @@ use selectors::parser::{SelectorIter, Vi
 use selectors::visitor::SelectorVisitor;
 use servo_arc::{Arc, ArcBorrow};
 use shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
 use smallbitvec::SmallBitVec;
 use smallvec::SmallVec;
 use std::ops;
 use std::sync::Mutex;
 use style_traits::viewport::ViewportConstraints;
-use stylesheet_set::{OriginValidity, SheetRebuildKind, StylesheetSet, StylesheetFlusher};
+use stylesheet_set::{OriginValidity, SheetRebuildKind, DocumentStylesheetSet, StylesheetFlusher};
 #[cfg(feature = "gecko")]
 use stylesheets::{CounterStyleRule, FontFaceRule, FontFeatureValuesRule, PageRule};
 use stylesheets::{CssRule, Origin, OriginSet, PerOrigin, PerOriginIter};
 use stylesheets::StyleRule;
 use stylesheets::StylesheetInDocument;
 use stylesheets::keyframes_rule::KeyframesAnimation;
 use stylesheets::viewport_rule::{self, MaybeNew, ViewportRule};
 use thread_state::{self, ThreadState};
@@ -323,31 +323,31 @@ impl DocumentCascadeData {
     /// Measures heap usage.
     #[cfg(feature = "gecko")]
     pub fn add_size_of(&self, ops: &mut MallocSizeOfOps, sizes: &mut ServoStyleSetSizes) {
         self.user.add_size_of(ops, sizes);
         self.author.add_size_of(ops, sizes);
     }
 }
 
-/// A wrapper over a StylesheetSet that can be `Sync`, since it's only used and
-/// exposed via mutable methods in the `Stylist`.
+/// A wrapper over a DocumentStylesheetSet that can be `Sync`, since it's only
+/// used and exposed via mutable methods in the `Stylist`.
 #[cfg_attr(feature = "servo", derive(MallocSizeOf))]
-struct StylistStylesheetSet(StylesheetSet<StylistSheet>);
+struct StylistStylesheetSet(DocumentStylesheetSet<StylistSheet>);
 // Read above to see why this is fine.
 unsafe impl Sync for StylistStylesheetSet {}
 
 impl StylistStylesheetSet {
     fn new() -> Self {
-        StylistStylesheetSet(StylesheetSet::new())
+        StylistStylesheetSet(DocumentStylesheetSet::new())
     }
 }
 
 impl ops::Deref for StylistStylesheetSet {
-    type Target = StylesheetSet<StylistSheet>;
+    type Target = DocumentStylesheetSet<StylistSheet>;
 
     fn deref(&self) -> &Self::Target {
         &self.0
     }
 }
 
 impl ops::DerefMut for StylistStylesheetSet {
     fn deref_mut(&mut self) -> &mut Self::Target {