pub trait LayoutNode<'dom>: Copy + Debug + TNode + Send + Sync {
    type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'dom>;

    // Required methods
    fn to_threadsafe(&self) -> Self::ConcreteThreadSafeLayoutNode;
    fn type_id(&self) -> LayoutNodeType;
    unsafe fn initialize_style_and_layout_data<RequestedLayoutDataType: LayoutDataTrait>(
        &self,
    );
    fn initialize_layout_data<RequestedLayoutDataType: LayoutDataTrait>(&self);
    fn style_data(&self) -> Option<&'dom StyleData>;
    fn layout_data(&self) -> Option<&'dom GenericLayoutData>;
    fn is_connected(&self) -> bool;

    // Provided methods
    fn rev_children(self) -> LayoutIterator<ReverseChildrenIterator<Self>> { ... }
    fn traverse_preorder(self) -> TreeIterator<Self>  { ... }
}
Expand description

A wrapper so that layout can access only the methods that it should have access to. Layout must only ever see these and must never see instances of LayoutDom. FIXME(mrobinson): Send + Sync is required here for Layout 2020, but eventually it should stop sending LayoutNodes to other threads and rely on ThreadSafeLayoutNode or some other mechanism to ensure thread safety.

Required Associated Types§

Required Methods§

source

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

source

fn type_id(&self) -> LayoutNodeType

Returns the type ID of this node.

source

unsafe fn initialize_style_and_layout_data<RequestedLayoutDataType: LayoutDataTrait>( &self, )

Initialize this node with empty style and opaque layout data.

§Safety

This method is unsafe because it modifies the given node during layout. Callers should ensure that no other layout thread is attempting to read or modify the opaque layout data of this node.

source

fn initialize_layout_data<RequestedLayoutDataType: LayoutDataTrait>(&self)

Initialize this node with empty opaque layout data.

§Safety

This method is unsafe because it modifies the given node during layout. Callers should ensure that no other layout thread is attempting to read or modify the opaque layout data of this node.

source

fn style_data(&self) -> Option<&'dom StyleData>

Get the StyleData for this node. Returns None if the node is unstyled.

source

fn layout_data(&self) -> Option<&'dom GenericLayoutData>

Get the layout data of this node, attempting to downcast it to the desired type. Returns None if there is no layout data or it isn’t of the desired type.

source

fn is_connected(&self) -> bool

Returns whether the node is connected.

Provided Methods§

Object Safety§

This trait is not object safe.

Implementors§