pub struct PropertyDeclarationBlock {
    declarations: ThinVec<PropertyDeclaration>,
    declarations_importance: SmallBitVec,
    property_ids: PropertyDeclarationIdSet,
}
Expand description

Overridden declarations are skipped.

Fields§

§declarations: ThinVec<PropertyDeclaration>

The group of declarations, along with their importance.

Only deduplicated declarations appear here.

§declarations_importance: SmallBitVec

The “important” flag for each declaration in declarations.

§property_ids: PropertyDeclarationIdSet

The set of properties that are present in the block.

Implementations§

source§

impl PropertyDeclarationBlock

source

pub fn len(&self) -> usize

Returns the number of declarations in the block.

source

pub fn is_empty(&self) -> bool

Returns whether the block is empty.

source

pub fn new() -> Self

Create an empty block

source

pub fn with_one( declaration: PropertyDeclaration, importance: Importance, ) -> Self

Create a block with a single declaration

source

pub fn declarations(&self) -> &[PropertyDeclaration]

The declarations in this block

source

pub fn declarations_importance(&self) -> &SmallBitVec

The important flags for declarations in this block

source

pub fn declaration_importance_iter(&self) -> DeclarationImportanceIterator<'_>

Iterate over (PropertyDeclaration, Importance) pairs

source

pub fn normal_declaration_iter<'a>( &'a self, ) -> impl DoubleEndedIterator<Item = &'a PropertyDeclaration>

Iterate over PropertyDeclaration for Importance::Normal

source

pub fn to_animation_value_iter<'a, 'cx, 'cx_a: 'cx>( &'a self, context: &'cx mut Context<'cx_a>, style: &'a ComputedValues, default_values: &'a ComputedValues, ) -> AnimationValueIterator<'a, 'cx, 'cx_a>

Return an iterator of (AnimatableLonghand, AnimationValue).

source

pub fn any_important(&self) -> bool

Returns whether this block contains any declaration with !important.

This is based on the declarations_importance bit-vector, which should be maintained whenever declarations is changed.

source

pub fn any_normal(&self) -> bool

Returns whether this block contains any declaration without !important.

This is based on the declarations_importance bit-vector, which should be maintained whenever declarations is changed.

source

pub fn property_ids(&self) -> &PropertyDeclarationIdSet

Returns a PropertyDeclarationIdSet representing the properties that are changed in this block.

source

pub fn contains(&self, id: PropertyDeclarationId<'_>) -> bool

Returns whether this block contains a declaration of a given property id.

source

pub fn contains_any_reset(&self) -> bool

Returns whether this block contains any reset longhand.

source

pub fn get( &self, property: PropertyDeclarationId<'_>, ) -> Option<(&PropertyDeclaration, Importance)>

Get a declaration for a given property.

NOTE: This is linear time in the case of custom properties or in the case the longhand is actually in the declaration block.

source

pub fn shorthand_to_css( &self, shorthand: ShorthandId, dest: &mut CssStringWriter, ) -> Result

Tries to serialize a given shorthand from the declarations in this block.

source

pub fn property_value_to_css( &self, property: &PropertyId, dest: &mut CssStringWriter, ) -> Result

Find the value of the given property in this block and serialize it

https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertyvalue

source

pub fn property_priority(&self, property: &PropertyId) -> Importance

source

pub fn extend( &mut self, drain: SourcePropertyDeclarationDrain<'_>, importance: Importance, ) -> bool

Adds or overrides the declaration for a given property in this block.

See the documentation of push to see what impact source has when the property is already there.

source

pub fn push( &mut self, declaration: PropertyDeclaration, importance: Importance, ) -> bool

Adds or overrides the declaration for a given property in this block.

Returns whether the declaration has changed.

This is only used for parsing and internal use.

source

pub fn prepare_for_update( &self, source_declarations: &SourcePropertyDeclaration, importance: Importance, updates: &mut SourcePropertyDeclarationUpdate, ) -> bool

Prepares updating this declaration block with the given SourcePropertyDeclaration and importance, and returns whether there is something to update.

source

pub fn update( &mut self, drain: SourcePropertyDeclarationDrain<'_>, importance: Importance, updates: &mut SourcePropertyDeclarationUpdate, )

Update this declaration block with the given data.

source

pub fn first_declaration_to_remove( &self, property: &PropertyId, ) -> Option<usize>

Returns the first declaration that would be removed by removing property.

source

fn remove_declaration_at(&mut self, i: usize)

Removes a given declaration at a given index.

source

pub fn clear(&mut self)

Clears all the declarations from this block.

source

pub fn remove_property( &mut self, property: &PropertyId, first_declaration: usize, )

https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-removeproperty

first_declaration needs to be the result of first_declaration_to_remove.

source

pub fn single_value_to_css( &self, property: &PropertyId, dest: &mut CssStringWriter, computed_values: Option<&ComputedValues>, stylist: &Stylist, ) -> Result

Take a declaration block known to contain a single property and serialize it.

source

pub fn from_animation_value_map(animation_value_map: &AnimationValueMap) -> Self

Convert AnimationValueMap to PropertyDeclarationBlock.

source

pub fn has_css_wide_keyword(&self, property: &PropertyId) -> bool

Returns true if the declaration block has a CSSWideKeyword for the given property.

source

pub fn to_css(&self, dest: &mut CssStringWriter) -> Result

Like the method on ToCss, but without the type parameter to avoid accidentally monomorphizing this large function multiple times for different writers.

https://drafts.csswg.org/cssom/#serialize-a-css-declaration-block

Trait Implementations§

source§

impl Clone for PropertyDeclarationBlock

source§

fn clone(&self) -> PropertyDeclarationBlock

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 PropertyDeclarationBlock

source§

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

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

impl Default for PropertyDeclarationBlock

source§

fn default() -> PropertyDeclarationBlock

Returns the “default value” for a type. Read more
source§

impl ToShmem for PropertyDeclarationBlock

source§

fn to_shmem(&self, builder: &mut SharedMemoryBuilder) -> Result<Self>

Clones this value into a form suitable for writing into a SharedMemoryBuilder. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 T
where 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> MaybeBoxed<Box<T>> for T

source§

fn maybe_boxed(self) -> Box<T>

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

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> ToOwned for T
where T: Clone,

source§

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 T
where U: Into<T>,

source§

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 T
where U: TryFrom<T>,

source§

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> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T