Skip to main content

RestyleWalk

Struct RestyleWalk 

Source
pub struct RestyleWalk<'a> { /* private fields */ }
Expand description

A walk down a live tree that resolves each element from scratch: from its identity, its place in the tree, and what it declares about itself, against the stylesheet. It is the first cascade’s walk over the document, one element at a time, so an element resolved here comes out as it did then, and a property nothing sets any more is unset.

Resolve an element, enter it to resolve its children, and leave it after. Each child sees the custom properties and inherited text its parent resolved, and ancestor selectors match on the chain entered so far.

Implementations§

Source§

impl<'a> RestyleWalk<'a>

Source

pub fn new( css: &'a Stylesheet, media: &'a MediaContext, ancestors: &[AncestorInfo], ) -> Self

A walk whose next element is a child of ancestors (root-first); with none, the next element is a document root. Each ancestor is resolved on the way down, so the scope it hands on is the one the first cascade handed on.

Source

pub fn resolve(&mut self, node: &AncestorInfo) -> Attributes

Resolve node, a child of the element entered last.

The result holds the element’s identity and every style property the cascade gave it, and nothing else.

Source

pub fn enter(&mut self)

Descend into the element resolved last.

Source

pub fn leave(&mut self)

Climb back out of the element entered last.

Source

pub fn take_warnings(&mut self) -> Vec<CssWarning>

The declarations skipped so far, deduplicated, emptying the list.

Auto Trait Implementations§

§

impl<'a> Freeze for RestyleWalk<'a>

§

impl<'a> RefUnwindSafe for RestyleWalk<'a>

§

impl<'a> !Send for RestyleWalk<'a>

§

impl<'a> !Sync for RestyleWalk<'a>

§

impl<'a> Unpin for RestyleWalk<'a>

§

impl<'a> UnsafeUnpin for RestyleWalk<'a>

§

impl<'a> UnwindSafe for RestyleWalk<'a>

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> IntoResult<T> for T

§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more