Struct style::stylesheets::stylesheet::Stylesheet
source · pub struct Stylesheet {
pub contents: 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: 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: AtomicBool
Whether this stylesheet should be disabled.
Implementations§
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: 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: 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
.
sourcepub fn update_from_bytes(
existing: &Stylesheet,
bytes: &[u8],
protocol_encoding_label: Option<&str>,
environment_encoding: Option<&'static Encoding>,
url_data: UrlExtraData,
stylesheet_loader: Option<&dyn StylesheetLoader>,
error_reporter: Option<&dyn ParseErrorReporter>,
)
pub fn update_from_bytes( existing: &Stylesheet, bytes: &[u8], protocol_encoding_label: Option<&str>, environment_encoding: Option<&'static Encoding>, url_data: UrlExtraData, stylesheet_loader: Option<&dyn StylesheetLoader>, error_reporter: Option<&dyn ParseErrorReporter>, )
Updates an empty stylesheet with a set of bytes that reached over the network.
source§impl Stylesheet
impl Stylesheet
sourcepub fn update_from_str(
existing: &Stylesheet,
css: &str,
url_data: UrlExtraData,
stylesheet_loader: Option<&dyn StylesheetLoader>,
error_reporter: Option<&dyn ParseErrorReporter>,
allow_import_rules: AllowImportRules,
)
pub fn update_from_str( existing: &Stylesheet, css: &str, url_data: UrlExtraData, stylesheet_loader: Option<&dyn StylesheetLoader>, error_reporter: Option<&dyn ParseErrorReporter>, allow_import_rules: AllowImportRules, )
Updates an empty stylesheet from a given string of text.
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.
Effectively creates a new stylesheet and forwards the hard work to
Stylesheet::update_from_str
.
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.
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(&self) -> &StylesheetContents
fn contents(&self) -> &StylesheetContents
source§fn implicit_scope_root(&self) -> Option<ImplicitScopeRoot>
fn implicit_scope_root(&self) -> Option<ImplicitScopeRoot>
source§fn rules<'a, 'b: 'a>(
&'a self,
guard: &'b SharedRwLockReadGuard<'_>,
) -> &'a [CssRule]
fn rules<'a, 'b: 'a>( &'a self, guard: &'b SharedRwLockReadGuard<'_>, ) -> &'a [CssRule]
source§fn iter_rules<'a, 'b, C>(
&'a self,
device: &'a Device,
guard: &'a SharedRwLockReadGuard<'b>,
) -> RulesIterator<'a, 'b, C> ⓘwhere
C: NestedRuleIterationCondition,
fn iter_rules<'a, 'b, C>(
&'a self,
device: &'a Device,
guard: &'a SharedRwLockReadGuard<'b>,
) -> RulesIterator<'a, 'b, C> ⓘwhere
C: NestedRuleIterationCondition,
C
.source§fn is_effective_for_device(
&self,
device: &Device,
guard: &SharedRwLockReadGuard<'_>,
) -> bool
fn is_effective_for_device( &self, device: &Device, guard: &SharedRwLockReadGuard<'_>, ) -> bool
source§fn effective_rules<'a, 'b>(
&'a self,
device: &'a Device,
guard: &'a SharedRwLockReadGuard<'b>,
) -> EffectiveRulesIterator<'a, 'b>
fn effective_rules<'a, 'b>( &'a self, device: &'a Device, guard: &'a SharedRwLockReadGuard<'b>, ) -> EffectiveRulesIterator<'a, 'b>
Device
.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> 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