Struct style::values::specified::calc::CalcLengthOrPercentage
[−]
[src]
pub struct CalcLengthOrPercentage { pub clamping_mode: AllowedNumericType, pub absolute: Option<AbsoluteLength>, pub vw: Option<CSSFloat>, pub vh: Option<CSSFloat>, pub vmin: Option<CSSFloat>, pub vmax: Option<CSSFloat>, pub em: Option<CSSFloat>, pub ex: Option<CSSFloat>, pub ch: Option<CSSFloat>, pub rem: Option<CSSFloat>, pub percentage: Option<Percentage>, }
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
absolute: Option<AbsoluteLength>
vw: Option<CSSFloat>
vh: Option<CSSFloat>
vmin: Option<CSSFloat>
vmax: Option<CSSFloat>
em: Option<CSSFloat>
ex: Option<CSSFloat>
ch: Option<CSSFloat>
rem: Option<CSSFloat>
percentage: Option<Percentage>
Methods
impl CalcLengthOrPercentage
[src]
pub fn to_computed_value_zoomed(
&self,
context: &Context,
base_size: FontBaseSize
) -> CalcLengthOrPercentage
[src]
&self,
context: &Context,
base_size: FontBaseSize
) -> CalcLengthOrPercentage
Compute font-size or line-height taking into account text-zoom if necessary.
pub fn to_computed_pixel_length_without_context(&self) -> Result<CSSFloat, ()>
[src]
Compute the value into pixel length as CSSFloat without context, so it returns Err(()) if there is any non-absolute unit.
Trait Implementations
impl ToComputedValue for CalcLengthOrPercentage
[src]
type ComputedValue = CalcLengthOrPercentage
The computed value type we're going to be converted to.
fn to_computed_value(&self, context: &Context) -> CalcLengthOrPercentage
[src]
Convert a specified value to a computed value, using itself and the data inside the Context
. Read more
fn from_computed_value(computed: &CalcLengthOrPercentage) -> Self
[src]
Convert a computed value to specified value form. Read more
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 Default for CalcLengthOrPercentage
[src]
fn default() -> CalcLengthOrPercentage
[src]
Returns the "default value" for a type. 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 ToCss for CalcLengthOrPercentage
[src]
fn to_css<W>(&self, dest: &mut W) -> Result where
W: Write,
[src]
W: Write,
https://drafts.csswg.org/css-values/#calc-serialize
FIXME(emilio): Should this simplify away zeros?
fn to_css_string(&self) -> String
[src]
Serialize self
in CSS syntax and return a string. Read more