pub struct CustomPropertiesBuilder<'a, 'b: 'a> {
seen: PrecomputedHashSet<&'a Name>,
may_have_cycles: bool,
has_color_scheme: bool,
custom_properties: ComputedCustomProperties,
reverted: PrecomputedHashMap<&'a Name, (CascadePriority, bool)>,
stylist: &'a Stylist,
computed_context: &'a mut Context<'b>,
references_from_non_custom_properties: NonCustomReferenceMap<Vec<Name>>,
}Expand description
A struct that takes care of encapsulating the cascade process for custom properties.
Fields§
§seen: PrecomputedHashSet<&'a Name>§may_have_cycles: bool§has_color_scheme: bool§custom_properties: ComputedCustomProperties§reverted: PrecomputedHashMap<&'a Name, (CascadePriority, bool)>§stylist: &'a Stylist§computed_context: &'a mut Context<'b>§references_from_non_custom_properties: NonCustomReferenceMap<Vec<Name>>Implementations§
Source§impl<'a, 'b: 'a> CustomPropertiesBuilder<'a, 'b>
impl<'a, 'b: 'a> CustomPropertiesBuilder<'a, 'b>
Sourcepub fn new_with_properties(
stylist: &'a Stylist,
custom_properties: ComputedCustomProperties,
computed_context: &'a mut Context<'b>,
) -> Self
pub fn new_with_properties( stylist: &'a Stylist, custom_properties: ComputedCustomProperties, computed_context: &'a mut Context<'b>, ) -> Self
Create a new builder, inheriting from a given custom properties map.
We expose this publicly mostly for @keyframe blocks.
Sourcepub fn new(stylist: &'a Stylist, context: &'a mut Context<'b>) -> Self
pub fn new(stylist: &'a Stylist, context: &'a mut Context<'b>) -> Self
Create a new builder, inheriting from the right style given context.
Sourcepub fn cascade(
&mut self,
declaration: &'a CustomDeclaration,
priority: CascadePriority,
)
pub fn cascade( &mut self, declaration: &'a CustomDeclaration, priority: CascadePriority, )
Cascade a given custom property declaration.
Sourcepub fn might_have_non_custom_dependency(
id: LonghandId,
decl: &PropertyDeclaration,
) -> bool
pub fn might_have_non_custom_dependency( id: LonghandId, decl: &PropertyDeclaration, ) -> bool
Fast check to avoid calling maybe_note_non_custom_dependency in ~all cases.
Sourcepub fn maybe_note_non_custom_dependency(
&mut self,
id: LonghandId,
decl: &PropertyDeclaration,
)
pub fn maybe_note_non_custom_dependency( &mut self, id: LonghandId, decl: &PropertyDeclaration, )
Note a non-custom property with variable reference that may in turn depend on that property.
e.g. font-size depending on a custom property that may be a registered property using em.
fn value_may_affect_style( &self, name: &Name, value: &CustomDeclarationValue, ) -> bool
Sourcepub fn build(
self,
defer: DeferFontRelativeCustomPropertyResolution,
) -> Option<CustomPropertiesMap>
pub fn build( self, defer: DeferFontRelativeCustomPropertyResolution, ) -> Option<CustomPropertiesMap>
Computes the map of applicable custom properties, as well as longhand properties that are now considered invalid-at-compute time. The result is saved into the computed context.
If there was any specified property or non-inherited custom property with an initial value, we’ve created a new map and now we need to remove any potential cycles (And marking non-custom properties), and wrap it in an arc.
Some registered custom properties may require font-related properties
be resolved to resolve. If these properties are not resolved at this time,
defer should be set to Yes, which will leave such custom properties,
and other properties referencing them, untouched. These properties are
returned separately, to be resolved by build_deferred to fully resolve
all custom properties after all necessary non-custom properties are resolved.
Sourcepub fn build_deferred(
deferred: CustomPropertiesMap,
stylist: &Stylist,
computed_context: &mut Context<'_>,
)
pub fn build_deferred( deferred: CustomPropertiesMap, stylist: &Stylist, computed_context: &mut Context<'_>, )
Fully resolve all deferred custom properties, assuming that the incoming context has necessary properties resolved.
Auto Trait Implementations§
impl<'a, 'b> Freeze for CustomPropertiesBuilder<'a, 'b>
impl<'a, 'b> !RefUnwindSafe for CustomPropertiesBuilder<'a, 'b>
impl<'a, 'b> !Send for CustomPropertiesBuilder<'a, 'b>
impl<'a, 'b> !Sync for CustomPropertiesBuilder<'a, 'b>
impl<'a, 'b> Unpin for CustomPropertiesBuilder<'a, 'b>
impl<'a, 'b> !UnwindSafe for CustomPropertiesBuilder<'a, 'b>
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> 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