pub struct ElementData {Show 32 fields
pub name: QualName,
pub id: Option<Atom>,
pub attrs: Attributes,
pub is_focussable: bool,
pub style_attribute: Option<Arc<Locked<PropertyDeclarationBlock>>>,
pub special_data: SpecialElementData,
pub background_images: Vec<Option<ImageResourceData>>,
pub mask_images: Vec<Option<ImageResourceData>>,
pub inline_layout_data: Option<Box<TextLayout>>,
pub list_item_data: Option<Box<ListItemLayout>>,
pub template_contents: Option<NodeId>,
pub shadow_root: Option<NodeId>,
pub assigned_slot: Option<NodeId>,
pub stylo_element_data: StyloData,
pub selector_flags: Cell<ElementSelectorFlags>,
pub guard: Option<SharedRwLock>,
pub element_state: ElementState,
pub has_snapshot: bool,
pub snapshot_handled: AtomicBool,
pub dirty_descendants: AtomicBool,
pub before: Option<NodeId>,
pub after: Option<NodeId>,
pub detailed_grid_info: Option<Box<DetailedGridInfo>>,
pub style: Style<Atom>,
pub subtree_hoists: bool,
pub style_source: Option<Arc<ComputedValues>>,
pub display_constructed_as: Display,
pub unrounded_layout: Layout,
pub final_layout: Layout,
pub scroll_offset: Point<f64>,
pub scrollable_overflow: Rect,
pub transform: Option<Affine>,
/* private fields */
}Fields§
§name: QualNameThe elements tag name, namespace and prefix
id: Option<Atom>The elements id attribute parsed as an atom (if it has one)
attrs: AttributesThe element’s attributes
is_focussable: boolWhether the element is focussable
style_attribute: Option<Arc<Locked<PropertyDeclarationBlock>>>The element’s parsed style attribute (used by stylo)
special_data: SpecialElementDataHeterogeneous data that depends on the element’s type. For example:
- The image data for <img> elements.
- The parley Layout for inline roots.
- The text editor for input/textarea elements
background_images: Vec<Option<ImageResourceData>>§mask_images: Vec<Option<ImageResourceData>>§inline_layout_data: Option<Box<TextLayout>>Parley text layout (elements with inline inner display mode only)
list_item_data: Option<Box<ListItemLayout>>Data associated with display: list-item. Note that this display mode does not exclude inline_layout_data
template_contents: Option<NodeId>The element’s template contents (<template> elements only)
shadow_root: Option<NodeId>The node id of the shadow root attached to this element (if it is a shadow host). The shadow root node’s children form the shadow tree.
assigned_slot: Option<NodeId>If this element is a light-DOM child of a shadow host, the node id of
the <slot> element it has been assigned to in the host’s shadow tree
(if any). Recomputed during slot assignment.
stylo_element_data: StyloDataStyle data from stylo, plus a lock guard that allows access to it.
selector_flags: Cell<ElementSelectorFlags>§guard: Option<SharedRwLock>A clone of the document’s shared style lock. Set when the owning
Node is constructed.
element_state: ElementState§has_snapshot: bool§snapshot_handled: AtomicBool§dirty_descendants: AtomicBoolWhether any descendant of this node needs restyling. Used by Stylo’s incremental style traversal to skip unchanged subtrees.
before: Option<NodeId>§after: Option<NodeId>§detailed_grid_info: Option<Box<DetailedGridInfo>>Detailed grid track sizing information from the most recent layout (grid containers only). Used by devtools grid inspection.
style: Style<Atom>§subtree_hoists: boolWhether flushing this subtree contributes anything to an ancestor’s
paint order: a hoisted position: fixed node, or a descendant that
pushes into an ancestor’s stacking context.
Set while flushing, read to decide whether a subtree with no damage can be skipped entirely. Without it the walk cannot be skipped at all: an ancestor rebuilds its stacking context from scratch, so a subtree that feeds it and is not walked simply vanishes from paint.
style_source: Option<Arc<ComputedValues>>The computed values style was built from, held alive.
A taffy Style does not own its calc() values. stylo_taffy stores a
raw pointer to the stylo CalcLengthPercentage, and that value lives
inside these ComputedValues. Drop them while the taffy style survives
and the next layout dereferences freed memory. Keeping the arc here
keeps the pointee alive, and comparing its identity is how a restyle is
told apart from a no-op. See flush_styles_to_layout_impl.
display_constructed_as: Display§unrounded_layout: Layout§final_layout: Layout§scroll_offset: Point<f64>§scrollable_overflow: Rect§transform: Option<Affine>Implementations§
Source§impl ElementData
impl ElementData
Sourcepub fn cache(&self) -> &Cache
pub fn cache(&self) -> &Cache
This node’s layout cache, or a shared empty one if it has never been
laid out. See the cache field for why it is optional.
Sourcepub fn cache_mut(&mut self) -> &mut Cache
pub fn cache_mut(&mut self) -> &mut Cache
This node’s layout cache, allocating it if this is the first use.
Every caller of this is taffy storing or clearing a measurement, which is exactly the moment a node stops being one that never lays out.
Sourcepub fn cache_release(&mut self)
pub fn cache_release(&mut self)
Drop the cache entirely rather than emptying it in place.
cache_clear runs on every node whose layout is invalidated, and the
old code zeroed 1616 bytes there. Releasing the box instead returns the
memory, and a node that is cleared and never re-measured (a subtree that
became display: none, say) stops paying for the cache at all.
pub fn new(name: QualName, attrs: Vec<Attribute>) -> Self
pub fn attrs(&self) -> &[Attribute]
pub fn attr(&self, name: impl PartialEq<LocalName>) -> Option<&str>
pub fn attr_parsed<T: FromStr>( &self, name: impl PartialEq<LocalName>, ) -> Option<T>
Sourcepub fn has_attr(&self, name: impl PartialEq<LocalName>) -> bool
pub fn has_attr(&self, name: impl PartialEq<LocalName>) -> bool
Detects the presence of the attribute, treating any value as truthy.
pub fn can_be_disabled(&self) -> bool
pub fn image_data(&self) -> Option<&ImageData>
pub fn image_data_mut(&mut self) -> Option<&mut ImageData>
pub fn raster_image_data(&self) -> Option<&RasterImageData>
pub fn raster_image_data_mut(&mut self) -> Option<&mut RasterImageData>
pub fn canvas_data(&self) -> Option<&CanvasData>
pub fn sub_doc_data(&self) -> Option<&dyn Document>
pub fn sub_doc_data_mut(&mut self) -> Option<&mut dyn Document>
pub fn svg_data(&self) -> Option<&Tree>
pub fn text_input_data(&self) -> Option<&TextInputData>
pub fn text_input_data_mut(&mut self) -> Option<&mut TextInputData>
pub fn custom_widget_data(&self) -> Option<&CustomWidgetData>
pub fn custom_widget_data_mut(&mut self) -> Option<&mut CustomWidgetData>
pub fn checkbox_input_checked(&self) -> Option<bool>
pub fn checkbox_input_checked_mut(&mut self) -> Option<&mut bool>
pub fn file_data(&self) -> Option<&FileData>
pub fn file_data_mut(&mut self) -> Option<&mut FileData>
pub fn flush_is_focussable(&mut self)
pub fn flush_style_attribute( &mut self, guard: &SharedRwLock, url_extra_data: &UrlExtraData, )
pub fn set_style_property( &mut self, name: &str, value: &str, guard: &SharedRwLock, url_extra_data: UrlExtraData, ) -> bool
pub fn remove_style_property( &mut self, name: &str, guard: &SharedRwLock, url_extra_data: UrlExtraData, ) -> bool
pub fn set_sub_document(&mut self, sub_document: Box<dyn Document>)
pub fn remove_sub_document(&mut self)
pub fn set_custom_widget(&mut self, widget: Box<dyn Widget>)
pub fn remove_custom_widget(&mut self) -> Vec<ResourceId>
pub fn take_inline_layout(&mut self) -> Option<Box<TextLayout>>
Trait Implementations§
Source§impl Clone for ElementData
impl Clone for ElementData
Source§fn clone(&self) -> Self
fn clone(&self) -> Self
Clones the content of the element (name, attributes, style attribute, special data, etc.). Runtime style/layout state (stylo data, taffy layout, caches, pseudo-element ids, …) is reset to its default so that the clone behaves like a freshly-created element that has not yet been styled or laid out.
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !Freeze for ElementData
impl !RefUnwindSafe for ElementData
impl !Send for ElementData
impl !Sync for ElementData
impl !UnwindSafe for ElementData
impl Unpin for ElementData
impl UnsafeUnpin for ElementData
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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