Skip to main content

ElementData

Struct ElementData 

Source
pub struct ElementData {
Show 30 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 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 damaged_descendants: AtomicBool, pub before: Option<NodeId>, pub after: Option<NodeId>, pub detailed_grid_info: Option<Box<DetailedGridInfo<Atom>>>, pub style: Style<Atom>, pub display_constructed_as: Display, pub cache: Cache, pub unrounded_layout: Layout, pub final_layout: Layout, pub scroll_offset: Point<f64>, pub scrollable_overflow: Rect, pub transform: Option<Affine>,
}

Fields§

§name: QualName

The elements tag name, namespace and prefix

§id: Option<Atom>

The elements id attribute parsed as an atom (if it has one)

§attrs: Attributes

The element’s attributes

§is_focussable: bool

Whether the element is focussable

§style_attribute: Option<Arc<Locked<PropertyDeclarationBlock>>>

The element’s parsed style attribute (used by stylo)

§special_data: SpecialElementData

Heterogeneous 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)

§stylo_element_data: StyloData

Style 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: AtomicBool

Whether any descendant of this node needs restyling. Used by Stylo’s incremental style traversal to skip unchanged subtrees.

§damaged_descendants: AtomicBool

Whether this node or any of its descendants may carry RestyleDamage. Used by the damage propagation pass to skip unchanged subtrees.

§before: Option<NodeId>§after: Option<NodeId>§detailed_grid_info: Option<Box<DetailedGridInfo<Atom>>>

Detailed grid track sizing information from the most recent layout (grid containers only). Used by devtools grid inspection.

§style: Style<Atom>§display_constructed_as: Display§cache: Cache§unrounded_layout: Layout§final_layout: Layout§scroll_offset: Point<f64>§scrollable_overflow: Rect§transform: Option<Affine>

Implementations§

Source§

impl ElementData

Source

pub fn new(name: QualName, attrs: Vec<Attribute>) -> Self

Source

pub fn attrs(&self) -> &[Attribute]

Source

pub fn attr(&self, name: impl PartialEq<LocalName>) -> Option<&str>

Source

pub fn attr_parsed<T: FromStr>( &self, name: impl PartialEq<LocalName>, ) -> Option<T>

Source

pub fn has_attr(&self, name: impl PartialEq<LocalName>) -> bool

Detects the presence of the attribute, treating any value as truthy.

Source

pub fn can_be_disabled(&self) -> bool

Whether this element is a link (an <a> or <area> element with an href attribute)

Sync the visitedness bits of element_state with the element’s link-ness. Blitz does not track browsing history, so all links are unvisited.

Stylo’s snapshot invalidation (ElementWrapper::is_link) determines link-ness from these state bits, so they must be kept accurate for :link/:any-link selectors to be correctly invalidated. Must be called whenever the href attribute is added or removed.

Source

pub fn image_data(&self) -> Option<&ImageData>

Source

pub fn image_data_mut(&mut self) -> Option<&mut ImageData>

Source

pub fn raster_image_data(&self) -> Option<&RasterImageData>

Source

pub fn raster_image_data_mut(&mut self) -> Option<&mut RasterImageData>

Source

pub fn canvas_data(&self) -> Option<&CanvasData>

Source

pub fn sub_doc_data(&self) -> Option<&dyn Document>

Source

pub fn sub_doc_data_mut(&mut self) -> Option<&mut dyn Document>

Source

pub fn svg_data(&self) -> Option<&Tree>

Source

pub fn text_input_data(&self) -> Option<&TextInputData>

Source

pub fn text_input_data_mut(&mut self) -> Option<&mut TextInputData>

Source

pub fn custom_widget_data(&self) -> Option<&CustomWidgetData>

Source

pub fn custom_widget_data_mut(&mut self) -> Option<&mut CustomWidgetData>

Source

pub fn checkbox_input_checked(&self) -> Option<bool>

Source

pub fn checkbox_input_checked_mut(&mut self) -> Option<&mut bool>

Source

pub fn set_checkbox_input_checked(&mut self, checked: bool)

Set the checked state of a checkbox/radio input, keeping the ElementState::CHECKED bit (used for :checked selector matching and invalidation) in sync with the special data.

Source

pub fn file_data(&self) -> Option<&FileData>

Source

pub fn file_data_mut(&mut self) -> Option<&mut FileData>

Source

pub fn flush_is_focussable(&mut self)

Source

pub fn flush_style_attribute( &mut self, guard: &SharedRwLock, url_extra_data: &UrlExtraData, )

Source

pub fn set_style_property( &mut self, name: &str, value: &str, guard: &SharedRwLock, url_extra_data: UrlExtraData, ) -> bool

Source

pub fn remove_style_property( &mut self, name: &str, guard: &SharedRwLock, url_extra_data: UrlExtraData, ) -> bool

Source

pub fn set_sub_document(&mut self, sub_document: Box<dyn Document>)

Source

pub fn remove_sub_document(&mut self)

Source

pub fn set_custom_widget(&mut self, widget: Box<dyn Widget>)

Source

pub fn remove_custom_widget(&mut self) -> Vec<ResourceId>

Source

pub fn take_inline_layout(&mut self) -> Option<Box<TextLayout>>

Source

pub fn is_submit_button(&self) -> bool

Trait Implementations§

Source§

impl Clone for ElementData

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for ElementData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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.