pub struct ApplicableDeclarationBlock {
pub source: StyleSource,
source_order: u32,
pub specificity: u32,
pub scope_proximity: ScopeProximity,
pub cascade_priority: CascadePriority,
}
Expand description
A property declaration together with its precedence among rules of equal specificity so that we can sort them.
This represents the declarations in a given declaration block for a given importance.
Fields§
§source: StyleSource
The style source, either a style rule, or a property declaration block.
source_order: u32
Order of appearance in which this rule appears - Set to 0 if not relevant
(e.g. Declaration from style="/*...*/"
, presentation hints, animations
- See
CascadePriority
instead).
specificity: u32
The specificity of the selector.
scope_proximity: ScopeProximity
The proximity to the scope root.
cascade_priority: CascadePriority
The cascade priority of the rule.
Implementations§
source§impl ApplicableDeclarationBlock
impl ApplicableDeclarationBlock
sourcepub fn from_declarations(
declarations: Arc<Locked<PropertyDeclarationBlock>>,
level: CascadeLevel,
layer_order: LayerOrder,
) -> Self
pub fn from_declarations( declarations: Arc<Locked<PropertyDeclarationBlock>>, level: CascadeLevel, layer_order: LayerOrder, ) -> Self
Constructs an applicable declaration block from a given property declaration block and importance.
sourcepub fn new(
source: StyleSource,
source_order: u32,
level: CascadeLevel,
specificity: u32,
layer_order: LayerOrder,
scope_proximity: ScopeProximity,
) -> Self
pub fn new( source: StyleSource, source_order: u32, level: CascadeLevel, specificity: u32, layer_order: LayerOrder, scope_proximity: ScopeProximity, ) -> Self
Constructs an applicable declaration block from the given components.
sourcepub fn source_order(&self) -> u32
pub fn source_order(&self) -> u32
Returns the source order of the block.
sourcepub fn level(&self) -> CascadeLevel
pub fn level(&self) -> CascadeLevel
Returns the cascade level of the block.
sourcepub fn layer_order(&self) -> LayerOrder
pub fn layer_order(&self) -> LayerOrder
Returns the cascade level of the block.
sourcepub fn scope_proximity(&self) -> ScopeProximity
pub fn scope_proximity(&self) -> ScopeProximity
Returns the scope proximity of the block.
sourcepub fn for_rule_tree(self) -> (StyleSource, CascadePriority)
pub fn for_rule_tree(self) -> (StyleSource, CascadePriority)
Convenience method to consume self and return the right thing for the rule tree to iterate over.
sourcepub fn sort_key(&self) -> (LayerOrder, u32, ScopeProximity, u32)
pub fn sort_key(&self) -> (LayerOrder, u32, ScopeProximity, u32)
Return the key used to sort applicable declarations.
Trait Implementations§
source§impl Clone for ApplicableDeclarationBlock
impl Clone for ApplicableDeclarationBlock
source§fn clone(&self) -> ApplicableDeclarationBlock
fn clone(&self) -> ApplicableDeclarationBlock
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ApplicableDeclarationBlock
impl Debug for ApplicableDeclarationBlock
source§impl MallocSizeOf for ApplicableDeclarationBlock
impl MallocSizeOf for ApplicableDeclarationBlock
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl PartialEq for ApplicableDeclarationBlock
impl PartialEq for ApplicableDeclarationBlock
source§fn eq(&self, other: &ApplicableDeclarationBlock) -> bool
fn eq(&self, other: &ApplicableDeclarationBlock) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for ApplicableDeclarationBlock
Auto Trait Implementations§
impl Freeze for ApplicableDeclarationBlock
impl !RefUnwindSafe for ApplicableDeclarationBlock
impl Send for ApplicableDeclarationBlock
impl Sync for ApplicableDeclarationBlock
impl Unpin for ApplicableDeclarationBlock
impl !UnwindSafe for ApplicableDeclarationBlock
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