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
impl LengthPercentage
sourcepub fn zero_percent() -> Self
pub fn zero_percent() -> Self
0%
fn to_calc_node(&self) -> Cow<'_, CalcNode>
sourcepub fn new_length(length: Length) -> Self
pub fn new_length(length: Length) -> Self
Constructs a length value.
sourcepub fn new_percent(percentage: Percentage) -> Self
pub fn new_percent(percentage: Percentage) -> Self
Constructs a percentage value.
sourcepub fn hundred_percent_minus(v: Self, clamping_mode: AllowedNumericType) -> Self
pub fn hundred_percent_minus(v: Self, clamping_mode: AllowedNumericType) -> Self
Given a LengthPercentage
value v
, construct the value representing
calc(100% - v)
.
sourcepub fn hundred_percent_minus_list(
list: &[&Self],
clamping_mode: AllowedNumericType
) -> Self
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)
.
sourcepub fn new_calc(node: CalcNode, clamping_mode: AllowedNumericType) -> Self
pub fn new_calc(node: CalcNode, clamping_mode: AllowedNumericType) -> Self
Constructs a calc()
value.
sourcefn new_calc_unchecked(calc: Box<CalcLengthPercentage>) -> Self
fn new_calc_unchecked(calc: Box<CalcLengthPercentage>) -> Self
Private version of new_calc() that constructs a calc() variant without checking.
fn tag(&self) -> Tag
fn unpack_mut<'a>(&'a mut self) -> UnpackedMut<'a>
fn unpack<'a>(&'a self) -> Unpacked<'a>
unsafe fn calc_ptr(&self) -> *mut CalcLengthPercentage
fn to_serializable(&self) -> Serializable
fn from_serializable(s: Serializable) -> Self
sourcepub fn is_definitely_zero(&self) -> bool
pub fn is_definitely_zero(&self) -> bool
Returns true if the computed value is absolute 0 or 0%.
sourcepub fn percentage_relative_to(&self, basis: Length) -> Length
pub fn percentage_relative_to(&self, basis: Length) -> Length
Resolves the percentage. Just an alias of resolve().
sourcepub fn has_percentage(&self) -> bool
pub fn has_percentage(&self) -> bool
Return whether there’s any percentage in this value.
sourcepub fn to_percentage(&self) -> Option<Percentage>
pub fn to_percentage(&self) -> Option<Percentage>
Converts to a <percentage>
if possible.
sourcepub fn to_used_value(&self, containing_length: Au) -> Au
pub fn to_used_value(&self, containing_length: Au) -> Au
Returns the used value.
sourcepub fn to_pixel_length(&self, containing_length: Au) -> Length
pub fn to_pixel_length(&self, containing_length: Au) -> Length
Returns the used value as CSSPixelLength.
sourcepub fn maybe_to_used_value(&self, container_len: Option<Length>) -> Option<Au>
pub fn maybe_to_used_value(&self, container_len: Option<Length>) -> Option<Au>
Convert the computed value into used value.
sourcepub fn maybe_percentage_relative_to(
&self,
container_len: Option<Length>
) -> Option<Length>
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.
sourcepub fn clamp_to_non_negative(self) -> Self
pub fn clamp_to_non_negative(self) -> Self
Returns the clamped non-negative values.
Trait Implementations§
source§impl Animate for LengthPercentage
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§impl Clone for LengthPercentage
impl Clone for LengthPercentage
source§impl ComputeSquaredDistance for LengthPercentage
impl ComputeSquaredDistance for LengthPercentage
source§fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>
source§impl Debug for LengthPercentage
impl Debug for LengthPercentage
source§impl<'de> Deserialize<'de> for LengthPercentage
impl<'de> Deserialize<'de> for LengthPercentage
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,
source§impl Drop for LengthPercentage
impl Drop for LengthPercentage
source§impl MallocSizeOf for LengthPercentage
impl MallocSizeOf for LengthPercentage
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl PartialEq<LengthPercentage> for LengthPercentage
impl PartialEq<LengthPercentage> for LengthPercentage
source§impl PositionComponent for LengthPercentage
impl PositionComponent for LengthPercentage
source§impl Serialize for LengthPercentage
impl Serialize for LengthPercentage
source§impl ToAbsoluteLength for LengthPercentage
impl ToAbsoluteLength for LengthPercentage
source§fn to_pixel_length(
&self,
containing_len: Option<ComputedLength>
) -> Result<CSSFloat, ()>
fn to_pixel_length( &self, containing_len: Option<ComputedLength> ) -> Result<CSSFloat, ()>
source§impl ToAnimatedValue for LengthPercentage
impl ToAnimatedValue for LengthPercentage
§type AnimatedValue = LengthPercentage
type AnimatedValue = LengthPercentage
source§fn to_animated_value(self) -> Self
fn to_animated_value(self) -> Self
source§fn from_animated_value(animated: Self::AnimatedValue) -> Self
fn from_animated_value(animated: Self::AnimatedValue) -> Self
source§impl ToAnimatedZero for LengthPercentage
impl ToAnimatedZero for LengthPercentage
source§fn to_animated_zero(&self) -> Result<Self, ()>
fn to_animated_zero(&self) -> Result<Self, ()>
source§impl ToCss for LengthPercentage
impl ToCss for LengthPercentage
source§impl ToResolvedValue for LengthPercentage
impl ToResolvedValue for LengthPercentage
§type ResolvedValue = LengthPercentage
type ResolvedValue = LengthPercentage
source§fn to_resolved_value(self, _: &Context<'_>) -> Self
fn to_resolved_value(self, _: &Context<'_>) -> Self
source§fn from_resolved_value(resolved: Self::ResolvedValue) -> Self
fn from_resolved_value(resolved: Self::ResolvedValue) -> Self
source§impl Zero for LengthPercentage
impl Zero for LengthPercentage
source§impl ZeroNoPercent for LengthPercentage
impl ZeroNoPercent for LengthPercentage
source§fn is_zero_no_percent(&self) -> bool
fn is_zero_no_percent(&self) -> bool
0px
should return true
, but 0%
or 1px
should return false