pub struct Stylesheet {
pub contents: Locked<Arc<StylesheetContents>>,
pub shared_lock: SharedRwLock,
pub media: Arc<Locked<MediaList>>,
pub disabled: AtomicBool,
}Expand description
The structure servo uses to represent a stylesheet.
Fields§
§contents: Locked<Arc<StylesheetContents>>The contents of this stylesheet.
The lock used for objects inside this stylesheet
media: Arc<Locked<MediaList>>List of media associated with the Stylesheet.
disabled: AtomicBoolWhether this stylesheet should be disabled.
Implementations§
Source§impl Stylesheet
impl Stylesheet
fn parse_rules( 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>, ) -> (Namespaces, Vec<CssRule>, Option<String>, Option<String>)
Sourcepub fn from_str(
css: &str,
url_data: UrlExtraData,
origin: Origin,
media: Arc<Locked<MediaList>>,
shared_lock: SharedRwLock,
stylesheet_loader: Option<&dyn StylesheetLoader>,
error_reporter: Option<&dyn ParseErrorReporter>,
quirks_mode: QuirksMode,
allow_import_rules: AllowImportRules,
) -> Self
pub fn from_str( css: &str, url_data: UrlExtraData, origin: Origin, media: Arc<Locked<MediaList>>, shared_lock: SharedRwLock, stylesheet_loader: Option<&dyn StylesheetLoader>, error_reporter: Option<&dyn ParseErrorReporter>, quirks_mode: QuirksMode, allow_import_rules: AllowImportRules, ) -> Self
Creates an empty stylesheet and parses it with a given base url, origin and media.
Sourcepub fn disabled(&self) -> bool
pub fn disabled(&self) -> bool
Returns whether the stylesheet has been explicitly disabled through the CSSOM.
Sourcepub fn set_disabled(&self, disabled: bool) -> bool
pub fn set_disabled(&self, disabled: bool) -> bool
Records that the stylesheet has been explicitly disabled through the CSSOM.
Returns whether the the call resulted in a change in disabled state.
Disabled stylesheets remain in the document, but their rules are not added to the Stylist.
Source§impl Stylesheet
impl Stylesheet
Sourcepub fn from_bytes(
bytes: &[u8],
url_data: UrlExtraData,
protocol_encoding_label: Option<&str>,
environment_encoding: Option<&'static Encoding>,
origin: Origin,
media: Arc<Locked<MediaList>>,
shared_lock: SharedRwLock,
stylesheet_loader: Option<&dyn StylesheetLoader>,
error_reporter: Option<&dyn ParseErrorReporter>,
quirks_mode: QuirksMode,
) -> Stylesheet
pub fn from_bytes( bytes: &[u8], url_data: UrlExtraData, protocol_encoding_label: Option<&str>, environment_encoding: Option<&'static Encoding>, origin: Origin, media: Arc<Locked<MediaList>>, shared_lock: SharedRwLock, stylesheet_loader: Option<&dyn StylesheetLoader>, error_reporter: Option<&dyn ParseErrorReporter>, quirks_mode: QuirksMode, ) -> Stylesheet
Parse a stylesheet from a set of bytes, potentially received over the network.
Takes care of decoding the network bytes and forwards the resulting
string to Stylesheet::from_str.
Trait Implementations§
Source§impl Clone for Stylesheet
impl Clone for Stylesheet
Source§impl Debug for Stylesheet
impl Debug for Stylesheet
Source§impl StylesheetInDocument for Stylesheet
impl StylesheetInDocument for Stylesheet
Source§fn media<'a>(
&'a self,
guard: &'a SharedRwLockReadGuard<'_>,
) -> Option<&'a MediaList>
fn media<'a>( &'a self, guard: &'a SharedRwLockReadGuard<'_>, ) -> Option<&'a MediaList>
Source§fn contents<'a>(
&'a self,
guard: &'a SharedRwLockReadGuard<'_>,
) -> &'a StylesheetContents
fn contents<'a>( &'a self, guard: &'a SharedRwLockReadGuard<'_>, ) -> &'a StylesheetContents
Source§fn implicit_scope_root(&self) -> Option<ImplicitScopeRoot>
fn implicit_scope_root(&self) -> Option<ImplicitScopeRoot>
Source§fn is_effective_for_device(
&self,
device: &Device,
guard: &SharedRwLockReadGuard<'_>,
) -> bool
fn is_effective_for_device( &self, device: &Device, guard: &SharedRwLockReadGuard<'_>, ) -> bool
Auto Trait Implementations§
impl !Freeze for Stylesheet
impl !RefUnwindSafe for Stylesheet
impl Send for Stylesheet
impl Sync for Stylesheet
impl Unpin for Stylesheet
impl !UnwindSafe for Stylesheet
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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