pub type VerticalPosition = LengthPercentage;
Expand description

The computed value of a CSS vertical position.

Aliased Type§

struct VerticalPosition(LengthPercentageUnion);

Fields§

§0: LengthPercentageUnion

Implementations§

source§

impl LengthPercentage

source

pub fn one() -> Self

1px length value for SVG defaults

source

pub fn zero_percent() -> Self

0%

source

fn to_calc_node(&self) -> Cow<'_, CalcNode>

source

pub fn new_length(length: Length) -> Self

Constructs a length value.

source

pub fn new_percent(percentage: Percentage) -> Self

Constructs a percentage value.

source

pub fn hundred_percent_minus(v: Self, clamping_mode: AllowedNumericType) -> Self

Given a LengthPercentage value v, construct the value representing calc(100% - v).

source

pub fn hundred_percent_minus_list( list: &[&Self], clamping_mode: AllowedNumericType ) -> Self

Given a list of LengthPercentage values, construct the value representing calc(100% - the sum of the list).

source

pub fn new_calc(node: CalcNode, clamping_mode: AllowedNumericType) -> Self

Constructs a calc() value.

source

fn new_calc_unchecked(calc: Box<CalcLengthPercentage>) -> Self

Private version of new_calc() that constructs a calc() variant without checking.

source

fn tag(&self) -> Tag

source

fn unpack_mut<'a>(&'a mut self) -> UnpackedMut<'a>

source

fn unpack<'a>(&'a self) -> Unpacked<'a>

source

unsafe fn calc_ptr(&self) -> *mut CalcLengthPercentage

source

fn to_serializable(&self) -> Serializable

source

fn from_serializable(s: Serializable) -> Self

source

pub fn is_definitely_zero(&self) -> bool

Returns true if the computed value is absolute 0 or 0%.

source

pub fn resolve(&self, basis: Length) -> Length

Resolves the percentage.

source

pub fn percentage_relative_to(&self, basis: Length) -> Length

Resolves the percentage. Just an alias of resolve().

source

pub fn has_percentage(&self) -> bool

Return whether there’s any percentage in this value.

source

pub fn to_length(&self) -> Option<Length>

Converts to a <length> if possible.

source

pub fn to_percentage(&self) -> Option<Percentage>

Converts to a <percentage> if possible.

source

pub fn to_used_value(&self, containing_length: Au) -> Au

Returns the used value.

source

pub fn to_pixel_length(&self, containing_length: Au) -> Length

Returns the used value as CSSPixelLength.

source

pub fn maybe_to_used_value(&self, container_len: Option<Length>) -> Option<Au>

Convert the computed value into used value.

source

pub fn maybe_percentage_relative_to( &self, container_len: Option<Length> ) -> Option<Length>

If there are special rules for computing percentages in a value (e.g. the height property), they apply whenever a calc() expression contains percentages.

source

pub fn clamp_to_non_negative(self) -> Self

Returns the clamped non-negative values.

source§

impl LengthPercentage

source

pub fn normal() -> Self

Return the normal computed value, which is just zero.

Trait Implementations§

source§

impl Animate for LengthPercentage

https://drafts.csswg.org/css-transitions/#animtype-lpcalc https://drafts.csswg.org/css-values-4/#combine-math https://drafts.csswg.org/css-values-4/#combine-mixed

source§

fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()>

Animate a value towards another one, given an animation procedure.
source§

impl Clone for LengthPercentage

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ComputeSquaredDistance for LengthPercentage

source§

fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>

Computes the squared distance between two animatable values.
source§

impl Debug for LengthPercentage

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for LengthPercentage

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Drop for LengthPercentage

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl MallocSizeOf for LengthPercentage

source§

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<LengthPercentage> for LengthPercentage

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PositionComponent for LengthPercentage

source§

fn is_center(&self) -> bool

Returns if the position component is 50% or center. For pixel lengths, it always returns false.
source§

impl Serialize for LengthPercentage

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl ToAbsoluteLength for LengthPercentage

source§

fn to_pixel_length( &self, containing_len: Option<ComputedLength> ) -> Result<CSSFloat, ()>

Returns the absolute length as pixel value.
source§

impl ToAnimatedValue for LengthPercentage

§

type AnimatedValue = LengthPercentage

The type of the animated value.
source§

fn to_animated_value(self) -> Self

Converts this value to an animated value.
source§

fn from_animated_value(animated: Self::AnimatedValue) -> Self

Converts back an animated value into a computed value.
source§

impl ToAnimatedZero for LengthPercentage

source§

fn to_animated_zero(&self) -> Result<Self, ()>

Returns a value that, when added with an underlying value, will produce the underlying value. This is used for SMIL animation’s “by-animation” where SMIL first interpolates from the zero value to the ‘by’ value, and then adds the result to the underlying value. Read more
source§

impl ToCss for LengthPercentage

source§

fn to_css<W>(&self, dest: &mut CssWriter<'_, W>) -> Resultwhere W: Write,

Serialize self in CSS syntax, writing to dest.
source§

fn to_css_string(&self) -> String

Serialize self in CSS syntax and return a string. Read more
source§

impl ToResolvedValue for LengthPercentage

§

type ResolvedValue = LengthPercentage

The resolved value type we’re going to be converted to.
source§

fn to_resolved_value(self, _: &Context<'_>) -> Self

Convert a resolved value to a resolved value.
source§

fn from_resolved_value(resolved: Self::ResolvedValue) -> Self

Convert a resolved value to resolved value form.
source§

impl Zero for LengthPercentage

source§

fn zero() -> Self

Returns the zero value.
source§

fn is_zero(&self) -> bool

Returns whether this value is zero.
source§

impl ZeroNoPercent for LengthPercentage

source§

fn is_zero_no_percent(&self) -> bool

So, 0px should return true, but 0% or 1px should return false