#[repr(u8)]pub enum NoCalcLength {
Absolute(AbsoluteLength),
FontRelative(FontRelativeLength),
ViewportPercentage(ViewportPercentageLength),
ContainerRelative(ContainerRelativeLength),
ServoCharacterWidth(CharacterWidth),
}
Expand description
A <length>
without taking calc
expressions into account
Variants§
Absolute(AbsoluteLength)
An absolute length
FontRelative(FontRelativeLength)
A font-relative length:
ViewportPercentage(ViewportPercentageLength)
A viewport-relative length.
https://drafts.csswg.org/css-values/#viewport-relative-lengths
ContainerRelative(ContainerRelativeLength)
A container query length.
ServoCharacterWidth(CharacterWidth)
HTML5 “character width”, as defined in HTML5 § 14.5.4.
This cannot be specified by the user directly and is only generated by
Stylist::synthesize_rules_for_legacy_attributes()
.
Implementations§
source§impl NoCalcLength
impl NoCalcLength
sourcepub fn to_computed_value_with_base_size(
&self,
context: &Context<'_>,
base_size: FontBaseSize,
line_height_base: LineHeightBase,
) -> Length
pub fn to_computed_value_with_base_size( &self, context: &Context<'_>, base_size: FontBaseSize, line_height_base: LineHeightBase, ) -> Length
Computes a length with a given font-relative base size.
source§impl NoCalcLength
impl NoCalcLength
sourcepub fn unitless_value(&self) -> CSSFloat
pub fn unitless_value(&self) -> CSSFloat
Return the unitless, raw value.
fn unit(&self) -> &'static str
sourcepub fn is_negative(&self) -> bool
pub fn is_negative(&self) -> bool
Returns whether the value of this length without unit is less than zero.
sourcepub fn is_zero(&self) -> bool
pub fn is_zero(&self) -> bool
Returns whether the value of this length without unit is equal to zero.
sourcepub fn is_infinite(&self) -> bool
pub fn is_infinite(&self) -> bool
Returns whether the value of this length without unit is infinite.
sourcepub fn should_zoom_text(&self) -> bool
pub fn should_zoom_text(&self) -> bool
Whether text-only zoom should be applied to this length.
Generally, font-dependent/relative units don’t get text-only-zoomed, because the font they’re relative to should be zoomed already.
sourcepub fn parse_dimension(
context: &ParserContext<'_>,
value: CSSFloat,
unit: &str,
) -> Result<Self, ()>
pub fn parse_dimension( context: &ParserContext<'_>, value: CSSFloat, unit: &str, ) -> Result<Self, ()>
Parse a given absolute or relative dimension.
pub(crate) fn try_op<O>(&self, other: &Self, op: O) -> Result<Self, ()>
pub(crate) fn map(&self, op: impl FnMut(f32) -> f32) -> Self
sourcepub fn to_computed_pixel_length_without_context(&self) -> Result<CSSFloat, ()>
pub fn to_computed_pixel_length_without_context(&self) -> Result<CSSFloat, ()>
Get a px value without context (so only absolute units can be handled).
sourcepub fn from_px(px_value: CSSFloat) -> NoCalcLength
pub fn from_px(px_value: CSSFloat) -> NoCalcLength
Get an absolute length from a px value.
Trait Implementations§
source§impl Clone for NoCalcLength
impl Clone for NoCalcLength
source§fn clone(&self) -> NoCalcLength
fn clone(&self) -> NoCalcLength
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for NoCalcLength
impl Debug for NoCalcLength
source§impl From<NoCalcLength> for Length
impl From<NoCalcLength> for Length
source§fn from(len: NoCalcLength) -> Self
fn from(len: NoCalcLength) -> Self
source§impl From<NoCalcLength> for LengthPercentage
impl From<NoCalcLength> for LengthPercentage
source§fn from(len: NoCalcLength) -> Self
fn from(len: NoCalcLength) -> Self
source§impl From<NoCalcLength> for NonNegativeLength
impl From<NoCalcLength> for NonNegativeLength
source§fn from(len: NoCalcLength) -> Self
fn from(len: NoCalcLength) -> Self
source§impl From<NoCalcLength> for NonNegativeLengthPercentage
impl From<NoCalcLength> for NonNegativeLengthPercentage
source§fn from(len: NoCalcLength) -> Self
fn from(len: NoCalcLength) -> Self
source§impl MallocSizeOf for NoCalcLength
impl MallocSizeOf for NoCalcLength
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl PartialEq for NoCalcLength
impl PartialEq for NoCalcLength
source§impl PartialOrd for NoCalcLength
impl PartialOrd for NoCalcLength
source§impl SpecifiedValueInfo for NoCalcLength
impl SpecifiedValueInfo for NoCalcLength
source§const SUPPORTED_TYPES: u8 = 0u8
const SUPPORTED_TYPES: u8 = 0u8
source§impl ToComputedValue for NoCalcLength
impl ToComputedValue for NoCalcLength
source§type ComputedValue = CSSPixelLength
type ComputedValue = CSSPixelLength
source§fn to_computed_value(&self, context: &Context<'_>) -> Self::ComputedValue
fn to_computed_value(&self, context: &Context<'_>) -> Self::ComputedValue
Context
.source§fn from_computed_value(computed: &Self::ComputedValue) -> Self
fn from_computed_value(computed: &Self::ComputedValue) -> Self
source§impl ToCss for NoCalcLength
impl ToCss for NoCalcLength
source§impl ToShmem for NoCalcLength
impl ToShmem for NoCalcLength
source§impl Zero for NoCalcLength
impl Zero for NoCalcLength
impl Copy for NoCalcLength
impl StructuralPartialEq for NoCalcLength
Auto Trait Implementations§
impl Freeze for NoCalcLength
impl RefUnwindSafe for NoCalcLength
impl Send for NoCalcLength
impl Sync for NoCalcLength
impl Unpin for NoCalcLength
impl UnwindSafe for NoCalcLength
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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