Struct style::rule_collector::RuleCollector
source · pub struct RuleCollector<'a, 'b: 'a, E>where
E: TElement,{Show 13 fields
element: E,
rule_hash_target: E,
stylist: &'a Stylist,
pseudo_element: Option<&'a PseudoElement>,
style_attribute: Option<ArcBorrow<'a, Locked<PropertyDeclarationBlock>>>,
smil_override: Option<ArcBorrow<'a, Locked<PropertyDeclarationBlock>>>,
animation_declarations: AnimationDeclarations,
rule_inclusion: RuleInclusion,
rules: &'a mut ApplicableDeclarationList,
context: &'a mut MatchingContext<'b, E::Impl>,
matches_user_and_content_rules: bool,
matches_document_author_rules: bool,
in_sort_scope: bool,
}
Expand description
An object that we use with all the intermediate state needed for the cascade.
This is done basically to be able to organize the cascade in smaller functions, and be able to reason about it easily.
Fields§
§element: E
§rule_hash_target: E
§stylist: &'a Stylist
§pseudo_element: Option<&'a PseudoElement>
§style_attribute: Option<ArcBorrow<'a, Locked<PropertyDeclarationBlock>>>
§smil_override: Option<ArcBorrow<'a, Locked<PropertyDeclarationBlock>>>
§animation_declarations: AnimationDeclarations
§rule_inclusion: RuleInclusion
§rules: &'a mut ApplicableDeclarationList
§context: &'a mut MatchingContext<'b, E::Impl>
§matches_user_and_content_rules: bool
§in_sort_scope: bool
Implementations§
source§impl<'a, 'b: 'a, E> RuleCollector<'a, 'b, E>where
E: TElement,
impl<'a, 'b: 'a, E> RuleCollector<'a, 'b, E>where
E: TElement,
sourcepub fn new(
stylist: &'a Stylist,
element: E,
pseudo_element: Option<&'a PseudoElement>,
style_attribute: Option<ArcBorrow<'a, Locked<PropertyDeclarationBlock>>>,
smil_override: Option<ArcBorrow<'a, Locked<PropertyDeclarationBlock>>>,
animation_declarations: AnimationDeclarations,
rule_inclusion: RuleInclusion,
rules: &'a mut ApplicableDeclarationList,
context: &'a mut MatchingContext<'b, E::Impl>,
) -> Self
pub fn new( stylist: &'a Stylist, element: E, pseudo_element: Option<&'a PseudoElement>, style_attribute: Option<ArcBorrow<'a, Locked<PropertyDeclarationBlock>>>, smil_override: Option<ArcBorrow<'a, Locked<PropertyDeclarationBlock>>>, animation_declarations: AnimationDeclarations, rule_inclusion: RuleInclusion, rules: &'a mut ApplicableDeclarationList, context: &'a mut MatchingContext<'b, E::Impl>, ) -> Self
Trivially construct a new collector.
sourcefn in_tree(&mut self, host: Option<E>, f: impl FnOnce(&mut Self))
fn in_tree(&mut self, host: Option<E>, f: impl FnOnce(&mut Self))
Sets up the state necessary to collect rules from a given DOM tree (either the document tree, or a shadow tree).
All rules in the same tree need to be matched together, and this function takes care of sorting them by specificity and source order.
fn in_shadow_tree(&mut self, host: E, f: impl FnOnce(&mut Self))
fn collect_stylist_rules(&mut self, origin: Origin)
fn collect_user_agent_rules(&mut self)
fn collect_user_rules(&mut self)
sourcefn collect_presentational_hints(&mut self)
fn collect_presentational_hints(&mut self)
Presentational hints.
These go before author rules, but after user rules, see: https://drafts.csswg.org/css-cascade/#preshint
fn collect_rules_in_list( &mut self, part_rules: &[Rule], cascade_level: CascadeLevel, cascade_data: &CascadeData, )
fn collect_rules_in_map( &mut self, map: &SelectorMap<Rule>, cascade_level: CascadeLevel, cascade_data: &CascadeData, )
sourcefn collect_host_and_slotted_rules(&mut self)
fn collect_host_and_slotted_rules(&mut self)
Collects the rules for the ::slotted pseudo-element and the :host pseudo-class.
fn collect_rules_from_containing_shadow_tree(&mut self)
sourcefn collect_host_rules(&mut self, shadow_cascade_order: ShadowCascadeOrder)
fn collect_host_rules(&mut self, shadow_cascade_order: ShadowCascadeOrder)
Collects the rules for the :host pseudo-class.
fn collect_part_rules_from_outer_trees(&mut self)
fn collect_style_attribute(&mut self)
fn collect_animation_rules(&mut self)
sourcepub fn collect_all(self)
pub fn collect_all(self)
Collects all the rules, leaving the result in self.rules
.
Note that !important
rules are handled during rule tree insertion.
Auto Trait Implementations§
impl<'a, 'b, E> Freeze for RuleCollector<'a, 'b, E>where
E: Freeze,
impl<'a, 'b, E> !RefUnwindSafe for RuleCollector<'a, 'b, E>
impl<'a, 'b, E> !Send for RuleCollector<'a, 'b, E>
impl<'a, 'b, E> !Sync for RuleCollector<'a, 'b, E>
impl<'a, 'b, E> Unpin for RuleCollector<'a, 'b, E>where
E: Unpin,
impl<'a, 'b, E> !UnwindSafe for RuleCollector<'a, 'b, E>
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