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::shared_lock::SharedRwLock as StyleSharedRwLock;
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 url::percent_encoding::percent_decode;
use url::Host;
@ -3193,7 +3193,7 @@ impl Document {
DocumentOrShadowRoot::add_stylesheet(
owner,
StylesheetSet::Document(stylesheets),
StylesheetSetRef::Document(stylesheets),
sheet,
insertion_point,
self.style_shared_lock(),
@ -3211,7 +3211,7 @@ impl Document {
DocumentOrShadowRoot::remove_stylesheet(
owner,
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::media_queries::MediaList;
use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard};
use style::stylesheet_set::StylesheetSet;
use style::stylesheet_set::StylesheetSetRef;
use style::stylesheets::{CssRule, Origin, Stylesheet};
#[derive(Clone, JSTraceable, MallocSizeOf)]
@ -216,7 +216,7 @@ impl DocumentOrShadowRoot {
pub fn remove_stylesheet(
owner: &Element,
s: &Arc<Stylesheet>,
mut stylesheets: StylesheetSet<StyleSheetInDocument>,
mut stylesheets: StylesheetSetRef<StyleSheetInDocument>,
) {
let guard = s.shared_lock.read();
@ -236,7 +236,7 @@ impl DocumentOrShadowRoot {
#[allow(unrooted_must_root)] // Owner needs to be rooted already necessarily.
pub fn add_stylesheet(
owner: &Element,
mut stylesheets: StylesheetSet<StyleSheetInDocument>,
mut stylesheets: StylesheetSetRef<StyleSheetInDocument>,
sheet: Arc<Stylesheet>,
insertion_point: Option<StyleSheetInDocument>,
style_shared_lock: &StyleSharedRwLock,

View file

@ -25,7 +25,7 @@ use style::author_styles::AuthorStyles;
use style::dom::TElement;
use style::media_queries::Device;
use style::shared_lock::SharedRwLockReadGuard;
use style::stylesheet_set::StylesheetSet;
use style::stylesheet_set::StylesheetSetRef;
use style::stylesheets::Stylesheet;
// https://dom.spec.whatwg.org/#interface-shadowroot
@ -102,7 +102,7 @@ impl ShadowRoot {
.cloned();
DocumentOrShadowRoot::add_stylesheet(
owner,
StylesheetSet::Author(stylesheets),
StylesheetSetRef::Author(stylesheets),
sheet,
insertion_point,
self.document.style_shared_lock(),
@ -115,7 +115,7 @@ impl ShadowRoot {
DocumentOrShadowRoot::remove_stylesheet(
owner,
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.
pub enum StylesheetSet<'a, S>
pub enum StylesheetSetRef<'a, S>
where
S: StylesheetInDocument + PartialEq + 'static,
{
@ -384,7 +384,7 @@ where
Document(&'a mut DocumentStylesheetSet<S>),
}
impl<'a, S> StylesheetSet<'a, S>
impl<'a, S> StylesheetSetRef<'a, S>
where
S: StylesheetInDocument + PartialEq + 'static,
{
@ -398,8 +398,8 @@ where
guard: &SharedRwLockReadGuard,
) {
match self {
StylesheetSet::Author(set) => set.append_stylesheet(device, sheet, guard),
StylesheetSet::Document(set) => set.append_stylesheet(device, sheet, guard),
StylesheetSetRef::Author(set) => set.append_stylesheet(device, sheet, guard),
StylesheetSetRef::Document(set) => set.append_stylesheet(device, sheet, guard),
}
}
@ -412,10 +412,10 @@ where
guard: &SharedRwLockReadGuard,
) {
match self {
StylesheetSet::Author(set) => {
StylesheetSetRef::Author(set) => {
set.insert_stylesheet_before(device, sheet, before_sheet, guard)
},
StylesheetSet::Document(set) => {
StylesheetSetRef::Document(set) => {
set.insert_stylesheet_before(device, sheet, before_sheet, guard)
},
}
@ -429,8 +429,8 @@ where
guard: &SharedRwLockReadGuard,
) {
match self {
StylesheetSet::Author(set) => set.remove_stylesheet(device, sheet, guard),
StylesheetSet::Document(set) => set.remove_stylesheet(device, sheet, guard),
StylesheetSetRef::Author(set) => set.remove_stylesheet(device, sheet, guard),
StylesheetSetRef::Document(set) => set.remove_stylesheet(device, sheet, guard),
}
}
}