Rename StylesheetSet to StylesheetSetRef

This commit is contained in:
Fernando Jiménez Moreno 2019-04-22 13:19:51 +02:00
parent 9df1c2f2cc
commit e4f34fde1b
4 changed files with 17 additions and 17 deletions

View file

@ -154,7 +154,7 @@ use style::media_queries::{Device, MediaType};
use style::selector_parser::{RestyleDamage, Snapshot}; use style::selector_parser::{RestyleDamage, Snapshot};
use style::shared_lock::SharedRwLock as StyleSharedRwLock; use style::shared_lock::SharedRwLock as StyleSharedRwLock;
use style::str::{split_html_space_chars, str_join}; use style::str::{split_html_space_chars, str_join};
use style::stylesheet_set::{DocumentStylesheetSet, StylesheetSet}; use style::stylesheet_set::{DocumentStylesheetSet, StylesheetSetRef};
use style::stylesheets::{Origin, OriginSet, Stylesheet}; use style::stylesheets::{Origin, OriginSet, Stylesheet};
use url::percent_encoding::percent_decode; use url::percent_encoding::percent_decode;
use url::Host; use url::Host;
@ -3193,7 +3193,7 @@ impl Document {
DocumentOrShadowRoot::add_stylesheet( DocumentOrShadowRoot::add_stylesheet(
owner, owner,
StylesheetSet::Document(stylesheets), StylesheetSetRef::Document(stylesheets),
sheet, sheet,
insertion_point, insertion_point,
self.style_shared_lock(), self.style_shared_lock(),
@ -3211,7 +3211,7 @@ impl Document {
DocumentOrShadowRoot::remove_stylesheet( DocumentOrShadowRoot::remove_stylesheet(
owner, owner,
s, s,
StylesheetSet::Document(&mut *self.stylesheets.borrow_mut()), StylesheetSetRef::Document(&mut *self.stylesheets.borrow_mut()),
) )
} }
} }

View file

@ -24,7 +24,7 @@ use style::context::QuirksMode;
use style::invalidation::media_queries::{MediaListKey, ToMediaListKey}; use style::invalidation::media_queries::{MediaListKey, ToMediaListKey};
use style::media_queries::MediaList; use style::media_queries::MediaList;
use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard}; use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard};
use style::stylesheet_set::StylesheetSet; use style::stylesheet_set::StylesheetSetRef;
use style::stylesheets::{CssRule, Origin, Stylesheet}; use style::stylesheets::{CssRule, Origin, Stylesheet};
#[derive(Clone, JSTraceable, MallocSizeOf)] #[derive(Clone, JSTraceable, MallocSizeOf)]
@ -216,7 +216,7 @@ impl DocumentOrShadowRoot {
pub fn remove_stylesheet( pub fn remove_stylesheet(
owner: &Element, owner: &Element,
s: &Arc<Stylesheet>, s: &Arc<Stylesheet>,
mut stylesheets: StylesheetSet<StyleSheetInDocument>, mut stylesheets: StylesheetSetRef<StyleSheetInDocument>,
) { ) {
let guard = s.shared_lock.read(); let guard = s.shared_lock.read();
@ -236,7 +236,7 @@ impl DocumentOrShadowRoot {
#[allow(unrooted_must_root)] // Owner needs to be rooted already necessarily. #[allow(unrooted_must_root)] // Owner needs to be rooted already necessarily.
pub fn add_stylesheet( pub fn add_stylesheet(
owner: &Element, owner: &Element,
mut stylesheets: StylesheetSet<StyleSheetInDocument>, mut stylesheets: StylesheetSetRef<StyleSheetInDocument>,
sheet: Arc<Stylesheet>, sheet: Arc<Stylesheet>,
insertion_point: Option<StyleSheetInDocument>, insertion_point: Option<StyleSheetInDocument>,
style_shared_lock: &StyleSharedRwLock, style_shared_lock: &StyleSharedRwLock,

View file

@ -25,7 +25,7 @@ use style::author_styles::AuthorStyles;
use style::dom::TElement; use style::dom::TElement;
use style::media_queries::Device; use style::media_queries::Device;
use style::shared_lock::SharedRwLockReadGuard; use style::shared_lock::SharedRwLockReadGuard;
use style::stylesheet_set::StylesheetSet; use style::stylesheet_set::StylesheetSetRef;
use style::stylesheets::Stylesheet; use style::stylesheets::Stylesheet;
// https://dom.spec.whatwg.org/#interface-shadowroot // https://dom.spec.whatwg.org/#interface-shadowroot
@ -102,7 +102,7 @@ impl ShadowRoot {
.cloned(); .cloned();
DocumentOrShadowRoot::add_stylesheet( DocumentOrShadowRoot::add_stylesheet(
owner, owner,
StylesheetSet::Author(stylesheets), StylesheetSetRef::Author(stylesheets),
sheet, sheet,
insertion_point, insertion_point,
self.document.style_shared_lock(), self.document.style_shared_lock(),
@ -115,7 +115,7 @@ impl ShadowRoot {
DocumentOrShadowRoot::remove_stylesheet( DocumentOrShadowRoot::remove_stylesheet(
owner, owner,
s, s,
StylesheetSet::Author(&mut self.author_styles.borrow_mut().stylesheets), StylesheetSetRef::Author(&mut self.author_styles.borrow_mut().stylesheets),
) )
} }

View file

@ -374,7 +374,7 @@ where
} }
/// Functionality common to DocumentStylesheetSet and AuthorStylesheetSet. /// Functionality common to DocumentStylesheetSet and AuthorStylesheetSet.
pub enum StylesheetSet<'a, S> pub enum StylesheetSetRef<'a, S>
where where
S: StylesheetInDocument + PartialEq + 'static, S: StylesheetInDocument + PartialEq + 'static,
{ {
@ -384,7 +384,7 @@ where
Document(&'a mut DocumentStylesheetSet<S>), Document(&'a mut DocumentStylesheetSet<S>),
} }
impl<'a, S> StylesheetSet<'a, S> impl<'a, S> StylesheetSetRef<'a, S>
where where
S: StylesheetInDocument + PartialEq + 'static, S: StylesheetInDocument + PartialEq + 'static,
{ {
@ -398,8 +398,8 @@ where
guard: &SharedRwLockReadGuard, guard: &SharedRwLockReadGuard,
) { ) {
match self { match self {
StylesheetSet::Author(set) => set.append_stylesheet(device, sheet, guard), StylesheetSetRef::Author(set) => set.append_stylesheet(device, sheet, guard),
StylesheetSet::Document(set) => set.append_stylesheet(device, sheet, guard), StylesheetSetRef::Document(set) => set.append_stylesheet(device, sheet, guard),
} }
} }
@ -412,10 +412,10 @@ where
guard: &SharedRwLockReadGuard, guard: &SharedRwLockReadGuard,
) { ) {
match self { match self {
StylesheetSet::Author(set) => { StylesheetSetRef::Author(set) => {
set.insert_stylesheet_before(device, sheet, before_sheet, guard) set.insert_stylesheet_before(device, sheet, before_sheet, guard)
}, },
StylesheetSet::Document(set) => { StylesheetSetRef::Document(set) => {
set.insert_stylesheet_before(device, sheet, before_sheet, guard) set.insert_stylesheet_before(device, sheet, before_sheet, guard)
}, },
} }
@ -429,8 +429,8 @@ where
guard: &SharedRwLockReadGuard, guard: &SharedRwLockReadGuard,
) { ) {
match self { match self {
StylesheetSet::Author(set) => set.remove_stylesheet(device, sheet, guard), StylesheetSetRef::Author(set) => set.remove_stylesheet(device, sheet, guard),
StylesheetSet::Document(set) => set.remove_stylesheet(device, sheet, guard), StylesheetSetRef::Document(set) => set.remove_stylesheet(device, sheet, guard),
} }
} }
} }