Enum style::values::specified::length::LengthOrPercentage
[−]
[src]
pub enum LengthOrPercentage { Length(NoCalcLength), Percentage(Percentage), Calc(Box<CalcLengthOrPercentage>), }
A length or a percentage value.
Variants
Length(NoCalcLength)
Percentage(Percentage)
Calc(Box<CalcLengthOrPercentage>)
Methods
impl LengthOrPercentage
[src]
pub fn zero() -> LengthOrPercentage
[src]
Returns a zero
length.
pub fn parse_non_negative<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<LengthOrPercentage, ParseError<'i>>
[src]
context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<LengthOrPercentage, ParseError<'i>>
Parse a non-negative length.
pub fn parse_non_negative_quirky<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
allow_quirks: AllowQuirks
) -> Result<LengthOrPercentage, ParseError<'i>>
[src]
context: &ParserContext,
input: &mut Parser<'i, 't>,
allow_quirks: AllowQuirks
) -> Result<LengthOrPercentage, ParseError<'i>>
Parse a non-negative length, with quirks.
pub fn parse_numbers_are_pixels<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<LengthOrPercentage, ParseError<'i>>
[src]
context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<LengthOrPercentage, ParseError<'i>>
Parse a length, treating dimensionless numbers as pixels
https://www.w3.org/TR/SVG2/types.html#presentation-attribute-css-value
pub fn parse_numbers_are_pixels_non_negative<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<LengthOrPercentage, ParseError<'i>>
[src]
context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<LengthOrPercentage, ParseError<'i>>
Parse a non-negative length, treating dimensionless numbers as pixels
This is nonstandard behavior used by Firefox for SVG
pub fn take(&mut self) -> Self
[src]
Extract value from ref without a clone, replacing it with a 0 Au
Use when you need to move out of a length array without cloning
impl LengthOrPercentage
[src]
pub fn parse_quirky<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
allow_quirks: AllowQuirks
) -> Result<Self, ParseError<'i>>
[src]
context: &ParserContext,
input: &mut Parser<'i, 't>,
allow_quirks: AllowQuirks
) -> Result<Self, ParseError<'i>>
Parses a length or a percentage, allowing the unitless length quirk. https://quirks.spec.whatwg.org/#the-unitless-length-quirk
Trait Implementations
impl ToComputedValue for LengthOrPercentage
[src]
type ComputedValue = LengthOrPercentage
The computed value type we're going to be converted to.
fn to_computed_value(&self, context: &Context) -> LengthOrPercentage
[src]
Convert a specified value to a computed value, using itself and the data inside the Context
. Read more
fn from_computed_value(computed: &LengthOrPercentage) -> Self
[src]
Convert a computed value to specified value form. Read more
impl ToAbsoluteLength for SpecifiedLengthOrPercentage
[src]
fn to_pixel_length(&self, _containing_len: Option<Au>) -> Result<CSSFloat, ()>
[src]
Returns the absolute length as pixel value.
impl From<LengthOrPercentage> for FontSize
[src]
fn from(other: LengthOrPercentage) -> Self
[src]
Performs the conversion.
impl Clone for LengthOrPercentage
[src]
fn clone(&self) -> LengthOrPercentage
[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 Debug for LengthOrPercentage
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl MallocSizeOf for LengthOrPercentage
[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 LengthOrPercentage
[src]
fn eq(&self, __arg_0: &LengthOrPercentage) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &LengthOrPercentage) -> bool
[src]
This method tests for !=
.
impl ToCss for LengthOrPercentage
[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
impl From<Length> for LengthOrPercentage
[src]
fn from(len: Length) -> LengthOrPercentage
[src]
Performs the conversion.
impl From<NoCalcLength> for LengthOrPercentage
[src]
fn from(len: NoCalcLength) -> Self
[src]
Performs the conversion.
impl From<Percentage> for LengthOrPercentage
[src]
fn from(pc: Percentage) -> Self
[src]
Performs the conversion.
impl From<Percentage> for LengthOrPercentage
[src]
fn from(pc: Percentage) -> Self
[src]
Performs the conversion.
impl Parse for LengthOrPercentage
[src]
fn parse<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<Self, ParseError<'i>>
[src]
context: &ParserContext,
input: &mut Parser<'i, 't>
) -> Result<Self, ParseError<'i>>
Parse a value of this type. Read more