Struct script::layout_dom::node::ServoLayoutNode

source ·
pub struct ServoLayoutNode<'dom> {
    pub(super) node: LayoutDom<'dom, Node>,
}
Expand description

A wrapper around a LayoutDom<Node> which provides a safe interface that can be used during layout. This implements the LayoutNode trait as well as several style and selectors traits for use during layout. This version should only be used on a single thread. If you need to use nodes across threads use ServoThreadSafeLayoutNode.

Fields§

§node: LayoutDom<'dom, Node>

The wrapped private DOM node.

Implementations§

source§

impl<'dom> ServoLayoutNode<'dom>

source

pub(super) fn from_layout_js(n: LayoutDom<'dom, Node>) -> Self

source

pub unsafe fn new(address: &TrustedNodeAddress) -> Self

Create a new ServoLayoutNode for this given TrustedNodeAddress.

§Safety

The address pointed to by address should point to a valid node in memory.

source

pub(super) fn script_type_id(&self) -> NodeTypeId

source

pub fn get_jsmanaged(self) -> LayoutDom<'dom, Node>

Returns the interior of this node as a LayoutDom.

Trait Implementations§

source§

impl<'dom> Clone for ServoLayoutNode<'dom>

source§

fn clone(&self) -> ServoLayoutNode<'dom>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'dom> Debug for ServoLayoutNode<'dom>

source§

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

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

impl<'dom> LayoutNode<'dom> for ServoLayoutNode<'dom>

§

type ConcreteThreadSafeLayoutNode = ServoThreadSafeLayoutNode<'dom>

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. Read more
source§

fn initialize_layout_data<RequestedLayoutDataType: LayoutDataTrait>(&self)

Initialize this node with empty opaque layout data. Read more
source§

fn is_connected(&self) -> bool

Returns whether the node is connected.
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 rev_children(self) -> LayoutIterator<ReverseChildrenIterator<Self>>

source§

fn traverse_preorder(self) -> TreeIterator<Self>

source§

impl<'dom> NodeInfo for ServoLayoutNode<'dom>

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<'dom> PartialEq for ServoLayoutNode<'dom>

source§

fn eq(&self, other: &ServoLayoutNode<'dom>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'dom> TNode for ServoLayoutNode<'dom>

§

type ConcreteDocument = ServoLayoutDocument<'dom>

The concrete TDocument type.
§

type ConcreteElement = ServoLayoutElement<'dom>

The concrete TElement type.
§

type ConcreteShadowRoot = ServoShadowRoot<'dom>

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 traversal_parent(&self) -> Option<ServoLayoutElement<'dom>>

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<ServoLayoutElement<'dom>>

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

fn as_document(&self) -> Option<ServoLayoutDocument<'dom>>

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

fn as_shadow_root(&self) -> Option<ServoShadowRoot<'dom>>

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

fn is_in_document(&self) -> bool

Returns whether the node is attached to a document.
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 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<'dom> Copy for ServoLayoutNode<'dom>

source§

impl Send for ServoLayoutNode<'_>

Those are supposed to be sound, but they aren’t because the entire system between script and layout so far has been designed to work around their absence. Switching the entire thing to the inert crate infra will help.

FIXME(mrobinson): These are required because Layout 2020 sends non-threadsafe nodes to different threads. This should be adressed in a comprehensive way.

source§

impl<'dom> StructuralPartialEq for ServoLayoutNode<'dom>

source§

impl Sync for ServoLayoutNode<'_>

Auto Trait Implementations§

§

impl<'dom> Freeze for ServoLayoutNode<'dom>

§

impl<'dom> !RefUnwindSafe for ServoLayoutNode<'dom>

§

impl<'dom> Unpin for ServoLayoutNode<'dom>

§

impl<'dom> !UnwindSafe for ServoLayoutNode<'dom>

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> Downcast<T> for T

source§

fn downcast(&self) -> &T

source§

impl<T> Filterable for T

source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
§

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

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>,

§

type Error = Infallible

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>,

§

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> Upcast<T> for T

source§

fn upcast(&self) -> Option<&T>

source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

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

source§

impl<T> MaybeSendSync for T

source§

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

source§

impl<T> WasmNotSendSync for T

source§

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