pub(crate) struct Cascade<'a> {
first_line_reparenting: FirstLineReparenting<'a>,
stylist: &'a Stylist,
ignore_colors: bool,
seen: SeenSet<'a>,
reverted: RevertedSet,
author_specified: LonghandIdSet,
declarations_to_apply_unless_overridden: SmallVec<[PropertyDeclaration; 2]>,
may_have_custom_property_cycles: bool,
references_from_non_custom_properties: NonCustomReferenceMap<Vec<Arc<UnparsedValue>>>,
ensured_prioritary: PrioritaryPropertyIdSet,
}Fields§
§first_line_reparenting: FirstLineReparenting<'a>§stylist: &'a Stylist§ignore_colors: bool§seen: SeenSet<'a>§reverted: RevertedSet§declarations_to_apply_unless_overridden: SmallVec<[PropertyDeclaration; 2]>§may_have_custom_property_cycles: bool§references_from_non_custom_properties: NonCustomReferenceMap<Vec<Arc<UnparsedValue>>>§ensured_prioritary: PrioritaryPropertyIdSetSet of prioritary properties that have already been applied.
Implementations§
Source§impl<'a> Cascade<'a>
impl<'a> Cascade<'a>
fn new( first_line_reparenting: FirstLineReparenting<'a>, stylist: &'a Stylist, ignore_colors: bool, ) -> Self
Sourcefn new_for_custom_properties_only(stylist: &'a Stylist) -> Self
fn new_for_custom_properties_only(stylist: &'a Stylist) -> Self
Creates a Cascade for resolving custom properties outside of a full cascade (e.g. for
keyframes). The visited-style and position-try paths aren’t reachable in this mode.
fn substitute_variables_if_needed<'cache, 'decl>(
&self,
context: &mut Context<'_>,
shorthand_cache: &'cache mut ShorthandsWithPropertyReferencesCache,
declaration: &'decl PropertyDeclaration,
attribute_tracker: &mut AttributeTracker<'_>,
) -> Cow<'decl, PropertyDeclaration>where
'cache: 'decl,
fn apply_one_prioritary_property( &mut self, context: &mut Context<'_>, decls: &Declarations<'_>, cache: &mut ShorthandsWithPropertyReferencesCache, id: PrioritaryPropertyId, attr_provider: &mut AttributeTracker<'_>, )
Sourcefn did_apply_prioritary_property(
&mut self,
context: &mut Context<'_>,
id: PrioritaryPropertyId,
)
fn did_apply_prioritary_property( &mut self, context: &mut Context<'_>, id: PrioritaryPropertyId, )
Some prioritary properties need book-keeping, which this takes care of.
fn apply_non_prioritary_properties( &mut self, context: &mut Context<'_>, longhand_declarations: &[Declaration<'_>], shorthand_cache: &mut ShorthandsWithPropertyReferencesCache, properties_to_apply: &LonghandIdSet, attribute_tracker: &mut AttributeTracker<'_>, )
fn recompute_zoom_dependent_inherited_lengths(&self, context: &mut Context<'_>)
fn apply_one_longhand( &mut self, context: &mut Context<'_>, longhand_id: LonghandId, declaration: &PropertyDeclaration, priority: CascadePriority, cache: &mut ShorthandsWithPropertyReferencesCache, attribute_tracker: &mut AttributeTracker<'_>, )
unsafe fn do_apply_declaration( &self, context: &mut Context<'_>, longhand_id: LonghandId, declaration: &PropertyDeclaration, )
fn compute_visited_style_if_needed<E>(
&self,
context: &mut Context<'_>,
element: Option<E>,
parent_style: Option<&ComputedValues>,
layout_parent_style: Option<&ComputedValues>,
try_tactic: &PositionTryFallbacksTryTactic,
visited_rules: &StrongRuleNode,
guards: &StylesheetGuards<'_>,
)where
E: TElement,
fn finished_applying_properties(&self, builder: &mut StyleBuilder<'_>)
fn try_to_use_cached_reset_properties( &self, context: &mut Context<'a>, cache: Option<&'a RuleCache>, guards: &StylesheetGuards<'_>, ) -> bool
Sourcefn recompute_keyword_font_size_if_needed(&self, context: &mut Context<'_>)
fn recompute_keyword_font_size_if_needed(&self, context: &mut Context<'_>)
Some keyword sizes depend on the font family and language.
fn recompute_font_size_for_zoom_change(&self, builder: &mut StyleBuilder<'_>)
Sourcefn init_custom_properties(&mut self, context: &mut Context<'_>)
fn init_custom_properties(&mut self, context: &mut Context<'_>)
Seeds context.builder.substitution_functions with the inherited custom properties and the
registered initial values, before custom-property declarations are cascaded into it.
Sourcefn apply_custom_and_prioritary_properties(
&mut self,
context: &mut Context<'_>,
decls: &Declarations<'_>,
shorthand_cache: &mut ShorthandsWithPropertyReferencesCache,
attribute_tracker: &mut AttributeTracker<'_>,
)
fn apply_custom_and_prioritary_properties( &mut self, context: &mut Context<'_>, decls: &Declarations<'_>, shorthand_cache: &mut ShorthandsWithPropertyReferencesCache, attribute_tracker: &mut AttributeTracker<'_>, )
Resolves the custom properties and applies the prioritary properties in a single
cycle-tracked walk: as a custom property depending on em/lh/the used color-scheme
becomes resolvable, substitute_all applies the prioritary property it needs (via
ensure_prioritary_property) so it computes against the right value. Any prioritary
property not triggered that way is applied at the end.
Sourcefn ensure_prioritary_property(
&mut self,
context: &mut Context<'_>,
decls: &Declarations<'_>,
cache: &mut ShorthandsWithPropertyReferencesCache,
attribute_tracker: &mut AttributeTracker<'_>,
id: PrioritaryPropertyId,
)
fn ensure_prioritary_property( &mut self, context: &mut Context<'_>, decls: &Declarations<'_>, cache: &mut ShorthandsWithPropertyReferencesCache, attribute_tracker: &mut AttributeTracker<'_>, id: PrioritaryPropertyId, )
Applies a prioritary property and the prioritary properties it depends on.
Sourcefn cascade_custom_property(
&mut self,
context: &mut Context<'_>,
declaration: &'a CustomDeclaration,
priority: CascadePriority,
)
fn cascade_custom_property( &mut self, context: &mut Context<'_>, declaration: &'a CustomDeclaration, priority: CascadePriority, )
Cascade a given custom property declaration.
Sourcepub fn might_have_non_custom_or_attr_dependency(
id: LonghandId,
decl: &PropertyDeclaration,
) -> bool
pub fn might_have_non_custom_or_attr_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,
context: &mut Context<'_>,
id: LonghandId,
decl: &'a PropertyDeclaration,
attribute_tracker: &mut AttributeTracker<'_>,
)
pub fn maybe_note_non_custom_dependency( &mut self, context: &mut Context<'_>, id: LonghandId, decl: &'a PropertyDeclaration, attribute_tracker: &mut AttributeTracker<'_>, )
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( context: &Context<'_>, name: &Name, registration: &PropertyDescriptors, initial_values: &ComputedCustomProperties, value: &CustomDeclarationValue, ) -> bool
Sourcepub fn update_attributes_map(
&mut self,
context: &mut Context<'_>,
value: &'a VariableValue,
attribute_tracker: &mut AttributeTracker<'_>,
)
pub fn update_attributes_map( &mut self, context: &mut Context<'_>, value: &'a VariableValue, attribute_tracker: &mut AttributeTracker<'_>, )
For a given unparsed variable, update the attributes map with its attr references.
Sourcepub fn finish_cascade_custom_properties(&mut self, context: &mut Context<'_>)
pub fn finish_cascade_custom_properties(&mut self, context: &mut Context<'_>)
Computes the map of applicable custom properties, saving the result into the computed context, and applies the prioritary properties interleaved with custom-property resolution.
Auto Trait Implementations§
impl<'a> Freeze for Cascade<'a>
impl<'a> !RefUnwindSafe for Cascade<'a>
impl<'a> Send for Cascade<'a>
impl<'a> Sync for Cascade<'a>
impl<'a> Unpin for Cascade<'a>
impl<'a> UnsafeUnpin for Cascade<'a>
impl<'a> !UnwindSafe for Cascade<'a>
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