Struct style::values::computed::length::CalcLengthOrPercentage
[−]
[src]
pub struct CalcLengthOrPercentage {
pub clamping_mode: AllowedNumericType,
pub percentage: Option<Percentage>,
// some fields omitted
}Fields
clamping_mode: AllowedNumericType
percentage: Option<Percentage>
Methods
impl CalcLengthOrPercentage[src]
pub fn new(length: Length, percentage: Option<Percentage>) -> Self[src]
Returns a new CalcLengthOrPercentage.
pub fn with_clamping_mode(
length: Length,
percentage: Option<Percentage>,
clamping_mode: AllowedNumericType
) -> Self[src]
length: Length,
percentage: Option<Percentage>,
clamping_mode: AllowedNumericType
) -> Self
Returns a new CalcLengthOrPercentage with a specific clamping mode.
pub fn length(&self) -> CSSPixelLength[src]
Returns this calc() as a <length>.
Panics in debug mode if a percentage is present in the expression.
pub fn length_component(&self) -> CSSPixelLength[src]
Returns the length component of this calc()
pub fn unclamped_length(&self) -> CSSPixelLength[src]
Returns the <length> component of this calc(), unclamped.
pub fn percentage(&self) -> CSSFloat[src]
Return the percentage value as CSSFloat.
pub fn to_used_value(&self, container_len: Option<Au>) -> Option<Au>[src]
Convert the computed value into used value.
pub fn to_pixel_length(&self, container_len: Option<Au>) -> Option<Length>[src]
If there are special rules for computing percentages in a value (e.g. the height property), they apply whenever a calc() expression contains percentages.
Trait Implementations
impl Clone for CalcLengthOrPercentage[src]
fn clone(&self) -> CalcLengthOrPercentage[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Copy for CalcLengthOrPercentage[src]
impl Debug for CalcLengthOrPercentage[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more
impl MallocSizeOf for CalcLengthOrPercentage[src]
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize[src]
Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself. Read more
impl PartialEq for CalcLengthOrPercentage[src]
fn eq(&self, __arg_0: &CalcLengthOrPercentage) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &CalcLengthOrPercentage) -> bool[src]
This method tests for !=.
impl ToAnimatedZero for CalcLengthOrPercentage[src]
fn to_animated_zero(&self) -> Result<Self, ()>[src]
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
impl ComputeSquaredDistance for CalcLengthOrPercentage[src]
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()>[src]
Computes the squared distance between two animatable values.
impl From<LengthOrPercentage> for CalcLengthOrPercentage[src]
fn from(len: LengthOrPercentage) -> CalcLengthOrPercentage[src]
Performs the conversion.
impl ToCss for CalcLengthOrPercentage[src]
fn to_css<W>(&self, dest: &mut W) -> Result where
W: Write, [src]
W: Write,
Serialize self in CSS syntax, writing to dest.
fn to_css_string(&self) -> String[src]
Serialize self in CSS syntax and return a string. Read more