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>>,
pub use_counters: UseCounters,
/* private fields */
}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: OriginThe 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: QuirksModeThe 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.
use_counters: UseCountersThe use counters of the original stylesheet.
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,
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, 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