ServoLayoutNode

Struct ServoLayoutNode 

Source
pub struct ServoLayoutNode<'dom> {
    pub(super) node: LayoutDom<'dom, Node>,
    pub(super) pseudo_element_chain: PseudoElementChain,
}
Expand description

A wrapper around a LayoutDom<Node> which provides a safe interface that can be used during layout. This implements the LayoutNode trait.

Fields§

§node: LayoutDom<'dom, Node>

The wrapped private DOM node.

§pseudo_element_chain: PseudoElementChain

The possibly nested PseudoElementChain for this node.

Implementations§

Source§

impl<'dom> ServoLayoutNode<'dom>

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) unsafe fn dangerous_first_child(&self) -> Option<Self>

Get the first child of this node.

§Safety

This node should never be exposed directly to the layout interface, as that may allow mutating a node that is being laid out in another thread. Thus, this should never be made public or exposed in the LayoutNode trait.

Source

pub(super) unsafe fn dangerous_next_sibling(&self) -> Option<Self>

Get the next sibling of this node.

§Safety

This node should never be exposed directly to the layout interface, as that may allow mutating a node that is being laid out in another thread. Thus, this should never be made public or exposed in the LayoutNode trait.

Source

pub(super) unsafe fn dangerous_previous_sibling(&self) -> Option<Self>

Get the previous sibling of this node.

§Safety

This node should never be exposed directly to the layout interface, as that may allow mutating a node that is being laid out in another thread. Thus, this should never be made public or exposed in the LayoutNode trait.

Trait Implementations§

Source§

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

Source§

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

Returns a duplicate 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> From<LayoutDom<'dom, Node>> for ServoLayoutNode<'dom>

Source§

fn from(node: LayoutDom<'dom, Node>) -> Self

Converts to this type from the input type.
Source§

impl<'dom> Hash for ServoLayoutNode<'dom>

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

Source§

type ConcreteDangerousStyleNode = ServoDangerousStyleNode<'dom>

The concrete implementation of DangerousStyleNode implemented in script.
Source§

type ConcreteDangerousStyleElement = ServoDangerousStyleElement<'dom>

The concrete implementation of DangerousStyleElement implemented in script.
Source§

type ConcreteLayoutElement = ServoLayoutElement<'dom>

The concrete implementation of [ConcreteLayoutElement] implemented in script.
Source§

type ChildIterator = ServoLayoutNodeChildrenIterator<'dom>

The concrete implementation of [ChildIterator] implemented in script.
Source§

fn with_pseudo(&self, pseudo_element_type: PseudoElement) -> Option<Self>

Creates a new LayoutNode for the same LayoutNode with a different pseudo-element type. Read more
Source§

unsafe fn dangerous_style_node(self) -> Self::ConcreteDangerousStyleNode

Returns access to a version of this LayoutNode that can be used by stylo and selectors. This is dangerous as it allows more access to ancestors nodes than LayoutNode. This should only be used when handing a node to stylo or selectors. Read more
Source§

unsafe fn dangerous_dom_parent(self) -> Option<Self>

Returns access to the DOM parent node of this node. This does not take into account shadow tree children and slottables. For that use Self::dangerous_flat_tree_parent. Read more
Source§

unsafe fn dangerous_flat_tree_parent(self) -> Option<Self>

Returns access to the flat tree parent node of this node. This takes into account shadow tree children and slottables. For that use Self::dangerous_flat_tree_parent. Read more
Source§

fn is_connected(&self) -> bool

Returns whether the node is connected.
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 opaque(&self) -> OpaqueNode

Converts self into an OpaqueNode.
Source§

fn pseudo_element_chain(&self) -> PseudoElementChain

Returns the PseudoElementChain for this LayoutElement.
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 style(&self, context: &SharedStyleContext<'_>) -> Arc<ComputedValues>

Returns the computed style for the given node, properly handling pseudo-elements. For elements this returns their style and for other nodes, this returns the style of the parent element, if one exists. Read more
Source§

fn parent_style(&self, context: &SharedStyleContext<'_>) -> 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. Read more
Source§

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

Returns the computed :selected style for the given node, properly handling pseudo-elements. For elements this returns their style and for other nodes, this returns the style of the parent element, if one exists. Read more
Source§

fn initialize_layout_data<RequestedLayoutDataType: LayoutDataTrait>(&self)

Initialize this node with empty opaque layout data.
Source§

fn flat_tree_children( &self, ) -> LayoutIterator<ServoLayoutNodeChildrenIterator<'dom>>

Returns an iterator over this node’s children in the flat tree. This takes into account shadow tree children and slottables.
Source§

fn dom_children(&self) -> LayoutIterator<ServoLayoutNodeChildrenIterator<'dom>>

Returns an iterator over this node’s children in the DOM. This does not take shadow roots and assigned slottables into account. For that use Self::flat_tree_children.
Source§

fn as_element(&self) -> Option<ServoLayoutElement<'dom>>

Returns a LayoutElement if this is an element.
Source§

fn as_html_element(&self) -> Option<ServoLayoutElement<'dom>>

Returns a LayoutElement if this is an element in the HTML namespace, None otherwise.
Source§

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

Get the text content of this node, if it is a text node. Read more
Source§

fn selection(&self) -> Option<SharedSelection>

If this node manages a selection, this returns the shared selection for the node.
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 showing_broken_image_icon(&self) -> bool

Whether or not this is an image element that is showing a broken image icon.
Source§

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

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

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

Return the [HTMLCanvas] data for this node, if it is a canvas.
Source§

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

Return the HTMLMediaData for this node, if it is a media element.
Source§

fn svg_data(&self) -> Option<SVGElementData<'dom>>

Return the SVGElementData for this node, if it is an SVG subtree.
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 table_span(&self) -> Option<u32>

Return the table span property if it is an element that supports it.
Source§

fn table_colspan(&self) -> Option<u32>

Return the table colspan property if it is an element that supports it.
Source§

fn table_rowspan(&self) -> Option<u32>

Return the table rowspan property if it is an element that supports it.
Source§

fn set_uses_content_attribute_with_attr( &self, uses_content_attribute_with_attr: bool, )

Set whether or not this node has an active pseudo-element style with a content attribute that uses attr.
Source§

fn is_single_line_text_input(&self) -> bool

Whether this is a container for the text within a single-line text input. This is used to solve the special case of line height for a text entry widget. https://html.spec.whatwg.org/multipage/#the-input-element-as-a-text-entry-widget
Source§

fn is_root_of_user_agent_widget(&self) -> bool

Whether or not this LayoutNode is in a user agent widget shadow DOM.
Source§

impl NodeInfo for ServoLayoutNode<'_>

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'dom> Copy for ServoLayoutNode<'dom>

Source§

impl<'dom> Eq 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.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

Source§

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

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