pub struct CalcLengthPercentage {
pub clamping_mode: AllowedNumericType,
pub has_anchor_function: bool,
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
§has_anchor_function: bool
Flag indicating if any anchor function is part of this node. This can be used to skip the traversal of calc node tree for math functions not using any anchor function.
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
source§impl CalcLengthPercentage
impl CalcLengthPercentage
fn same_unit_length_as(a: &Self, b: &Self) -> Option<(CSSFloat, CSSFloat)>
Trait Implementations§
source§impl Clone for CalcLengthPercentage
impl Clone for CalcLengthPercentage
source§fn clone(&self) -> CalcLengthPercentage
fn clone(&self) -> CalcLengthPercentage
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
source§impl PartialEq for CalcLengthPercentage
impl PartialEq for CalcLengthPercentage
source§impl SpecifiedValueInfo for CalcLengthPercentage
impl SpecifiedValueInfo for CalcLengthPercentage
source§const SUPPORTED_TYPES: u8 = 0u8
const SUPPORTED_TYPES: u8 = 0u8
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
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