pub enum EnvVariable {
SafeAreaInsetTop,
SafeAreaInsetRight,
SafeAreaInsetBottom,
SafeAreaInsetLeft,
KeyboardInsetHeight,
}Expand description
A CSS env() variable name the engine can supply a value for.
env() is the value-side twin of the dynamic selectors: a selector asks
“does this rule apply under the window’s context?”, an env() asks “what
is this length under the window’s context?”. Both read
DynamicSelectorContext, both are (re)resolved in the author cascade
whenever the context changes, and neither needs its own invalidation.
Parsed by parser2 into a CssDeclaration::Dynamic whose dynamic_id
is "env:<name>" (see ENV_DYNAMIC_ID_PREFIX) and whose
default_value is the parsed fallback; CssDeclaration::resolve_in_cascade
turns that into a concrete property against the live context. Not a
C-ABI type: it never leaves the css/core crates.
Variants§
SafeAreaInsetTop
SafeAreaInsetRight
SafeAreaInsetBottom
SafeAreaInsetLeft
KeyboardInsetHeight
The VirtualKeyboard API’s env(keyboard-inset-height).
Implementations§
Source§impl EnvVariable
impl EnvVariable
pub const ALL: [Self; 5]
Sourcepub const fn as_css_name(&self) -> &'static str
pub const fn as_css_name(&self) -> &'static str
The name as written inside env(...).
Sourcepub fn from_css_name(name: &str) -> Option<Self>
pub fn from_css_name(name: &str) -> Option<Self>
Parse the name written inside env(...); None for a name the
engine does not define (the CSS “unknown environment variable” case,
where only the fallback can apply).
Sourcepub fn dynamic_id(&self) -> AzString
pub fn dynamic_id(&self) -> AzString
The dynamic_id an env() declaration is stored under.
Sourcepub fn from_dynamic_id(id: &str) -> Option<Self>
pub fn from_dynamic_id(id: &str) -> Option<Self>
Recover the variable from a dynamic_id; None for a plain var() id
(no prefix) or a prefixed name this build does not know.
Sourcepub fn resolve(&self, ctx: &DynamicSelectorContext) -> Option<f32>
pub fn resolve(&self, ctx: &DynamicSelectorContext) -> Option<f32>
The variable’s value under ctx, in logical px; None when the
platform reported nothing for it (the context’s NaN sentinel), in
which case the env() fallback applies.
Trait Implementations§
Source§impl Clone for EnvVariable
impl Clone for EnvVariable
Source§fn clone(&self) -> EnvVariable
fn clone(&self) -> EnvVariable
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more