Struct style::stylesheets::stylesheet::StylesheetContents
source · pub struct StylesheetContents {
pub rules: Arc<Locked<CssRules>>,
pub origin: Origin,
pub url_data: RwLock<UrlExtraData>,
pub namespaces: RwLock<Namespaces>,
pub quirks_mode: QuirksMode,
pub source_map_url: RwLock<Option<String>>,
pub source_url: RwLock<Option<String>>,
_forbid_construction: (),
}
Expand description
The contents of a given stylesheet. This effectively maps to a StyleSheetInner in Gecko.
Fields§
§rules: Arc<Locked<CssRules>>
List of rules in the order they were found (important for cascading order)
origin: Origin
The origin of this stylesheet.
url_data: RwLock<UrlExtraData>
The url data this stylesheet should use.
namespaces: RwLock<Namespaces>
The namespaces that apply to this stylesheet.
quirks_mode: QuirksMode
The quirks mode of this stylesheet.
source_map_url: RwLock<Option<String>>
This stylesheet’s source map URL.
source_url: RwLock<Option<String>>
This stylesheet’s source URL.
_forbid_construction: ()
We don’t want to allow construction outside of this file, to guarantee that all contents are created with Arc<>.
Implementations§
source§impl StylesheetContents
impl StylesheetContents
sourcepub fn from_str(
css: &str,
url_data: UrlExtraData,
origin: Origin,
shared_lock: &SharedRwLock,
stylesheet_loader: Option<&dyn StylesheetLoader>,
error_reporter: Option<&dyn ParseErrorReporter>,
quirks_mode: QuirksMode,
use_counters: Option<&UseCounters>,
allow_import_rules: AllowImportRules,
sanitization_data: Option<&mut SanitizationData>,
) -> Arc<Self>
pub fn from_str( css: &str, url_data: UrlExtraData, origin: Origin, shared_lock: &SharedRwLock, stylesheet_loader: Option<&dyn StylesheetLoader>, error_reporter: Option<&dyn ParseErrorReporter>, quirks_mode: QuirksMode, use_counters: Option<&UseCounters>, allow_import_rules: AllowImportRules, sanitization_data: Option<&mut SanitizationData>, ) -> Arc<Self>
Parse a given CSS string, with a given url-data, origin, and quirks mode.
sourcepub fn from_data(
rules: Arc<Locked<CssRules>>,
origin: Origin,
url_data: UrlExtraData,
quirks_mode: QuirksMode,
) -> Arc<Self>
pub fn from_data( rules: Arc<Locked<CssRules>>, origin: Origin, url_data: UrlExtraData, quirks_mode: QuirksMode, ) -> Arc<Self>
Creates a new StylesheetContents with the specified pre-parsed rules, origin, URL data, and quirks mode.
Since the rules have already been parsed, and the intention is that this function is used for read only User Agent style sheets, an empty namespace map is used, and the source map and source URLs are set to None.
An empty namespace map should be fine, as it is only used for parsing, not serialization of existing selectors. Since UA sheets are read only, we should never need the namespace map.
Same as above, but ensuring that the rules are static.
sourcepub fn rules<'a, 'b: 'a>(
&'a self,
guard: &'b SharedRwLockReadGuard<'_>,
) -> &'a [CssRule]
pub fn rules<'a, 'b: 'a>( &'a self, guard: &'b SharedRwLockReadGuard<'_>, ) -> &'a [CssRule]
Returns a reference to the list of rules.
Trait Implementations§
source§impl Debug for StylesheetContents
impl Debug for StylesheetContents
source§impl DeepCloneWithLock for StylesheetContents
impl DeepCloneWithLock for StylesheetContents
source§fn deep_clone_with_lock(
&self,
lock: &SharedRwLock,
guard: &SharedRwLockReadGuard<'_>,
) -> Self
fn deep_clone_with_lock( &self, lock: &SharedRwLock, guard: &SharedRwLockReadGuard<'_>, ) -> Self
source§impl ToMediaListKey for StylesheetContents
impl ToMediaListKey for StylesheetContents
source§fn to_media_list_key(&self) -> MediaListKey
fn to_media_list_key(&self) -> MediaListKey
MediaListKey
for this item. This key needs to uniquely identify
the item.Auto Trait Implementations§
impl !Freeze for StylesheetContents
impl !RefUnwindSafe for StylesheetContents
impl Send for StylesheetContents
impl Sync for StylesheetContents
impl Unpin for StylesheetContents
impl !UnwindSafe for StylesheetContents
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more