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§matches_document_author_rules: bool§in_sort_scope: bool

Implementations§

source§

impl<'a, 'b: 'a, E> RuleCollector<'a, 'b, E>
where E: TElement,

source

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.

source

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.

source

fn in_shadow_tree(&mut self, host: E, f: impl FnOnce(&mut Self))

source

fn collect_stylist_rules(&mut self, origin: Origin)

source

fn collect_user_agent_rules(&mut self)

source

fn collect_user_rules(&mut self)

source

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

source

fn collect_rules_in_list( &mut self, part_rules: &[Rule], cascade_level: CascadeLevel, cascade_data: &CascadeData, )

source

fn collect_rules_in_map( &mut self, map: &SelectorMap<Rule>, cascade_level: CascadeLevel, cascade_data: &CascadeData, )

source

fn collect_host_and_slotted_rules(&mut self)

Collects the rules for the ::slotted pseudo-element and the :host pseudo-class.

source

fn collect_rules_from_containing_shadow_tree(&mut self)

source

fn collect_host_rules(&mut self, shadow_cascade_order: ShadowCascadeOrder)

Collects the rules for the :host pseudo-class.

source

fn collect_document_author_rules(&mut self)

source

fn collect_part_rules_from_outer_trees(&mut self)

source

fn collect_style_attribute(&mut self)

source

fn collect_animation_rules(&mut self)

source

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T> MaybeBoxed<Box<T>> for T

source§

fn maybe_boxed(self) -> Box<T>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T