pub type ComputedValue = VariableValue;
Expand description

Both specified and computed values are VariableValues, the difference is whether var() functions are expanded.

Aliased Type§

struct ComputedValue {
    pub css: String,
    pub url_data: UrlExtraData,
    first_token_type: TokenSerializationType,
    last_token_type: TokenSerializationType,
    references: References,
}

Fields§

§css: String

The raw CSS string.

§url_data: UrlExtraData

The url data of the stylesheet where this value came from.

§first_token_type: TokenSerializationType§last_token_type: TokenSerializationType§references: References

var(), env(), or non-custom property (e.g. through em) references.

Implementations§

source§

impl VariableValue

source

fn empty(url_data: &UrlExtraData) -> Self

source

pub fn new( css: String, url_data: &UrlExtraData, first_token_type: TokenSerializationType, last_token_type: TokenSerializationType ) -> Self

Create a new custom property without parsing if the CSS is known to be valid and contain no references.

source

fn push<'i>( &mut self, css: &str, css_first_token_type: TokenSerializationType, css_last_token_type: TokenSerializationType ) -> Result<(), ()>

source

pub fn parse<'i, 't>( input: &mut Parser<'i, 't>, url_data: &UrlExtraData ) -> Result<Self, ParseError<'i>>

Parse a custom property value.

source

fn integer(number: i32, url_data: &UrlExtraData) -> Self

Create VariableValue from an int.

source

fn ident(ident: &'static str, url_data: &UrlExtraData) -> Self

Create VariableValue from an int.

source

fn pixels(number: f32, url_data: &UrlExtraData) -> Self

Create VariableValue from a float amount of CSS pixels.

source

fn int_ms(number: i32, url_data: &UrlExtraData) -> Self

Create VariableValue from an integer amount of milliseconds.

source

fn int_pixels(number: i32, url_data: &UrlExtraData) -> Self

Create VariableValue from an integer amount of CSS pixels.

source

fn from_token(token: Token<'_>, url_data: &UrlExtraData) -> Self

source

pub fn css_text(&self) -> &str

Returns the raw CSS text from this VariableValue

source

pub fn has_references(&self) -> bool

Returns whether this variable value has any reference to the environment or other variables.

Trait Implementations§

source§

impl Clone for VariableValue

source§

fn clone(&self) -> VariableValue

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 Debug for VariableValue

source§

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

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

impl MallocSizeOf for VariableValue

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

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 ToComputedValue for VariableValue

§

type ComputedValue = VariableValue

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

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

Convert a specified value to a computed value, using itself and the data inside the Context.
source§

fn from_computed_value(other: &Self) -> Self

Convert a computed value to specified value form. Read more
source§

impl ToShmem for VariableValue

source§

fn to_shmem(&self, builder: &mut SharedMemoryBuilder) -> Result<Self>

Clones this value into a form suitable for writing into a SharedMemoryBuilder. Read more
source§

impl Eq for VariableValue