pub struct VariableValue {
pub css: String,
pub url_data: UrlExtraData,
pub references: References,
pub explicitly_attr_tainted: bool,
/* private fields */
}Expand description
A value for a custom property is just a set of tokens.
We preserve the original CSS for serialization, and also the variable references to other custom property names.
Fields§
§css: StringThe raw CSS string.
url_data: UrlExtraDataThe url data of the stylesheet where this value came from.
references: Referencesvar(), env(), attr() or non-custom property (e.g. through em) references.
explicitly_attr_tainted: boolWas this variable value attr tainted before. Used to keep attr tainting information when uncomputing a style that needs to be put back into the cascade.
Implementations§
Source§impl VariableValue
impl VariableValue
Sourcepub fn new(
css: String,
url_data: &UrlExtraData,
first_token_type: TokenSerializationType,
last_token_type: TokenSerializationType,
) -> Self
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.
Sourcepub fn parse(
input: &mut Parser<'_>,
namespaces: Option<&FxHashMap<Prefix, Namespace>>,
url_data: &UrlExtraData,
) -> Result<Self, ParseError>
pub fn parse( input: &mut Parser<'_>, namespaces: Option<&FxHashMap<Prefix, Namespace>>, url_data: &UrlExtraData, ) -> Result<Self, ParseError>
Parse a custom property value.
Sourcepub fn is_attr_tainted(&self) -> bool
pub fn is_attr_tainted(&self) -> bool
Returns whether this value is tainted by attr().
Sourcepub fn has_references(&self) -> bool
pub fn has_references(&self) -> bool
Returns whether this variable value has any reference to the environment or other variables.
Sourcepub fn collect_attribute_references(&self, references: &mut AttrReferenceSet)
pub fn collect_attribute_references(&self, references: &mut AttrReferenceSet)
Returns the attribute references in this variable value, if any.
Trait Implementations§
Source§impl Clone for VariableValue
impl Clone for VariableValue
Source§impl Debug for VariableValue
impl Debug for VariableValue
impl Eq for VariableValue
Source§impl MallocSizeOf for VariableValue
impl MallocSizeOf for VariableValue
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Source§impl PartialEq for VariableValue
impl PartialEq for VariableValue
Source§impl ToComputedValue for VariableValue
impl ToComputedValue for VariableValue
Source§type ComputedValue = VariableValue
type ComputedValue = VariableValue
Source§fn to_computed_value(&self, _: &Context<'_>) -> Self
fn to_computed_value(&self, _: &Context<'_>) -> Self
Context.Source§fn from_computed_value(other: &Self) -> Self
fn from_computed_value(other: &Self) -> Self
Source§impl ToResolvedValue for VariableValue
impl ToResolvedValue for VariableValue
Source§type ResolvedValue = VariableValue
type ResolvedValue = VariableValue
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 ToShmem for VariableValue
impl ToShmem for VariableValue
Auto Trait Implementations§
impl Freeze for VariableValue
impl RefUnwindSafe for VariableValue
impl Send for VariableValue
impl Sync for VariableValue
impl Unpin for VariableValue
impl UnsafeUnpin for VariableValue
impl UnwindSafe for VariableValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more