pub struct ElementDataRef<'a> {
v: &'a ElementData,
_borrow: AtomicRef<'a, ()>,
}Expand description
A mutable reference to ElementData.
Fields§
§v: &'a ElementData§_borrow: AtomicRef<'a, ()>Methods from Deref<Target = ElementData>§
Sourcepub fn has_styles(&self) -> bool
pub fn has_styles(&self) -> bool
Returns true if this element has styles.
Returns this element’s styles as resolved styles to use for sharing.
Returns this element’s primary style as a resolved style to use for sharing.
Sourcepub fn restyle_kind(
&self,
shared_context: &SharedStyleContext<'_>,
) -> Option<RestyleKind>
pub fn restyle_kind( &self, shared_context: &SharedStyleContext<'_>, ) -> Option<RestyleKind>
Returns the kind of restyling that we’re going to need to do on this element, based of the stored restyle hint.
Sourcefn restyle_kind_for_animation(
&self,
shared_context: &SharedStyleContext<'_>,
) -> Option<RestyleKind>
fn restyle_kind_for_animation( &self, shared_context: &SharedStyleContext<'_>, ) -> Option<RestyleKind>
Returns the kind of restyling for animation-only restyle.
Sourcepub fn is_restyle(&self) -> bool
pub fn is_restyle(&self) -> bool
Returns true if this element was restyled.
Sourcepub fn contains_restyle_data(&self) -> bool
pub fn contains_restyle_data(&self) -> bool
Returns whether this element has been part of a restyle.
Sourcepub fn safe_for_cousin_sharing(&self) -> bool
pub fn safe_for_cousin_sharing(&self) -> bool
Returns whether it is safe to perform cousin sharing based on the ComputedValues identity of the primary style in this ElementData. There are a few subtle things to check.
First, if a parent element was already styled and we traversed past it without restyling it, that may be because our clever invalidation logic was able to prove that the styles of that element would remain unchanged despite changes to the id or class attributes. However, style sharing relies on the strong guarantee that all the classes and ids up the respective parent chains are identical. As such, if we skipped styling for one (or both) of the parents on this traversal, we can’t share styles across cousins. Note that this is a somewhat conservative check. We could tighten it by having the invalidation logic explicitly flag elements for which it ellided styling.
Second, we want to only consider elements whose ComputedValues match due to a hit in the style sharing cache, rather than due to the rule-node-based reuse that happens later in the styling pipeline. The former gives us the stronger guarantees we need for style sharing, the latter does not.
Sourcepub fn may_have_starting_style(&self) -> bool
pub fn may_have_starting_style(&self) -> bool
Returns true if this element data may need to compute the starting style for CSS transitions.
Trait Implementations§
Source§impl<'a> Debug for ElementDataRef<'a>
impl<'a> Debug for ElementDataRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for ElementDataRef<'a>
impl<'a> !RefUnwindSafe for ElementDataRef<'a>
impl<'a> Send for ElementDataRef<'a>
impl<'a> Sync for ElementDataRef<'a>
impl<'a> Unpin for ElementDataRef<'a>
impl<'a> !UnwindSafe for ElementDataRef<'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