style: Rename StylesheetSet to DocumentStylesheetSet.

MozReview-Commit-ID: 5Xl1eRLu1VF
This commit is contained in:
Emilio Cobos Álvarez 2018-02-08 11:55:50 +01:00
parent 7e501f50f7
commit f1516d228f
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 22 additions and 22 deletions

View file

@ -105,7 +105,7 @@ use style::media_queries::MediaList;
use style::properties::PropertyDeclarationBlock; use style::properties::PropertyDeclarationBlock;
use style::selector_parser::{PseudoElement, Snapshot}; use style::selector_parser::{PseudoElement, Snapshot};
use style::shared_lock::{SharedRwLock as StyleSharedRwLock, Locked as StyleLocked}; use style::shared_lock::{SharedRwLock as StyleSharedRwLock, Locked as StyleLocked};
use style::stylesheet_set::StylesheetSet; use style::stylesheet_set::DocumentStylesheetSet;
use style::stylesheets::{CssRules, FontFaceRule, KeyframesRule, MediaRule, Stylesheet}; use style::stylesheets::{CssRules, FontFaceRule, KeyframesRule, MediaRule, Stylesheet};
use style::stylesheets::{NamespaceRule, StyleRule, ImportRule, SupportsRule, ViewportRule}; use style::stylesheets::{NamespaceRule, StyleRule, ImportRule, SupportsRule, ViewportRule};
use style::stylesheets::keyframes_rule::Keyframe; use style::stylesheets::keyframes_rule::Keyframe;
@ -659,7 +659,7 @@ unsafe impl JSTraceable for StyleLocked<MediaList> {
} }
} }
unsafe impl<S> JSTraceable for StylesheetSet<S> unsafe impl<S> JSTraceable for DocumentStylesheetSet<S>
where where
S: JSTraceable + ::style::stylesheets::StylesheetInDocument + PartialEq + 'static, S: JSTraceable + ::style::stylesheets::StylesheetInDocument + PartialEq + 'static,
{ {

View file

@ -135,7 +135,7 @@ use style::media_queries::{Device, MediaList, MediaType};
use style::selector_parser::{RestyleDamage, Snapshot}; use style::selector_parser::{RestyleDamage, Snapshot};
use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard}; use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard};
use style::str::{HTML_SPACE_CHARACTERS, split_html_space_chars, str_join}; use style::str::{HTML_SPACE_CHARACTERS, split_html_space_chars, str_join};
use style::stylesheet_set::StylesheetSet; use style::stylesheet_set::DocumentStylesheetSet;
use style::stylesheets::{Stylesheet, StylesheetContents, Origin, OriginSet}; use style::stylesheets::{Stylesheet, StylesheetContents, Origin, OriginSet};
use task_source::TaskSource; use task_source::TaskSource;
use time; use time;
@ -262,7 +262,7 @@ pub struct Document {
/// Can be acquired once for accessing many objects. /// Can be acquired once for accessing many objects.
style_shared_lock: StyleSharedRwLock, style_shared_lock: StyleSharedRwLock,
/// List of stylesheets associated with nodes in this document. |None| if the list needs to be refreshed. /// List of stylesheets associated with nodes in this document. |None| if the list needs to be refreshed.
stylesheets: DomRefCell<StylesheetSet<StyleSheetInDocument>>, stylesheets: DomRefCell<DocumentStylesheetSet<StyleSheetInDocument>>,
stylesheet_list: MutNullableDom<StyleSheetList>, stylesheet_list: MutNullableDom<StyleSheetList>,
ready_state: Cell<DocumentReadyState>, ready_state: Cell<DocumentReadyState>,
/// Whether the DOMContentLoaded event has already been dispatched. /// Whether the DOMContentLoaded event has already been dispatched.
@ -1466,7 +1466,7 @@ impl Document {
// Mark the document element dirty so a reflow will be performed. // Mark the document element dirty so a reflow will be performed.
// //
// FIXME(emilio): Use the StylesheetSet invalidation stuff. // FIXME(emilio): Use the DocumentStylesheetSet invalidation stuff.
if let Some(element) = self.GetDocumentElement() { if let Some(element) = self.GetDocumentElement() {
element.upcast::<Node>().dirty(NodeDamage::NodeStyleDamaged); element.upcast::<Node>().dirty(NodeDamage::NodeStyleDamaged);
} }
@ -2264,7 +2264,7 @@ impl Document {
PER_PROCESS_AUTHOR_SHARED_LOCK.clone() PER_PROCESS_AUTHOR_SHARED_LOCK.clone()
//StyleSharedRwLock::new() //StyleSharedRwLock::new()
}, },
stylesheets: DomRefCell::new(StylesheetSet::new()), stylesheets: DomRefCell::new(DocumentStylesheetSet::new()),
stylesheet_list: MutNullableDom::new(None), stylesheet_list: MutNullableDom::new(None),
ready_state: Cell::new(ready_state), ready_state: Cell::new(ready_state),
domcontentloaded_dispatched: Cell::new(domcontentloaded_dispatched), domcontentloaded_dispatched: Cell::new(domcontentloaded_dispatched),
@ -3807,7 +3807,7 @@ impl DocumentMethods for Document {
self.scripts.set(None); self.scripts.set(None);
self.anchors.set(None); self.anchors.set(None);
self.applets.set(None); self.applets.set(None);
*self.stylesheets.borrow_mut() = StylesheetSet::new(); *self.stylesheets.borrow_mut() = DocumentStylesheetSet::new();
self.animation_frame_ident.set(0); self.animation_frame_ident.set(0);
self.animation_frame_list.borrow_mut().clear(); self.animation_frame_list.borrow_mut().clear();
self.pending_restyles.borrow_mut().clear(); self.pending_restyles.borrow_mut().clear();

View file

@ -370,7 +370,7 @@ where
/// The set of stylesheets effective for a given document. /// The set of stylesheets effective for a given document.
#[cfg_attr(feature = "servo", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct StylesheetSet<S> pub struct DocumentStylesheetSet<S>
where where
S: StylesheetInDocument + PartialEq + 'static, S: StylesheetInDocument + PartialEq + 'static,
{ {
@ -387,13 +387,13 @@ where
author_style_disabled: bool, author_style_disabled: bool,
} }
impl<S> StylesheetSet<S> impl<S> DocumentStylesheetSet<S>
where where
S: StylesheetInDocument + PartialEq + 'static, S: StylesheetInDocument + PartialEq + 'static,
{ {
/// Create a new empty StylesheetSet. /// Create a new empty StylesheetSet.
pub fn new() -> Self { pub fn new() -> Self {
StylesheetSet { Self {
collections: Default::default(), collections: Default::default(),
invalidations: StylesheetInvalidationSet::new(), invalidations: StylesheetInvalidationSet::new(),
origins_dirty: OriginSet::empty(), origins_dirty: OriginSet::empty(),
@ -438,7 +438,7 @@ where
sheet: S, sheet: S,
guard: &SharedRwLockReadGuard guard: &SharedRwLockReadGuard
) { ) {
debug!("StylesheetSet::append_stylesheet"); debug!("DocumentStylesheetSet::append_stylesheet");
self.collect_invalidations_for(device, &sheet, guard); self.collect_invalidations_for(device, &sheet, guard);
let origin = sheet.contents(guard).origin; let origin = sheet.contents(guard).origin;
self.collections.borrow_mut_for_origin(&origin).append(sheet); self.collections.borrow_mut_for_origin(&origin).append(sheet);
@ -451,7 +451,7 @@ where
sheet: S, sheet: S,
guard: &SharedRwLockReadGuard guard: &SharedRwLockReadGuard
) { ) {
debug!("StylesheetSet::prepend_stylesheet"); debug!("DocumentStylesheetSet::prepend_stylesheet");
self.collect_invalidations_for(device, &sheet, guard); self.collect_invalidations_for(device, &sheet, guard);
let origin = sheet.contents(guard).origin; let origin = sheet.contents(guard).origin;
@ -466,7 +466,7 @@ where
before_sheet: S, before_sheet: S,
guard: &SharedRwLockReadGuard, guard: &SharedRwLockReadGuard,
) { ) {
debug!("StylesheetSet::insert_stylesheet_before"); debug!("DocumentStylesheetSet::insert_stylesheet_before");
self.collect_invalidations_for(device, &sheet, guard); self.collect_invalidations_for(device, &sheet, guard);
let origin = sheet.contents(guard).origin; let origin = sheet.contents(guard).origin;
@ -491,7 +491,7 @@ where
/// Notes that the author style has been disabled for this document. /// Notes that the author style has been disabled for this document.
pub fn set_author_style_disabled(&mut self, disabled: bool) { 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 { if self.author_style_disabled == disabled {
return; return;
} }
@ -517,7 +517,7 @@ where
{ {
use std::mem; use std::mem;
debug!("StylesheetSet::flush"); debug!("DocumentStylesheetSet::flush");
let had_invalidations = let had_invalidations =
self.invalidations.flush(document_element, snapshots); self.invalidations.flush(document_element, snapshots);
@ -546,7 +546,7 @@ where
pub fn flush_without_invalidation(&mut self) -> OriginSet { pub fn flush_without_invalidation(&mut self) -> OriginSet {
use std::mem; use std::mem;
debug!("StylesheetSet::flush_without_invalidation"); debug!("DocumentStylesheetSet::flush_without_invalidation");
self.invalidations.clear(); self.invalidations.clear();
mem::replace(&mut self.origins_dirty, OriginSet::empty()) mem::replace(&mut self.origins_dirty, OriginSet::empty())

View file

@ -41,7 +41,7 @@ use smallvec::SmallVec;
use std::ops; use std::ops;
use std::sync::Mutex; use std::sync::Mutex;
use style_traits::viewport::ViewportConstraints; use style_traits::viewport::ViewportConstraints;
use stylesheet_set::{OriginValidity, SheetRebuildKind, StylesheetSet, StylesheetFlusher}; use stylesheet_set::{OriginValidity, SheetRebuildKind, DocumentStylesheetSet, StylesheetFlusher};
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
use stylesheets::{CounterStyleRule, FontFaceRule, FontFeatureValuesRule, PageRule}; use stylesheets::{CounterStyleRule, FontFaceRule, FontFeatureValuesRule, PageRule};
use stylesheets::{CssRule, Origin, OriginSet, PerOrigin, PerOriginIter}; use stylesheets::{CssRule, Origin, OriginSet, PerOrigin, PerOriginIter};
@ -328,21 +328,21 @@ impl DocumentCascadeData {
} }
} }
/// A wrapper over a StylesheetSet that can be `Sync`, since it's only used and /// A wrapper over a DocumentStylesheetSet that can be `Sync`, since it's only
/// exposed via mutable methods in the `Stylist`. /// used and exposed via mutable methods in the `Stylist`.
#[cfg_attr(feature = "servo", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(MallocSizeOf))]
struct StylistStylesheetSet(StylesheetSet<StylistSheet>); struct StylistStylesheetSet(DocumentStylesheetSet<StylistSheet>);
// Read above to see why this is fine. // Read above to see why this is fine.
unsafe impl Sync for StylistStylesheetSet {} unsafe impl Sync for StylistStylesheetSet {}
impl StylistStylesheetSet { impl StylistStylesheetSet {
fn new() -> Self { fn new() -> Self {
StylistStylesheetSet(StylesheetSet::new()) StylistStylesheetSet(DocumentStylesheetSet::new())
} }
} }
impl ops::Deref for StylistStylesheetSet { impl ops::Deref for StylistStylesheetSet {
type Target = StylesheetSet<StylistSheet>; type Target = DocumentStylesheetSet<StylistSheet>;
fn deref(&self) -> &Self::Target { fn deref(&self) -> &Self::Target {
&self.0 &self.0