pub struct StylesheetContents {
pub rules: Arc<Locked<CssRules>>,
pub origin: Origin,
pub url_data: UrlExtraData,
pub namespaces: Namespaces,
pub quirks_mode: QuirksMode,
pub source_map_url: Option<String>,
pub source_url: Option<String>,
pub use_counters: UseCounters,
_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: OriginThe origin of this stylesheet.
url_data: UrlExtraDataThe url data this stylesheet should use.
namespaces: NamespacesThe namespaces that apply to this stylesheet.
quirks_mode: QuirksModeThe quirks mode of this stylesheet.
source_map_url: Option<String>This stylesheet’s source map URL.
source_url: Option<String>This stylesheet’s source URL.
use_counters: UseCountersThe use counters of the original stylesheet.
_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,
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.
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.
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.
Sourcepub fn iter_rules<'a, 'b, C>(
&'a self,
device: &'a Device,
guard: &'a SharedRwLockReadGuard<'b>,
) -> RulesIterator<'a, 'b, C> ⓘwhere
C: NestedRuleIterationCondition,
pub fn iter_rules<'a, 'b, C>(
&'a self,
device: &'a Device,
guard: &'a SharedRwLockReadGuard<'b>,
) -> RulesIterator<'a, 'b, C> ⓘwhere
C: NestedRuleIterationCondition,
Return an iterator using the condition C.
Sourcepub fn effective_rules<'a, 'b>(
&'a self,
device: &'a Device,
guard: &'a SharedRwLockReadGuard<'b>,
) -> EffectiveRulesIterator<'a, 'b>
pub fn effective_rules<'a, 'b>( &'a self, device: &'a Device, guard: &'a SharedRwLockReadGuard<'b>, ) -> EffectiveRulesIterator<'a, 'b>
Return an iterator over the effective rules within the style-sheet, as
according to the supplied Device.
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