Skip to main content

Node

Struct Node 

Source
pub struct Node {
    pub id: NodeId,
    pub parent: Option<NodeId>,
    pub children: ThinVec<NodeId>,
    pub layout_parent: Cell<Option<NodeId>>,
    pub layout_children: RefCell<Option<ThinVec<NodeId>>>,
    pub anonymous_blocks: ThinVec<NodeId>,
    pub paint_children: RefCell<Option<ThinVec<NodeId>>>,
    pub stacking_context: Option<Box<HoistedPaintChildren>>,
    pub flags: NodeFlags,
    pub data: NodeData,
    /* private fields */
}

Fields§

§id: NodeId

Our Id

§parent: Option<NodeId>

Our parent’s ID

§children: ThinVec<NodeId>§layout_parent: Cell<Option<NodeId>>

Our parent in the layout hierachy: a separate list that includes anonymous collections of inline elements

§layout_children: RefCell<Option<ThinVec<NodeId>>>

A separate child list that includes anonymous collections of inline elements

§anonymous_blocks: ThinVec<NodeId>

Anonymous block boxes created for this node during layout construction.

Anonymous blocks live only in the slab (they are not part of the DOM children list), so we track the ones we own here to be able to deallocate them when this node is reconstructed.

§paint_children: RefCell<Option<ThinVec<NodeId>>>

The same as layout_children, but sorted by z-index

§stacking_context: Option<Box<HoistedPaintChildren>>§flags: NodeFlags§data: NodeData

Node type (Element, TextNode, etc) specific data.

For element nodes this holds the ElementData, which stores most of the per-node style/layout state. For the document node it holds the DocumentData. Access the moved fields through the forwarding methods on Node (e.g. Node::style, Node::final_layout).

Implementations§

Source§

impl Node

Source

pub fn stylo_element_data(&self) -> &StyloData

Source

pub fn stylo_element_data_mut(&mut self) -> &mut StyloData

Source

pub fn style(&self) -> &Style<Atom>

Source

pub fn style_mut(&mut self) -> &mut Style<Atom>

Source

pub fn style_source(&self) -> &Option<ServoArc<ComputedValues>>

Source

pub fn style_source_mut(&mut self) -> &mut Option<ServoArc<ComputedValues>>

Source

pub fn subtree_hoists(&self) -> &bool

Source

pub fn subtree_hoists_mut(&mut self) -> &mut bool

Source

pub fn unrounded_layout(&self) -> &Layout

Source

pub fn unrounded_layout_mut(&mut self) -> &mut Layout

Source

pub fn final_layout(&self) -> &Layout

Source

pub fn final_layout_mut(&mut self) -> &mut Layout

Source

pub fn scroll_offset(&self) -> &Point<f64>

Source

pub fn scroll_offset_mut(&mut self) -> &mut Point<f64>

Source

pub fn scrollable_overflow(&self) -> &KurboRect

Source

pub fn scrollable_overflow_mut(&mut self) -> &mut KurboRect

Source

pub fn transform(&self) -> &Option<Affine>

Source

pub fn transform_mut(&mut self) -> &mut Option<Affine>

Source

pub fn display_constructed_as(&self) -> &StyloDisplay

Source

pub fn display_constructed_as_mut(&mut self) -> &mut StyloDisplay

Source

pub fn element_state(&self) -> &ElementState

Source

pub fn element_state_mut(&mut self) -> &mut ElementState

Source

pub fn snapshot_handled(&self) -> &AtomicBool

Source

pub fn snapshot_handled_mut(&mut self) -> &mut AtomicBool

Source

pub fn selector_flags(&self) -> &Cell<ElementSelectorFlags>

Source

pub fn selector_flags_mut(&mut self) -> &mut Cell<ElementSelectorFlags>

Source§

impl Node

Source

pub fn cache(&self) -> &Cache

This node’s taffy layout cache.

Hand-written rather than generated by universal_accessors! because the cache is Option<Box<Cache>>: a node that has never been laid out borrows a shared empty one instead of owning 1616 bytes. See the cache field for the measurement behind that. The signature is unchanged, so callers cannot tell.

Source

pub fn cache_mut(&mut self) -> &mut Cache

This node’s taffy layout cache, allocating on first use.

Source

pub fn cache_release(&mut self)

Release this node’s layout cache, returning its memory.

Source

pub fn style_source_opt(&self) -> Option<&ServoArc<ComputedValues>>

Style data from stylo, if this node kind carries it (element or document nodes). Returns None for text/comment nodes. The computed values the cached taffy style was built from, for node kinds that carry one. None for text and comment nodes, which are never styled, so a caller can ask without knowing the kind.

Source

pub fn stylo_element_data_opt(&self) -> Option<&StyloData>

Source

pub fn stylo_element_data_opt_mut(&mut self) -> Option<&mut StyloData>

Source

pub fn guard(&self) -> &SharedRwLock

The document’s shared style lock. Only available on element and document nodes.

Source

pub fn has_snapshot(&self) -> bool

Source

pub fn set_has_snapshot(&mut self, value: bool)

Source

pub fn before(&self) -> Option<NodeId>

Source

pub fn after(&self) -> Option<NodeId>

Source§

impl Node

Source

pub fn set_transform(&mut self, scale: f32) -> Option<Affine>

Source

pub fn pe_by_index(&self, index: usize) -> Option<NodeId>

Source

pub fn set_pe_by_index(&mut self, index: usize, value: Option<NodeId>)

Source

pub fn diagnostic_computed_style(&self) -> Option<Vec<(&'static str, String)>>

A compact computed-style view for renderer diagnostics.

Source

pub fn is_display_none(&self) -> bool

Whether computed style removes this node from layout.

Source

pub fn is_or_contains_block(&self) -> bool

Source

pub fn is_whitespace_node(&self) -> bool

Source

pub fn is_focussable(&self) -> bool

Source

pub fn set_restyle_hint(&mut self, hint: RestyleHint)

Source

pub fn has_dirty_descendants(&self) -> bool

Returns whether this node has any descendants that need restyling.

Source

pub fn set_dirty_descendants(&self)

Sets the dirty_descendants flag on this node.

Source

pub fn unset_dirty_descendants(&self)

Clears the dirty_descendants flag on this node.

Source

pub fn mark_ancestors_dirty(&self)

Marks all ancestors of this node as having dirty descendants. This propagates the dirty flag up the tree so that the style traversal knows to visit the subtree containing this node.

Source

pub fn damage(&self) -> Option<RestyleDamage>

Source

pub fn set_damage(&mut self, damage: RestyleDamage)

Source

pub fn insert_damage(&mut self, damage: RestyleDamage)

Source

pub fn remove_damage(&mut self, damage: RestyleDamage)

Source

pub fn clear_damage_mut(&mut self)

Source

pub fn hover(&mut self)

Source

pub fn unhover(&mut self)

Source

pub fn is_hovered(&self) -> bool

Source

pub fn focus(&mut self, shell_provider: Arc<dyn ShellProvider>)

Source

pub fn blur(&mut self, shell_provider: Arc<dyn ShellProvider>)

Source

pub fn is_focussed(&self) -> bool

Source

pub fn active(&mut self)

Source

pub fn unactive(&mut self)

Source

pub fn is_active(&self) -> bool

Source

pub fn disable(&mut self)

Source

pub fn enable(&mut self)

Source

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

Source

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

Source

pub fn text_input_v_centering_offset(&self, scale: f64) -> f64

Source§

impl Node

Source

pub fn tree(&self) -> &NodeTree

Source

pub fn with(&self, id: NodeId) -> &Node

Source

pub fn print_tree(&self, level: usize)

Source

pub fn index_of_child(&self, child_id: NodeId) -> Option<usize>

Source

pub fn child_index(&self) -> Option<usize>

Source

pub fn forward(&self, n: usize) -> Option<&Node>

Source

pub fn backward(&self, n: usize) -> Option<&Node>

Source

pub fn is_element(&self) -> bool

Source

pub fn is_anonymous(&self) -> bool

Source

pub fn is_shadow_root(&self) -> bool

Source

pub fn shadow_root_data(&self) -> Option<&ShadowRootData>

Source

pub fn shadow_root_data_mut(&mut self) -> Option<&mut ShadowRootData>

Source

pub fn shadow_root_id(&self) -> Option<NodeId>

If this node is a shadow host (i.e. has an attached shadow root), returns the node id of its shadow root.

Source

pub fn layout_dom_children(&self) -> &[NodeId]

The children to use for layout and painting.

Source

pub fn is_text_node(&self) -> bool

Source

pub fn element_data(&self) -> Option<&ElementData>

Source

pub fn element_data_mut(&mut self) -> Option<&mut ElementData>

Source

pub fn text_data(&self) -> Option<&TextNodeData>

Source

pub fn text_data_mut(&mut self) -> Option<&mut TextNodeData>

Source

pub fn node_debug_str(&self) -> String

Source

pub fn outer_html(&self) -> String

Renders the HTML of this node and all its children as a String without extra whitespace.

Example output:

<html><head /><body><main id="main"><div class="arbitrary-class" /></main></body></html>
Source

pub fn outer_html_pretty(&self) -> String

Renders the HTML of this node and all its children as a String with whitespace for human readability.

Example output:

<html>
  <head />
  <body>
    <main id="main">
      <div class="arbitrary-class" />
    </main>
  </body>
</html>
Source

pub fn write_outer_html(&self, writer: &mut String)

Source

pub fn write_outer_html_pretty(&self, writer: &mut String)

Source

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

Source

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

Source

pub fn primary_styles( &self, ) -> Option<impl Deref<Target = ServoArc<ComputedValues>>>

Source

pub fn text_content(&self) -> String

Source

pub fn write_text_content<W: Write>(&self, out: &mut W)

Write this subtree’s text content into any std::fmt::Write sink.

Public and generic so that a caller which does not want a String does not have to fork this traversal to avoid one. blitz-dom-api’s buffer-writing reader passes a sink that counts, and then one that fills a caller-supplied slice; a private copy of this walk in that crate would silently disagree with this one the first time a NodeData variant is added here.

The sinks callers pass do not fail, and String’s never has, so nothing in this crate inspects the Result. It is kept in the signature because it is fmt::Write’s, not because there is an error to handle.

Source

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

Source

pub fn order(&self) -> i32

Source

pub fn z_index(&self) -> i32

Source

pub fn is_stacking_context_root(&self, is_flex_or_grid_item: bool) -> bool

Source

pub fn hit(&self, x: f32, y: f32, scale: f64) -> Option<HitResult>

Takes an (x, y) position (relative to the parent’s top-left corner) and returns:

  • None if the position is outside of this node’s bounds
  • Some(HitResult) if the position is within the node but doesn’t match any children
  • The result of recursively calling child.hit() on the the child element that is positioned at that position if there is one.

TODO: z-index (If multiple children are positioned at the position then a random one will be recursed into)

Source

pub fn inline_root_ancestor(&self) -> Option<&Node>

Find the inline root ancestor of this node (or self if this is an inline root). Returns None if no inline root ancestor exists.

Source

pub fn text_offset_at_point(&self, x: f32, y: f32) -> Option<usize>

Get the text byte offset at a given point, using coordinates already transformed to be relative to this inline root’s content box. Returns Some(byte_offset) if the point hits text, None otherwise.

Source

pub fn text_range_at_point( &self, x: f32, y: f32, granularity: TextGranularity, ) -> Option<Range<usize>>

The byte range of the word or line at a point, for a multi-click selection.

See TextGranularity for which click count maps to which unit. Coordinates are relative to this inline root’s content box, as for text_offset_at_point.

Parley owns the boundary rules (it is what an <input> already selects with), so this asks it rather than scanning for spaces: word breaks are a Unicode segmentation question, not a whitespace one.

Source

pub fn absolute_position(&self, x: f32, y: f32) -> Point<f32>

Computes the Document-relative coordinates of the Node

Source

pub fn offset_parent(&self) -> Option<&Node>

The nearest layout ancestor that is an offset parent, as in CSSOM View’s offsetParent.

Source

pub fn offset_top_left(&self) -> Point<f32>

CSSOM View’s offsetLeft/offsetTop: the offset of this node’s border box from the padding edge of its offset_parent.

Source

pub fn synthetic_click_event(&self, mods: Modifiers) -> DomEventData

Creates a synthetic click event

Source

pub fn synthetic_click_event_data(&self, mods: Modifiers) -> BlitzPointerEvent

Source§

impl Node

Source

pub fn scrollbar_width(&self) -> ScrollbarWidth

The node’s used scrollbar-width.

Source

pub fn scrollbar_color(&self) -> ScrollbarColor

The node’s used scrollbar-color.

Source

pub fn wants_scrollbar(&self, axis: AbsoluteAxis) -> bool

Whether the node shows an overlay scrollbar in the given axis: always for overflow: scroll, only when the content overflows for overflow: auto, never otherwise — and never when scrollbar-width: none.

Source

pub fn scrollbar_thumb(&self, axis: AbsoluteAxis) -> Option<KurboRect>

Geometry of the overlay scrollbar thumb for the given axis, in (unscaled) CSS px relative to the node’s border-box origin. None if there is no scrollable overflow in that axis.

Source

pub fn scrollbar_drag_ratio(&self, axis: AbsoluteAxis) -> f64

Content px scrolled per thumb px dragged, for the given axis.

Source§

impl Node

Source

pub fn query_selector_raw( &self, selector_list: &SelectorList<SelectorImpl>, ) -> Option<NodeId>

Find the first descendant of this node that matches the selector(s) specified in selector_list.

The scope node itself is never matched. Selector parts may match nodes outside the scope while evaluating relationships between descendants.

Text and comment scope nodes return no matches.

Source

pub fn query_selector_all_raw( &self, selector_list: &SelectorList<SelectorImpl>, ) -> SmallVec<[NodeId; 32]>

Find all descendants of this node that match the selector(s) specified in selector_list, in tree order.

The scope node itself is never matched. Selector parts may match nodes outside the scope while evaluating relationships between descendants.

Text and comment scope nodes return no matches.

Source

pub fn matches_selector_raw( &self, selector_list: &SelectorList<SelectorImpl>, ) -> bool

Test whether this element matches the selector(s) specified in selector_list.

Non-element nodes never match.

Source

pub fn closest_raw( &self, selector_list: &SelectorList<SelectorImpl>, ) -> Option<NodeId>

Find the closest matching element at or above this element.

Non-element nodes never match and return None.

Trait Implementations§

Source§

impl Debug for Node

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Element for &'_ Node

Source§

type Impl = SelectorImpl

Source§

fn opaque(&self) -> OpaqueElement

Converts self into an opaque representation.
Source§

fn parent_element(&self) -> Option<Self>

Source§

fn parent_node_is_shadow_root(&self) -> bool

Whether the parent node of this element is a shadow root.
Source§

fn containing_shadow_host(&self) -> Option<Self>

The host of the containing shadow root, if any.
Source§

fn is_pseudo_element(&self) -> bool

Whether we’re matching on a pseudo-element.
Source§

fn prev_sibling_element(&self) -> Option<Self>

Skips non-element nodes
Source§

fn next_sibling_element(&self) -> Option<Self>

Skips non-element nodes
Source§

fn first_element_child(&self) -> Option<Self>

Skips non-element nodes
Source§

fn is_html_element_in_html_document(&self) -> bool

Source§

fn has_local_name(&self, local_name: &LocalName) -> bool

Source§

fn has_namespace(&self, ns: &Namespace) -> bool

Empty string for no namespace
Source§

fn is_same_type(&self, other: &Self) -> bool

Whether this element and the other element have the same local name and namespace.
Source§

fn attr_matches( &self, _ns: &NamespaceConstraint<&GenericAtomIdent<NamespaceStaticSet>>, local_name: &GenericAtomIdent<LocalNameStaticSet>, operation: &AttrSelectorOperation<&AtomString>, ) -> bool

Source§

fn match_non_ts_pseudo_class( &self, pseudo_class: &<Self::Impl as SelectorImpl>::NonTSPseudoClass, _context: &mut MatchingContext<'_, Self::Impl>, ) -> bool

Source§

fn match_pseudo_element( &self, pe: &PseudoElement, _context: &mut MatchingContext<'_, Self::Impl>, ) -> bool

Source§

fn apply_selector_flags(&self, flags: ElementSelectorFlags)

Sets selector flags on the elemnt itself or the parent, depending on the flags, which indicate what kind of work may need to be performed when DOM state changes.
Whether this element is a link.
Source§

fn is_html_slot_element(&self) -> bool

Returns whether the element is an HTML element.
Source§

fn has_id( &self, id: &<Self::Impl as SelectorImpl>::Identifier, case_sensitivity: CaseSensitivity, ) -> bool

Source§

fn has_class( &self, search_name: &<Self::Impl as SelectorImpl>::Identifier, case_sensitivity: CaseSensitivity, ) -> bool

Source§

fn imported_part( &self, _name: &<Self::Impl as SelectorImpl>::Identifier, ) -> Option<<Self::Impl as SelectorImpl>::Identifier>

Returns the mapping from the exportparts attribute in the reverse direction, that is, in an outer-tree -> inner-tree direction.
Source§

fn is_part(&self, _name: &<Self::Impl as SelectorImpl>::Identifier) -> bool

Source§

fn is_empty(&self) -> bool

Returns whether this element matches :empty. Read more
Source§

fn is_root(&self) -> bool

Returns whether this element matches :root, i.e. whether it is the root element of a document. Read more
Source§

fn has_custom_state( &self, _name: &<Self::Impl as SelectorImpl>::Identifier, ) -> bool

Source§

fn add_element_unique_hashes(&self, filter: &mut BloomFilter) -> bool

Add hashes unique to this element to the given filter, returning true if any got added.
Source§

fn pseudo_element_originating_element(&self) -> Option<Self>

The parent of a given pseudo-element, after matching a pseudo-element selector. Read more
Source§

fn has_attr_in_no_namespace( &self, local_name: &<Self::Impl as SelectorImpl>::LocalName, ) -> bool

Source§

fn assigned_slot(&self) -> Option<Self>

Returns the assigned element this element is assigned to. Read more
Source§

fn ignores_nth_child_selectors(&self) -> bool

Returns whether this element should ignore matching nth child selector.
Source§

impl Eq for Node

Source§

impl Hash for &'_ Node

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl NodeInfo for &'_ Node

Source§

fn is_element(&self) -> bool

Whether this node is an element.
Source§

fn is_text_node(&self) -> bool

Whether this node is a text node.
Source§

impl PartialEq for Node

It might be wrong to expose this since what does equality mean outside the dom?

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Send for Node

Source§

impl Sync for Node

Source§

impl<'a> TDocument for &'a Node

Source§

type ConcreteNode = &'a Node

The concrete TNode type.
Source§

fn as_node(&self) -> Self::ConcreteNode

Get this document as a TNode.
Source§

fn is_html_document(&self) -> bool

Returns whether this document is an HTML document.
Source§

fn quirks_mode(&self) -> QuirksMode

Returns the quirks mode of this document.
Source§

fn shared_lock(&self) -> &SharedRwLock

This document’s shared lock.
Source§

fn elements_with_id<'a>( &self, _id: &GenericAtomIdent<AtomStaticSet>, ) -> Result<&'a [<Self::ConcreteNode as TNode>::ConcreteElement], ()>
where Self: 'a,

Get a list of elements with a given ID in this document, sorted by tree position. Read more
Source§

impl<'a> TElement for &'a Node

Source§

unsafe fn clear_data(&self)

Deliberately keeps the data.

Stylo calls this from exactly one place: clear_descendant_data, which runs when an element is restyled to display: none and throws away the computed styles of everything beneath it. That is right for Gecko, where a hidden subtree has no frames and the styles are dead weight.

It is wrong for an application that retains its tabs. Hiding a pane deleted every computed style under it, so revealing it again had no old style to diff against, every node came back as fully damaged, and the pane was reconstructed, re-shaped and laid out from nothing. Measured on six retained panes of a real project tab, that made a re-reveal cost exactly what the first reveal cost, 46,526 layout computations and 55ms, on every switch forever.

Keeping the styles is safe because nothing else consults them while the subtree is hidden, and a mutation inside a hidden pane still marks its nodes dirty the usual way, so the reveal restyles precisely what changed. The memory is the styles of tabs the user is holding open, which is the trade the application already made by retaining them.

The cost is that clear_descendant_data still walks the subtree to find nothing to clear, since it descends on has_data. One walk per hide.

Source§

type ConcreteNode = &'a Node

The concrete node type.
Source§

type TraversalChildrenIterator = Traverser<'a>

A concrete children iterator type in order to iterate over the Nodes. Read more
Source§

fn as_node(&self) -> Self::ConcreteNode

Get this element as a node.
Source§

fn implicit_scope_for_sheet_in_shadow_root( _opaque_host: OpaqueElement, _sheet_index: usize, ) -> Option<ImplicitScopeRoot>

Returns the implicit scope root for given sheet index and host.
Source§

fn traversal_children(&self) -> LayoutIterator<Self::TraversalChildrenIterator>

Get this node’s children from the perspective of a restyle traversal.
Source§

fn is_html_element(&self) -> bool

Return whether this element is an element in the HTML namespace.
Source§

fn is_mathml_element(&self) -> bool

Return whether this element is an element in the MathML namespace.
Source§

fn is_svg_element(&self) -> bool

Return whether this element is an element in the SVG namespace.
Source§

fn style_attribute( &self, ) -> Option<ArcBorrow<'_, Locked<PropertyDeclarationBlock>>>

Get this element’s style attribute.
Source§

fn state(&self) -> ElementState

Get this element’s state, for non-tree-structural pseudos.
Source§

fn has_part_attr(&self) -> bool

Returns whether this element has a part attribute.
Source§

fn exports_any_part(&self) -> bool

Returns whether this element exports any part from its shadow tree.
Source§

fn id(&self) -> Option<&Atom>

The ID for this element.
Source§

fn each_class<F>(&self, callback: F)
where F: FnMut(&AtomIdent),

Internal iterator for the classes of this element.
Source§

fn each_attr_name<F>(&self, callback: F)
where F: FnMut(&LocalName),

Internal iterator for the attribute names of this element.
Source§

fn has_dirty_descendants(&self) -> bool

Returns true if this element may have a descendant needing style processing. Read more
Source§

fn has_snapshot(&self) -> bool

Returns whether state or attributes that may change style have changed on the element, and thus whether the element has been snapshotted to do restyle hint computation.
Source§

fn handled_snapshot(&self) -> bool

Returns whether the current snapshot if present has been handled.
Source§

unsafe fn set_handled_snapshot(&self)

Flags this element as having handled already its snapshot.
Source§

unsafe fn set_dirty_descendants(&self)

Flag that this element has a descendant for style processing. Read more
Source§

unsafe fn unset_dirty_descendants(&self)

Flag that this element has no descendant for style processing. Read more
Source§

fn store_children_to_process(&self, _n: isize)

Atomically stores the number of children of this node that we will need to process during bottom-up traversal.
Source§

fn did_process_child(&self) -> isize

Atomically notes that a child has been processed during bottom-up traversal. Returns the number of children left to process.
Source§

unsafe fn ensure_data(&self) -> ElementDataMut<'_>

Gets a reference to the ElementData container, or creates one. Read more
Source§

fn has_data(&self) -> bool

Whether there is an ElementData container.
Source§

fn borrow_data(&self) -> Option<ElementDataRef<'_>>

Immutably borrows the ElementData.
Source§

fn mutate_data(&self) -> Option<ElementDataMut<'_>>

Mutably borrows the ElementData.
Source§

fn skip_item_display_fixup(&self) -> bool

Whether we should skip any root- or item-based display property blockification on this element. (This function exists so that Gecko native anonymous content can opt out of this style fixup.)
Source§

fn may_have_animations(&self) -> bool

In Gecko, element has a flag that represents the element may have any type of animations or not to bail out animation stuff early. Whereas Servo doesn’t have such flag.
Source§

fn has_animations(&self, context: &SharedStyleContext<'_>) -> bool

Returns true if the element has relevant animations. Relevant animations are those animations that are affecting the element’s style or are scheduled to do so in the future.
Source§

fn has_css_animations( &self, context: &SharedStyleContext<'_>, pseudo_element: Option<PseudoElement>, ) -> bool

Returns true if the element has a CSS animation. The context and pseudo_element arguments are only used by Servo, since it stores animations globally and pseudo-elements are not in the DOM.
Source§

fn has_css_transitions( &self, context: &SharedStyleContext<'_>, pseudo_element: Option<PseudoElement>, ) -> bool

Returns true if the element has a CSS transition (including running transitions and completed transitions). The context and pseudo_element arguments are only used by Servo, since it stores animations globally and pseudo-elements are not in the DOM.
Source§

fn animation_rule( &self, context: &SharedStyleContext<'_>, ) -> Option<Arc<Locked<PropertyDeclarationBlock>>>

Get this element’s animation rule.
Source§

fn transition_rule( &self, context: &SharedStyleContext<'_>, ) -> Option<Arc<Locked<PropertyDeclarationBlock>>>

Get this element’s transition rule.
Source§

fn shadow_root( &self, ) -> Option<<Self::ConcreteNode as TNode>::ConcreteShadowRoot>

The shadow root this element is a host of.
Source§

fn containing_shadow( &self, ) -> Option<<Self::ConcreteNode as TNode>::ConcreteShadowRoot>

The shadow root which roots the subtree this element is contained in.
Source§

fn get_attr(&self, attr: &LocalName, _ns: &Namespace) -> Option<String>

Return the value of the given custom attribute if it exists.
Source§

fn lang_attr(&self) -> Option<AttrValue>

Returns the value of the xml:lang="" attribute (or, if appropriate, the lang="" attribute) on this element.
Source§

fn match_element_lang( &self, _override_lang: Option<Option<AttrValue>>, _value: &Lang, ) -> bool

Returns whether this element’s language matches the language tag value. If override_lang is not None, it specifies the value of the xml:lang="" or lang="" attribute to use in place of looking at the element and its ancestors. (This argument is used to implement matching of :lang() against snapshots.)
Source§

fn is_html_document_body_element(&self) -> bool

Returns whether this element is the main body element of the HTML document it is on.
Source§

fn synthesize_presentational_hints_for_legacy_attributes<V>( &self, _visited_handling: VisitedHandlingMode, hints: &mut V, )

Generate the proper applicable declarations due to presentational hints, and insert them into hints.
Source§

fn local_name(&self) -> &LocalName

Returns element’s local name.
Source§

fn namespace(&self) -> &Namespace

Returns element’s namespace.
Source§

fn query_container_size(&self, _display: &Display) -> Size2D<Option<Au>>

Returns the size of the element to be used in container size queries. This will usually be the size of the content area of the primary box, but can be None if there is no box or if some axis lacks size containment.
Source§

fn each_custom_state<F>(&self, _callback: F)
where F: FnMut(&AtomIdent),

Internal iterator for the classes of this element.
Source§

fn has_selector_flags(&self, flags: ElementSelectorFlags) -> bool

Returns true if the element has all of specified selector flags.
Source§

fn relative_selector_search_direction(&self) -> ElementSelectorFlags

Returns the search direction for relative selector invalidation, if it is on the search path.
Source§

fn compute_layout_damage( old: &ComputedValues, new: &ComputedValues, ) -> RestyleDamage

Compute the damage incurred by the change from the _old to _new.
Source§

fn owner_doc_matches_for_testing(&self, _: &Device) -> bool

A debug-only check that the device’s owner doc matches the actual doc we’re the root of. Read more
Source§

fn matches_user_and_content_rules(&self) -> bool

Whether this element should match user and content rules. Read more
Source§

fn traversal_parent(&self) -> Option<Self>

Get this node’s parent element from the perspective of a restyle traversal.
Source§

fn inheritance_parent(&self) -> Option<Self>

Returns the parent element we should inherit from. Read more
Source§

fn each_anonymous_content_child<F>(&self, _f: F)
where F: FnMut(Self),

Execute f for each anonymous content child (apart from ::before and ::after) whose originating element is self.
Source§

fn is_xul_element(&self) -> bool

Return whether this element is an element in the XUL namespace.
Source§

fn is_html_media_element(&self) -> bool

Return whether this element is an HTML
Source§

fn subtree_bloom_filter(&self) -> u64

Returns the bloom filter for this element’s subtree, used for fast querySelector optimization by allowing subtrees to be skipped. Each element’s filter includes hashes for all of it’s class names and attribute names (not values), along with the names for all descendent elements. Read more
Source§

fn bloom_may_have_hash(&self, bloom_hash: u64) -> bool

Check if this element’s subtree may contain elements with the given bloom hash.
Source§

fn hash_for_bloom_filter(hash: u32) -> u64

Convert a 32-bit atom hash to a bloom filter value using k=2 hash functions. This must match the C++ implementation of AttrArray::HashForBloomFilter.
Source§

fn slotted_nodes(&self) -> &[Self::ConcreteNode]

Return the list of slotted nodes of this node.
Source§

fn smil_override( &self, ) -> Option<ArcBorrow<'_, Locked<PropertyDeclarationBlock>>>

Get this element’s SMIL override declarations.
Source§

fn animation_declarations( &self, context: &SharedStyleContext<'_>, ) -> AnimationDeclarations

Get the combined animation and transition rules. Read more
Source§

fn each_part<F>(&self, _callback: F)

Internal iterator for the part names of this element.
Source§

fn each_exported_part<F>( &self, _name: &GenericAtomIdent<AtomStaticSet>, _callback: F, )

Internal iterator for the part names that this element exports for a given part name.
Source§

fn may_generate_pseudo( &self, pseudo: &PseudoElement, _primary_style: &ComputedValues, ) -> bool

Whether a given element may generate a pseudo-element. Read more
Source§

fn has_current_styles(&self, data: &ElementData) -> bool

Returns whether the element’s styles are up-to-date after traversal (i.e. in post traversal).
Source§

fn has_animation_only_dirty_descendants(&self) -> bool

Similar to the dirty_descendants but for representing a descendant of the element needs to be updated in animation-only traversal.
Source§

unsafe fn set_animation_only_dirty_descendants(&self)

Flag that this element has a descendant for animation-only restyle processing. Read more
Source§

unsafe fn unset_animation_only_dirty_descendants(&self)

Flag that this element has no descendant for animation-only restyle processing. Read more
Source§

unsafe fn clear_descendant_bits(&self)

Clear all bits related describing the dirtiness of descendants. Read more
Returns true if this element is a visited link. Read more
Source§

fn implemented_pseudo_element(&self) -> Option<PseudoElement>

Returns the pseudo-element implemented by this element, if any. Read more
Source§

fn has_animation_restyle_hints(&self) -> bool

Returns true if the element has animation restyle hints.
Source§

fn note_highlight_pseudo_style_invalidated(&self)

Called when a highlight pseudo-element (::selection, ::highlight, ::target-text) style is invalidated. These pseudos need explicit repaint triggering since their styles are resolved lazily during painting.
Source§

fn ultimate_originating_element(&self) -> Self

If this element is not a pseudo-element, return self. Otherwise, return the ultimate originating element [1]. This is the element used to look up rules in the selector maps. [1]: https://drafts.csswg.org/selectors-4/#ultimate-originating-element
Source§

fn each_applicable_non_document_style_rule_data<'a, F>(&self, f: F) -> bool
where Self: 'a, F: FnMut(&'a CascadeData, Self),

Executes the callback for each applicable style rule data which isn’t the main document’s data (which stores UA / author rules). Read more
Source§

fn synthesize_view_transition_dynamic_rules<V>(&self, _rules: &mut V)

Generate the proper applicable declarations due to view transition dynamic rules, and insert them into rules. https://drafts.csswg.org/css-view-transitions-1/#document-dynamic-view-transition-style-sheet
Source§

fn get_tree_counting_result( &self, caches: &mut TreeCountingCaches, ) -> TreeCountingResult

Traverse the siblings of the element, returning the element’s sibling-index() and sibling-count(). Also populates caches with the sibling-index() and sibling-count() values for all siblings of this element.
Source§

impl<'a> TNode for &'a Node

Source§

type ConcreteElement = &'a Node

The concrete TElement type.
Source§

type ConcreteDocument = &'a Node

The concrete TDocument type.
Source§

type ConcreteShadowRoot = &'a Node

The concrete TShadowRoot type.
Source§

fn parent_node(&self) -> Option<Self>

Get this node’s parent node.
Source§

fn first_child(&self) -> Option<Self>

Get this node’s first child.
Source§

fn last_child(&self) -> Option<Self>

Get this node’s last child.
Source§

fn prev_sibling(&self) -> Option<Self>

Get this node’s previous sibling.
Source§

fn next_sibling(&self) -> Option<Self>

Get this node’s next sibling.
Source§

fn owner_doc(&self) -> Self::ConcreteDocument

Get the owner document of this node.
Source§

fn is_in_document(&self) -> bool

Returns whether the node is attached to a document.
Source§

fn traversal_parent(&self) -> Option<Self::ConcreteElement>

Get this node’s parent element from the perspective of a restyle traversal.
Source§

fn opaque(&self) -> OpaqueNode

Converts self into an OpaqueNode.
Source§

fn debug_id(self) -> usize

A debug id, only useful, mm… for debugging.
Source§

fn as_element(&self) -> Option<Self::ConcreteElement>

Get this node as an element, if it’s one.
Source§

fn as_document(&self) -> Option<Self::ConcreteDocument>

Get this node as a document, if it’s one.
Source§

fn as_shadow_root(&self) -> Option<Self::ConcreteShadowRoot>

Get this node as a ShadowRoot, if it’s one.
Source§

fn dom_children(&self) -> DomChildren<Self>

Iterate over the DOM children of a node.
Source§

fn dom_descendants(&self) -> DomDescendants<Self>

Iterate over the DOM children of a node, in preorder.
Source§

fn next_in_preorder(&self, scoped_to: Self) -> Option<Self>

Returns the next node after this one, in a pre-order tree-traversal of the subtree rooted at scoped_to.
Source§

fn next_in_preorder_skipping_children(&self, scoped_to: Self) -> Option<Self>

Returns the next node in tree order, skipping the children of the current node. Read more
Source§

fn depth(&self) -> usize

Returns the depth of this node in the DOM.
Source§

fn parent_element(&self) -> Option<Self::ConcreteElement>

Get this node’s parent element if present.
Source§

fn parent_element_or_host(&self) -> Option<Self::ConcreteElement>

Get this node’s parent element, or shadow host if it’s a shadow root.
Source§

impl<'a> TShadowRoot for &'a Node

Source§

type ConcreteNode = &'a Node

The concrete node type.
Source§

fn as_node(&self) -> Self::ConcreteNode

Get this ShadowRoot as a node.
Source§

fn host(&self) -> <Self::ConcreteNode as TNode>::ConcreteElement

Get the shadow host that hosts this ShadowRoot.
Source§

fn style_data<'b>(&self) -> Option<&'b CascadeData>
where Self: 'b,

Get the style data for this ShadowRoot.
Source§

fn parts<'a>(&self) -> &[<Self::ConcreteNode as TNode>::ConcreteElement]
where Self: 'a,

Get the list of shadow parts for this shadow root.
Source§

fn elements_with_id<'a>( &self, _id: &GenericAtomIdent<AtomStaticSet>, ) -> Result<&'a [<Self::ConcreteNode as TNode>::ConcreteElement], ()>
where Self: 'a,

Get a list of elements with a given ID in this shadow root, sorted by tree position. Read more
Source§

fn implicit_scope_for_sheet( &self, _sheet_index: usize, ) -> Option<ImplicitScopeRoot>

Get the implicit scope for a stylesheet in given index.

Auto Trait Implementations§

§

impl !Freeze for Node

§

impl !RefUnwindSafe for Node

§

impl !UnwindSafe for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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, 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.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,