#[repr(C, u8)]pub enum CssDeclaration {
Static(CssProperty),
Dynamic(DynamicCssProperty),
}Expand description
Contains one parsed key: value pair, static or dynamic
Variants§
Static(CssProperty)
Static key-value pair, such as width: 500px
Dynamic(DynamicCssProperty)
Dynamic key-value pair with default value, such as width: [[ my_id | 500px ]]
Implementations§
Source§impl CssDeclaration
impl CssDeclaration
pub const fn new_static(prop: CssProperty) -> Self
pub const fn new_dynamic(prop: DynamicCssProperty) -> Self
Sourcepub const fn get_type(&self) -> CssPropertyType
pub const fn get_type(&self) -> CssPropertyType
Returns the type of the property (i.e. the CSS key as a typed enum)
Sourcepub const fn is_inheritable(&self) -> bool
pub const fn is_inheritable(&self) -> bool
Determines if the property will be inherited (applied to the children) during the recursive application of the style on the DOM tree
Sourcepub const fn can_trigger_relayout(&self) -> bool
pub const fn can_trigger_relayout(&self) -> bool
Returns whether this rule affects only styling properties or layout properties (that could trigger a re-layout)
pub fn to_str(&self) -> String
Sourcepub fn env_variable(&self) -> Option<EnvVariable>
pub fn env_variable(&self) -> Option<EnvVariable>
The env() variable this declaration reads, if it is one.
An env() declaration is a Dynamic whose dynamic_id carries the
ENV_DYNAMIC_ID_PREFIX;
its default_value is the parsed fallback. None for Static and
for a plain var() reference.
Sourcepub fn is_cascade_resolvable(&self) -> bool
pub fn is_cascade_resolvable(&self) -> bool
Whether the cascade can turn this declaration into a concrete property:
every Static, plus env() references. A var() Dynamic is not
(it is substituted at parse time and never reaches the cascade).
Sourcepub fn depends_on_dynamic_context(&self) -> bool
pub fn depends_on_dynamic_context(&self) -> bool
Whether this declaration’s value depends on the window’s
DynamicSelectorContext
- i.e. it is an
env()- so a context change must re-run the cascade for it, exactly as it must for a rule with@media-style conditions.
Sourcepub fn resolve_in_cascade(
&self,
ctx: Option<&DynamicSelectorContext>,
) -> Option<CssProperty>
pub fn resolve_in_cascade( &self, ctx: Option<&DynamicSelectorContext>, ) -> Option<CssProperty>
The concrete property this declaration contributes to the cascade
under ctx.
Static- the property itself.env()- the variable’s live value (an absolute length parsed as the declared property’s own type, sopadding-bottomgets a padding andtopgets an inset), or the parsed fallback when the platform reports none for it, or when there is no context yet (aStyledDomno window has adopted - the same rule conditional rule blocks follow).- a
var()Dynamic-None, matching the previous behaviour of every cascade site (they filtered onStatic).
Trait Implementations§
Source§impl Clone for CssDeclaration
impl Clone for CssDeclaration
Source§fn clone(&self) -> CssDeclaration
fn clone(&self) -> CssDeclaration
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CssDeclaration
impl Debug for CssDeclaration
impl Eq for CssDeclaration
Source§impl Extend<CssDeclaration> for CssDeclarationVec
impl Extend<CssDeclaration> for CssDeclarationVec
Source§fn extend<T: IntoIterator<Item = CssDeclaration>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = CssDeclaration>>(&mut self, iter: T)
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)