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.

§shared_lock: SharedRwLock

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

source

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.

source

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

source

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.

source

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>)

source

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.

source

pub fn disabled(&self) -> bool

Returns whether the stylesheet has been explicitly disabled through the CSSOM.

source

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

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Stylesheet

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl StylesheetInDocument for Stylesheet

source§

fn media<'a>( &'a self, guard: &'a SharedRwLockReadGuard<'_> ) -> Option<&'a MediaList>

Get the media associated with this stylesheet.
source§

fn enabled(&self) -> bool

Get whether this stylesheet is enabled.
source§

fn contents(&self) -> &StylesheetContents

Returns a reference to the contents of the stylesheet.
source§

fn rules<'a, 'b: 'a>( &'a self, guard: &'b SharedRwLockReadGuard<'_> ) -> &'a [CssRule]

Returns a reference to the list of rules in this stylesheet.
source§

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.
source§

fn is_effective_for_device( &self, device: &Device, guard: &SharedRwLockReadGuard<'_> ) -> bool

Returns whether the style-sheet applies for the current device.
source§

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.
source§

fn effective_font_face_rules<F>( &self, device: &Device, guard: &SharedRwLockReadGuard<'_>, f: F )where F: FnMut(&FontFaceRule),

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> MaybeBoxed<Box<T, Global>> for T

source§

fn maybe_boxed(self) -> Box<T, Global>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Erased for T