pub struct ResolvedDeclaration {
pub selector: Arc<ComplexSelector>,
pub name: String,
pub value: CssValue,
pub specificity: (u32, u32, u32),
pub order: usize,
pub important: bool,
pub origin: StyleOrigin,
pub media_queries: Arc<Vec<AtQuery>>,
}Expand description
A single CSS declaration after selector resolution and value processing.
ResolvedDeclaration represents one property-value pair that has been
fully associated with a selector and enriched with all information
required for CSS cascade resolution.
This structure is produced after:
- Parsing selectors
- Resolving
var()using custom properties - Computing selector specificity
During the cascade phase, multiple ResolvedDeclarations with the same
property name may compete. The winner is determined by comparing:
importantdeclarations- cascade
origin specificity(higher specificity wins)order(later declarations win)
Fields§
§selector: Arc<ComplexSelector>§name: String§value: CssValue§specificity: (u32, u32, u32)§order: usize§important: bool§origin: StyleOrigin§media_queries: Arc<Vec<AtQuery>>Nested @media/@supports conditions which must all match before this
declaration applies. Shared across declarations of the same rule block.
Implementations§
Source§impl ResolvedDeclaration
impl ResolvedDeclaration
Sourcepub fn outranks(&self, other: &Self) -> bool
pub fn outranks(&self, other: &Self) -> bool
Returns whether this declaration wins over another matching declaration.
Sourcepub fn matches_media(&self, environment: &MediaEnvironment) -> bool
pub fn matches_media(&self, environment: &MediaEnvironment) -> bool
Returns whether every enclosing @media rule matches environment.
Trait Implementations§
Source§impl Clone for ResolvedDeclaration
impl Clone for ResolvedDeclaration
Source§fn clone(&self) -> ResolvedDeclaration
fn clone(&self) -> ResolvedDeclaration
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ResolvedDeclaration
impl RefUnwindSafe for ResolvedDeclaration
impl Send for ResolvedDeclaration
impl Sync for ResolvedDeclaration
impl Unpin for ResolvedDeclaration
impl UnsafeUnpin for ResolvedDeclaration
impl UnwindSafe for ResolvedDeclaration
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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