LayoutDom

Struct LayoutDom 

Source
#[repr(transparent)]
pub(crate) struct LayoutDom<'dom, T> { value: &'dom T, }
Expand description

An unrooted reference to a DOM object for use in layout. Layout*Helpers traits must be implemented on this.

Fields§

§value: &'dom T

Implementations§

Source§

impl<'dom> LayoutDom<'dom, Attr>

Source

pub(crate) fn value(self) -> &'dom AttrValue

Source

pub(crate) fn local_name(self) -> &'dom LocalName

Source

pub(crate) fn namespace(self) -> &'dom Namespace

Source§

impl<'dom, T> LayoutDom<'dom, T>
where T: Castable,

Source

pub(crate) fn upcast<U>(&self) -> LayoutDom<'dom, U>
where U: Castable, T: DerivedFrom<U>,

Cast a DOM object root upwards to one of the interfaces it derives from.

Source

pub(crate) fn downcast<U>(&self) -> Option<LayoutDom<'dom, U>>
where U: DerivedFrom<T>,

Cast a DOM object downwards to one of the interfaces it might implement.

Source

pub(crate) fn is<U>(&self) -> bool
where U: DerivedFrom<T>,

Returns whether this inner object is a U.

Source

pub(crate) unsafe fn as_ref(self) -> &'dom T

Get a reference to the internal value.

§SAFETY

This function effectively circumvents all the safety provided by LayoutDom as it allows performing arbitrary (potentially mutating) operations on the value. Use with caution!

Source§

impl<T> LayoutDom<'_, T>
where T: DomObject,

Source

pub(crate) unsafe fn get_jsobject(&self) -> *mut JSObject

Get the reflector.

Source§

impl LayoutDom<'_, Node>

Source

pub(crate) unsafe fn from_trusted_node_address( inner: TrustedNodeAddress, ) -> Self

Create a new JS-owned value wrapped from an address known to be a Node pointer.

Source§

impl<'dom, T> LayoutDom<'dom, T>
where T: 'dom + DomObject,

Source

pub(crate) fn unsafe_get(self) -> &'dom T

Returns a reference to the interior of this JS object. The fact that this is unsafe is what necessitates the layout wrappers.

Source

pub(crate) unsafe fn to_layout_slice( slice: &'dom [Dom<T>], ) -> &'dom [LayoutDom<'dom, T>]

Transforms a slice of Dom<T> into a slice of LayoutDom<T>.

Source§

impl<'dom> LayoutDom<'dom, CharacterData>

Source

pub(crate) fn data_for_layout(self) -> &'dom str

Source§

impl<'dom> LayoutDom<'dom, Document>

Source

pub(crate) fn is_html_document_for_layout(&self) -> bool

Source

pub(crate) fn quirks_mode(self) -> QuirksMode

Source

pub(crate) fn style_shared_lock(self) -> &'dom StyleSharedRwLock

Source

pub(crate) fn flush_shadow_root_stylesheets_if_necessary( self, stylist: &mut Stylist, guard: &SharedRwLockReadGuard<'_>, )

Source

pub(crate) fn shadow_roots_styles_changed(self) -> bool

Source

pub(crate) fn elements_with_id(self, id: &Atom) -> &[LayoutDom<'dom, Element>]

Source§

impl<'dom> LayoutDom<'dom, DocumentFragment>

Source

pub(crate) fn shadowroot_host_for_layout(self) -> LayoutDom<'dom, Element>

Source§

impl<'dom> LayoutDom<'dom, Element>

Source

pub(crate) fn is_root(&self) -> bool

Source

pub(crate) fn is_body_element_of_html_element_root(&self) -> bool

Returns true if this element is the body child of an html element root element.

Source

pub(crate) fn attrs(self) -> &'dom [LayoutDom<'dom, Attr>]

Source

pub(crate) fn has_class_or_part_for_layout( self, name: &AtomIdent, attr_name: &LocalName, case_sensitivity: CaseSensitivity, ) -> bool

Source

pub(crate) fn get_classes_for_layout(self) -> Option<&'dom [Atom]>

Source

pub(crate) fn get_parts_for_layout(self) -> Option<&'dom [Atom]>

Source

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

Source

pub(crate) unsafe fn initialize_style_data(self)

Source

pub(crate) unsafe fn clear_style_data(self)

Source

pub(crate) fn synthesize_presentational_hints_for_legacy_attributes<V>( self, hints: &mut V, )

Source

pub(crate) fn get_span(self) -> Option<u32>

Source

pub(crate) fn get_colspan(self) -> Option<u32>

Source

pub(crate) fn get_rowspan(self) -> Option<u32>

Source

pub(crate) fn is_html_element(&self) -> bool

Source

pub(crate) fn id_attribute(self) -> *const Option<Atom>

Source

pub(crate) fn style_attribute( self, ) -> *const Option<ServoArc<Locked<PropertyDeclarationBlock>>>

Source

pub(crate) fn local_name(self) -> &'dom LocalName

Source

pub(crate) fn namespace(self) -> &'dom Namespace

Source

pub(crate) fn get_lang_attr_val_for_layout(self) -> Option<&'dom str>

Source

pub(crate) fn get_lang_for_layout(self) -> String

Source

pub(crate) fn get_state_for_layout(self) -> ElementState

Source

pub(crate) fn insert_selector_flags(self, flags: ElementSelectorFlags)

Source

pub(crate) fn get_selector_flags(self) -> ElementSelectorFlags

Source

pub(crate) fn get_shadow_root_for_layout( self, ) -> Option<LayoutDom<'dom, ShadowRoot>>

Source

pub(crate) fn get_attr_for_layout( self, namespace: &Namespace, name: &LocalName, ) -> Option<&'dom AttrValue>

Source

pub(crate) fn get_attr_val_for_layout( self, namespace: &Namespace, name: &LocalName, ) -> Option<&'dom str>

Source

pub(crate) fn get_attr_vals_for_layout( self, name: &LocalName, ) -> impl Iterator<Item = &'dom AttrValue>

Source

pub(crate) fn each_custom_state_for_layout( self, callback: impl FnMut(&AtomIdent), )

Source§

impl LayoutDom<'_, HTMLBodyElement>

Source§

impl LayoutDom<'_, HTMLCanvasElement>

Source

pub(crate) fn data(self) -> HTMLCanvasData

Source§

impl LayoutDom<'_, HTMLFontElement>

Source

pub(crate) fn get_color(self) -> Option<AbsoluteColor>

Source

pub(crate) fn get_face(self) -> Option<Atom>

Source

pub(crate) fn get_size(self) -> Option<u32>

Source§

impl LayoutDom<'_, HTMLHRElement>

Source§

impl LayoutDom<'_, HTMLIFrameElement>

Source§

impl<'dom> LayoutDom<'dom, HTMLImageElement>

Source§

impl<'dom> LayoutDom<'dom, HTMLInputElement>

Source§

impl<'dom> LayoutDom<'dom, HTMLTableCellElement>

Source

pub(crate) fn get_background_color(self) -> Option<AbsoluteColor>

Source

pub(crate) fn get_colspan(self) -> Option<u32>

Source

pub(crate) fn get_rowspan(self) -> Option<u32>

Source

pub(crate) fn get_table(self) -> Option<LayoutDom<'dom, HTMLTableElement>>

Source

pub(crate) fn get_width(self) -> LengthOrPercentageOrAuto

Source

pub(crate) fn get_height(self) -> LengthOrPercentageOrAuto

Source§

impl<'dom> LayoutDom<'dom, HTMLTableColElement>

Source

pub(crate) fn get_span(self) -> Option<u32>

Source

pub(crate) fn get_width(self) -> LengthOrPercentageOrAuto

Source§

impl LayoutDom<'_, HTMLTableElement>

Source

pub(crate) fn get_background_color(self) -> Option<AbsoluteColor>

Source

pub(crate) fn get_border(self) -> Option<u32>

Source

pub(crate) fn get_cellpadding(self) -> Option<u32>

Source

pub(crate) fn get_cellspacing(self) -> Option<u32>

Source

pub(crate) fn get_width(self) -> LengthOrPercentageOrAuto

Source

pub(crate) fn get_height(self) -> LengthOrPercentageOrAuto

Source§

impl LayoutDom<'_, HTMLTableRowElement>

Source§

impl LayoutDom<'_, HTMLTableSectionElement>

Source§

impl LayoutDom<'_, HTMLTextAreaElement>

Source

pub(crate) fn selection_for_layout(self) -> SharedSelection

Source

pub(crate) fn get_cols(self) -> u32

Source

pub(crate) fn get_rows(self) -> u32

Source§

impl LayoutDom<'_, HTMLVideoElement>

Source

pub(crate) fn data(self) -> HTMLMediaData

Source

pub(crate) fn get_width(self) -> LengthOrPercentageOrAuto

Source

pub(crate) fn get_height(self) -> LengthOrPercentageOrAuto

Source§

impl<'dom> LayoutDom<'dom, Node>

Source

pub(crate) fn parent_node_ref(self) -> Option<LayoutDom<'dom, Node>>

Source

pub(crate) fn type_id_for_layout(self) -> NodeTypeId

Source

pub(crate) fn is_element_for_layout(&self) -> bool

Source

pub(crate) fn is_text_node_for_layout(&self) -> bool

Source

pub(crate) fn composed_parent_node_ref(self) -> Option<LayoutDom<'dom, Node>>

Source

pub(crate) fn traversal_parent(self) -> Option<LayoutDom<'dom, Element>>

Source

pub(crate) fn first_child_ref(self) -> Option<LayoutDom<'dom, Node>>

Source

pub(crate) fn last_child_ref(self) -> Option<LayoutDom<'dom, Node>>

Source

pub(crate) fn prev_sibling_ref(self) -> Option<LayoutDom<'dom, Node>>

Source

pub(crate) fn next_sibling_ref(self) -> Option<LayoutDom<'dom, Node>>

Source

pub(crate) fn owner_doc_for_layout(self) -> LayoutDom<'dom, Document>

Source

pub(crate) fn containing_shadow_root_for_layout( self, ) -> Option<LayoutDom<'dom, ShadowRoot>>

Source

pub(crate) fn assigned_slot_for_layout( self, ) -> Option<LayoutDom<'dom, HTMLSlotElement>>

Source

pub(crate) unsafe fn get_flag(self, flag: NodeFlags) -> bool

Source

pub(crate) unsafe fn set_flag(self, flag: NodeFlags, value: bool)

Source

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

Source

pub(crate) unsafe fn initialize_layout_data( self, new_data: Box<GenericLayoutData>, )

Initialize the style data of this node.

§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

pub(crate) unsafe fn clear_layout_data(self)

Clear the style and opaque layout data of this node.

§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

pub(crate) fn is_single_line_text_inner_editor(&self) -> bool

Whether this element serve as a container of editable text for a text input that is implemented as an UA widget.

Source

pub(crate) fn is_text_container_of_single_line_input(&self) -> bool

Whether this element serve as a container of any text inside a text input that is implemented as an UA widget.

Source

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

Source

pub(crate) fn selection(self) -> Option<SharedSelection>

Get the selection for the given node. This only works for text nodes that are in the shadow DOM of user agent widgets for form controls, specifically for <input> and <textarea>.

As we want to expose the selection on the inner text node of the widget’s shadow DOM, we must find the shadow root and then access the containing element itself.

Source

pub(crate) fn image_url(self) -> Option<ServoUrl>

Source

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

Source

pub(crate) fn image_density(self) -> Option<f64>

Source

pub(crate) fn showing_broken_image_icon(self) -> bool

Source

pub(crate) fn canvas_data(self) -> Option<HTMLCanvasData>

Source

pub(crate) fn media_data(self) -> Option<HTMLMediaData>

Source

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

Source

pub(crate) fn iframe_browsing_context_id(self) -> Option<BrowsingContextId>

Source

pub(crate) fn iframe_pipeline_id(self) -> Option<PipelineId>

Source

pub(crate) fn opaque(self) -> OpaqueNode

Source

pub(crate) fn implemented_pseudo_element(&self) -> Option<PseudoElement>

Source

pub(crate) fn is_in_ua_widget(&self) -> bool

Source

pub(crate) fn is_root_of_user_agent_widget(&self) -> bool

Source§

impl<'dom> LayoutDom<'dom, ShadowRoot>

Source

pub(crate) fn get_host_for_layout(self) -> LayoutDom<'dom, Element>

Source

pub(crate) fn get_style_data_for_layout(self) -> &'dom CascadeData

Source

pub(crate) fn is_user_agent_widget(&self) -> bool

Source

pub(crate) unsafe fn flush_stylesheets_for_layout( self, stylist: &mut Stylist, guard: &SharedRwLockReadGuard<'_>, )

Source§

impl<'dom> LayoutDom<'dom, SVGSVGElement>

Source

pub(crate) fn data(self) -> SVGElementData<'dom>

Trait Implementations§

Source§

impl<T> Clone for LayoutDom<'_, T>

Source§

fn clone(&self) -> Self

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 Debug for LayoutDom<'_, Element>

Source§

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

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

impl Debug for LayoutDom<'_, Node>

Source§

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

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

impl<'dom> From<LayoutDom<'dom, Document>> for ServoDangerousStyleDocument<'dom>

Source§

fn from(document: LayoutDom<'dom, Document>) -> Self

Converts to this type from the input type.
Source§

impl<'dom> From<LayoutDom<'dom, Element>> for ServoDangerousStyleElement<'dom>

Source§

fn from(element: LayoutDom<'dom, Element>) -> Self

Converts to this type from the input type.
Source§

impl<'dom> From<LayoutDom<'dom, Element>> for ServoLayoutElement<'dom>

Source§

fn from(element: LayoutDom<'dom, Element>) -> Self

Converts to this type from the input type.
Source§

impl<'dom> From<LayoutDom<'dom, Node>> for ServoDangerousStyleNode<'dom>

Source§

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

Converts to this type from the input type.
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> From<LayoutDom<'dom, ShadowRoot>> for ServoDangerousStyleShadowRoot<'dom>

Source§

fn from(shadow_root: LayoutDom<'dom, ShadowRoot>) -> Self

Converts to this type from the input type.
Source§

impl<T> Hash for LayoutDom<'_, T>

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<T> PartialEq for LayoutDom<'_, T>

Source§

fn eq(&self, other: &Self) -> 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<T> Copy for LayoutDom<'_, T>

Source§

impl<T> Eq for LayoutDom<'_, T>

Auto Trait Implementations§

§

impl<'dom, T> Freeze for LayoutDom<'dom, T>

§

impl<'dom, T> RefUnwindSafe for LayoutDom<'dom, T>
where T: RefUnwindSafe,

§

impl<'dom, T> Send for LayoutDom<'dom, T>
where T: Sync,

§

impl<'dom, T> Sync for LayoutDom<'dom, T>
where T: Sync,

§

impl<'dom, T> Unpin for LayoutDom<'dom, T>

§

impl<'dom, T> UnwindSafe for LayoutDom<'dom, T>
where T: RefUnwindSafe,

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,