pub trait ThreadSafeLayoutElement<'dom>: Clone + Copy + Sized + Debug + Element<Impl = SelectorImpl> {
    type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'dom, ConcreteThreadSafeLayoutElement = Self>;
    type ConcreteElement: TElement;

Show 18 methods // Required methods fn as_node(&self) -> Self::ConcreteThreadSafeLayoutNode; fn with_pseudo(&self, pseudo: PseudoElementType) -> Self; fn type_id(&self) -> Option<LayoutNodeType>; fn unsafe_get(self) -> Self::ConcreteElement; fn get_local_name(&self) -> &LocalName; fn get_attr(&self, namespace: &Namespace, name: &LocalName) -> Option<&str>; fn get_attr_enum( &self, namespace: &Namespace, name: &LocalName ) -> Option<&AttrValue>; fn style_data(&self) -> AtomicRef<'_, ElementData>; fn get_pseudo_element_type(&self) -> PseudoElementType; fn is_shadow_host(&self) -> bool; fn is_body_element_of_html_element_root(&self) -> bool; // Provided methods fn get_before_pseudo(&self) -> Option<Self> { ... } fn get_after_pseudo(&self) -> Option<Self> { ... } fn get_details_summary_pseudo(&self) -> Option<Self> { ... } fn get_details_content_pseudo(&self) -> Option<Self> { ... } fn style(&self, context: &SharedStyleContext<'_>) -> Arc<ComputedValues> { ... } fn selected_style(&self) -> Arc<ComputedValues> { ... } fn resolved_style(&self) -> Arc<ComputedValues> { ... }
}

Required Associated Types§

source

type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'dom, ConcreteThreadSafeLayoutElement = Self>

source

type ConcreteElement: TElement

This type alias is just a work-around to avoid writing

<Self::ConcreteThreadSafeLayoutNode as ThreadSafeLayoutNode>::ConcreteElement

Required Methods§

source

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

source

fn with_pseudo(&self, pseudo: PseudoElementType) -> Self

Creates a new ThreadSafeLayoutElement for the same LayoutElement with a different pseudo-element type.

source

fn type_id(&self) -> Option<LayoutNodeType>

Returns the type ID of this node. Returns None if this is a pseudo-element; otherwise, returns Some.

source

fn unsafe_get(self) -> Self::ConcreteElement

Returns access to the underlying TElement. This is breaks the abstraction barrier of ThreadSafeLayout wrapper layer, and can lead to races if not used carefully.

We need this so that the functions defined on this trait can call lazily_compute_pseudo_element_style, which operates on TElement.

source

fn get_local_name(&self) -> &LocalName

Get the local name of this element. See https://dom.spec.whatwg.org/#concept-element-local-name.

source

fn get_attr(&self, namespace: &Namespace, name: &LocalName) -> Option<&str>

source

fn get_attr_enum( &self, namespace: &Namespace, name: &LocalName ) -> Option<&AttrValue>

source

fn style_data(&self) -> AtomicRef<'_, ElementData>

source

fn get_pseudo_element_type(&self) -> PseudoElementType

source

fn is_shadow_host(&self) -> bool

source

fn is_body_element_of_html_element_root(&self) -> bool

Returns whether this node is a body element of an html element root in an HTML element document.

Note that this does require accessing the parent, which this interface technically forbids. But accessing the parent is only unsafe insofar as it can be used to reach siblings and cousins. A simple immutable borrow of the parent data is fine, since the bottom-up traversal will not process the parent until all the children have been processed.

Provided Methods§

source

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

source

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

source

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

source

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

source

fn style(&self, context: &SharedStyleContext<'_>) -> Arc<ComputedValues>

Returns the style results for the given node. If CSS selector matching has not yet been performed, fails.

Unlike the version on TNode, this handles pseudo-elements.

source

fn selected_style(&self) -> Arc<ComputedValues>

source

fn resolved_style(&self) -> Arc<ComputedValues>

Returns the already resolved style of the node.

This differs from style(ctx) in that if the pseudo-element has not yet been computed it would panic.

This should be used just for querying layout, or when we know the element style is precomputed, not from general layout itself.

Implementors§