pub struct CalcLengthPercentage {
pub clamping_mode: AllowedNumericType,
pub node: CalcNode,
}
Expand description
A struct to hold a simplified <length>
or <percentage>
expression.
In some cases, e.g. DOMMatrix, we support calc(), but reject all the relative lengths, and to_computed_pixel_length_without_context() handles this case. Therefore, if you want to add a new field, please make sure this function work properly.
Fields§
§clamping_mode: AllowedNumericType
§node: CalcNode
Implementations§
source§impl CalcLengthPercentage
impl CalcLengthPercentage
sourcefn to_computed_value_with_zoom<F>(
&self,
context: &Context<'_>,
zoom_fn: F,
base_size: FontBaseSize,
line_height_base: LineHeightBase,
) -> LengthPercentage
fn to_computed_value_with_zoom<F>( &self, context: &Context<'_>, zoom_fn: F, base_size: FontBaseSize, line_height_base: LineHeightBase, ) -> LengthPercentage
Compute the value, zooming any absolute units by the zoom function.
sourcepub fn to_computed_value_zoomed(
&self,
context: &Context<'_>,
base_size: FontBaseSize,
line_height_base: LineHeightBase,
) -> LengthPercentage
pub fn to_computed_value_zoomed( &self, context: &Context<'_>, base_size: FontBaseSize, line_height_base: LineHeightBase, ) -> LengthPercentage
Compute font-size or line-height taking into account text-zoom if necessary.
sourcepub fn to_computed_pixel_length_without_context(&self) -> Result<CSSFloat, ()>
pub fn to_computed_pixel_length_without_context(&self) -> Result<CSSFloat, ()>
Compute the value into pixel length as CSSFloat without context, so it returns Err(()) if there is any non-absolute unit.
sourcepub fn to_computed_value(&self, context: &Context<'_>) -> LengthPercentage
pub fn to_computed_value(&self, context: &Context<'_>) -> LengthPercentage
Compute the calc using the current font-size and line-height. (and without text-zoom).
fn from_computed_value(computed: &CalcLengthPercentage) -> Self
Trait Implementations§
source§impl Clone for CalcLengthPercentage
impl Clone for CalcLengthPercentage
source§fn clone(&self) -> CalcLengthPercentage
fn clone(&self) -> CalcLengthPercentage
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for CalcLengthPercentage
impl Debug for CalcLengthPercentage
source§impl MallocSizeOf for CalcLengthPercentage
impl MallocSizeOf for CalcLengthPercentage
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
source§impl PartialEq for CalcLengthPercentage
impl PartialEq for CalcLengthPercentage
source§fn eq(&self, other: &CalcLengthPercentage) -> bool
fn eq(&self, other: &CalcLengthPercentage) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl SpecifiedValueInfo for CalcLengthPercentage
impl SpecifiedValueInfo for CalcLengthPercentage
source§const SUPPORTED_TYPES: u8 = 0u8
const SUPPORTED_TYPES: u8 = 0u8
Supported CssTypes by the given value type. Read more
source§impl ToCss for CalcLengthPercentage
impl ToCss for CalcLengthPercentage
source§impl ToShmem for CalcLengthPercentage
impl ToShmem for CalcLengthPercentage
impl StructuralPartialEq for CalcLengthPercentage
Auto Trait Implementations§
impl Freeze for CalcLengthPercentage
impl RefUnwindSafe for CalcLengthPercentage
impl Send for CalcLengthPercentage
impl Sync for CalcLengthPercentage
impl Unpin for CalcLengthPercentage
impl UnwindSafe for CalcLengthPercentage
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
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 moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert