pub trait ThreadSafeLayoutNode<'dom>: Clone + Copy + Debug + GetStyleAndOpaqueLayoutData<'dom> + NodeInfo + PartialEq + Sized {
    type ConcreteNode: LayoutNode<'dom, ConcreteThreadSafeLayoutNode = Self>;
    type ConcreteElement: TElement;
    type ConcreteThreadSafeLayoutElement: ThreadSafeLayoutElement<'dom, ConcreteThreadSafeLayoutNode = Self> + Element<Impl = SelectorImpl>;
    type ChildrenIterator: Iterator<Item = Self> + Sized;

Show 31 methods // Required methods fn opaque(&self) -> OpaqueNode; fn type_id(&self) -> Option<LayoutNodeType>; fn parent_style(&self) -> Arc<ComputedValues>; fn debug_id(self) -> usize; fn children(&self) -> LayoutIterator<Self::ChildrenIterator>; fn as_element(&self) -> Option<Self::ConcreteThreadSafeLayoutElement>; fn get_style_and_opaque_layout_data( self ) -> Option<&'dom StyleAndOpaqueLayoutData>; fn is_ignorable_whitespace(&self, context: &SharedStyleContext<'_>) -> bool; unsafe fn unsafe_get(self) -> Self::ConcreteNode; fn node_text_content(self) -> Cow<'dom, str>; fn selection(&self) -> Option<Range<ByteIndex>>; fn image_url(&self) -> Option<ServoUrl>; fn image_density(&self) -> Option<f64>; fn image_data( &self ) -> Option<(Option<StdArc<Image>>, Option<ImageMetadata>)>; fn canvas_data(&self) -> Option<HTMLCanvasData>; fn svg_data(&self) -> Option<SVGSVGData>; fn media_data(&self) -> Option<HTMLMediaData>; fn iframe_browsing_context_id(&self) -> Option<BrowsingContextId>; fn iframe_pipeline_id(&self) -> Option<PipelineId>; fn get_colspan(&self) -> u32; fn get_rowspan(&self) -> u32; // 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 get_pseudo_element_type(&self) -> PseudoElementType { ... } fn style(&self, context: &SharedStyleContext<'_>) -> Arc<ComputedValues> { ... } fn selected_style(&self) -> Arc<ComputedValues> { ... } fn is_content(&self) -> bool { ... } fn fragment_type(&self) -> FragmentType { ... } fn generate_scroll_id(&self, pipeline_id: PipelineId) -> ExternalScrollId { ... }
}
Expand description

A thread-safe version of LayoutNode, used during flow construction. This type of layout node does not allow any parents or siblings of nodes to be accessed, to avoid races.

Required Associated Types§

source

type ConcreteNode: LayoutNode<'dom, ConcreteThreadSafeLayoutNode = Self>

source

type ConcreteElement: TElement

source

type ConcreteThreadSafeLayoutElement: ThreadSafeLayoutElement<'dom, ConcreteThreadSafeLayoutNode = Self> + Element<Impl = SelectorImpl>

source

type ChildrenIterator: Iterator<Item = Self> + Sized

Required Methods§

source

fn opaque(&self) -> OpaqueNode

Converts self into an OpaqueNode.

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 parent_style(&self) -> Arc<ComputedValues>

Returns the style for a text node. This is computed on the fly from the parent style to avoid traversing text nodes in the style system.

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.

source

fn debug_id(self) -> usize

source

fn children(&self) -> LayoutIterator<Self::ChildrenIterator>

Returns an iterator over this node’s children.

source

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

Returns a ThreadSafeLayoutElement if this is an element, None otherwise.

source

fn get_style_and_opaque_layout_data( self ) -> Option<&'dom StyleAndOpaqueLayoutData>

source

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

source

unsafe fn unsafe_get(self) -> Self::ConcreteNode

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

We need this because the implementation of some methods need to access the layout data flags, and we have this annoying trait separation between script and layout :-(

source

fn node_text_content(self) -> Cow<'dom, str>

source

fn selection(&self) -> Option<Range<ByteIndex>>

If the insertion point is within this node, returns it. Otherwise, returns None.

source

fn image_url(&self) -> Option<ServoUrl>

If this is an image element, returns its URL. If this is not an image element, fails.

source

fn image_density(&self) -> Option<f64>

If this is an image element, returns its current-pixel-density. If this is not an image element, fails.

source

fn image_data(&self) -> Option<(Option<StdArc<Image>>, Option<ImageMetadata>)>

If this is an image element, returns its image data. Otherwise, returns None.

source

fn canvas_data(&self) -> Option<HTMLCanvasData>

source

fn svg_data(&self) -> Option<SVGSVGData>

source

fn media_data(&self) -> Option<HTMLMediaData>

source

fn iframe_browsing_context_id(&self) -> Option<BrowsingContextId>

If this node is an iframe element, returns its browsing context ID. If this node is not an iframe element, fails. Returns None if there is no nested browsing context.

source

fn iframe_pipeline_id(&self) -> Option<PipelineId>

If this node is an iframe element, returns its pipeline ID. If this node is not an iframe element, fails. Returns None if there is no nested browsing context.

source

fn get_colspan(&self) -> u32

source

fn get_rowspan(&self) -> u32

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 get_pseudo_element_type(&self) -> PseudoElementType

source

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

source

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

source

fn is_content(&self) -> bool

Returns true if this node contributes content. This is used in the implementation of empty_cells per CSS 2.1 § 17.6.1.1.

source

fn fragment_type(&self) -> FragmentType

source

fn generate_scroll_id(&self, pipeline_id: PipelineId) -> ExternalScrollId

Implementors§