Struct style::data::ElementData [] [src]

pub struct ElementData {
    pub styles: ElementStyles,
    pub damage: RestyleDamage,
    pub hint: RestyleHint,
    pub flags: ElementDataFlags,
}

Style system data associated with an Element.

In Gecko, this hangs directly off the Element. Servo, this is embedded inside of layout data, which itself hangs directly off the Element. In both cases, it is wrapped inside an AtomicRefCell to ensure thread safety.

Fields

The styles for the element and its pseudo-elements.

The restyle damage, indicating what kind of layout changes are required afte restyling.

The restyle hint, which indicates whether selectors need to be rematched for this element, its children, and its descendants.

Flags.

Methods

impl ElementData
[src]

[src]

Invalidates style for this element, its descendants, and later siblings, based on the snapshot of the element that we took when attributes or state changed.

[src]

Returns true if this element has styles.

[src]

Returns this element's styles as resolved styles to use for sharing.

[src]

Returns this element's primary style as a resolved style to use for sharing.

[src]

Sets a new set of styles, returning the old ones.

[src]

Returns the kind of restyling that we're going to need to do on this element, based of the stored restyle hint.

[src]

Return true if important rules are different. We use this to make sure the cascade of off-main thread animations is correct. Note: Ignore custom properties for now because we only support opacity and transform properties for animations running on compositor. Actually, we only care about opacity and transform for now, but it's fine to compare all properties and let the user the check which properties do they want. If it costs too much, get_properties_overriding_animations() should return a set containing only opacity and transform properties.

[src]

Drops any restyle state from the element.

FIXME(bholley): The only caller of this should probably just assert that the hint is empty and call clear_flags_and_damage().

[src]

Drops restyle flags and damage from the element.

[src]

Returns whether this element is going to be reconstructed.

[src]

Mark this element as restyled, which is useful to know whether we need to do a post-traversal.

[src]

Returns true if this element was restyled.

[src]

Mark that we traversed this element without computing any style for it.

[src]

Returns whether the element was traversed without computing any style for it.

[src]

Returns whether this element has been part of a restyle.

[src]

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.

Trait Implementations

impl Debug for ElementData
[src]

[src]

Formats the value using the given formatter. Read more

impl Default for ElementData
[src]

[src]

Returns the "default value" for a type. Read more