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

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

Source

pub(super) fn focus_state(self) -> bool

Source§

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

Source§

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

Source§

impl<'dom> LayoutDom<'dom, HTMLTextAreaElement>

Source§

impl LayoutDom<'_, HTMLVideoElement>

Source§

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

Source

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

Trait Implementations§

Source§

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

Source§

fn value(self) -> &'dom AttrValue

Source§

fn as_str(&self) -> &'dom str

Source§

fn to_tokens(self) -> Option<&'dom [Atom]>

Source§

fn local_name(self) -> &'dom LocalName

Source§

fn namespace(self) -> &'dom Namespace

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 HTMLBodyElementLayoutHelpers for LayoutDom<'_, HTMLBodyElement>

Source§

impl HTMLFontElementLayoutHelpers for LayoutDom<'_, HTMLFontElement>

Source§

impl HTMLHRLayoutHelpers for LayoutDom<'_, HTMLHRElement>

Source§

impl HTMLIFrameElementLayoutMethods for LayoutDom<'_, HTMLIFrameElement>

Source§

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

Source§

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

Source§

impl HTMLTableElementLayoutHelpers for LayoutDom<'_, HTMLTableElement>

Source§

impl HTMLTableRowElementLayoutHelpers for LayoutDom<'_, HTMLTableRowElement>

Source§

impl HTMLTableSectionElementLayoutHelpers for LayoutDom<'_, HTMLTableSectionElement>

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 LayoutCanvasRenderingContextHelpers for LayoutDom<'_, CanvasRenderingContext2D>

Source§

fn canvas_data_source(self) -> Option<ImageKey>

None is rendered as transparent black (cleared canvas)
Source§

impl LayoutCanvasRenderingContextHelpers for LayoutDom<'_, GPUCanvasContext>

Source§

fn canvas_data_source(self) -> Option<ImageKey>

None is rendered as transparent black (cleared canvas)
Source§

impl LayoutCanvasRenderingContextHelpers for LayoutDom<'_, ImageBitmapRenderingContext>

Source§

fn canvas_data_source(self) -> Option<ImageKey>

None is rendered as transparent black (cleared canvas)
Source§

impl LayoutCanvasRenderingContextHelpers for LayoutDom<'_, WebGL2RenderingContext>

Source§

fn canvas_data_source(self) -> Option<ImageKey>

None is rendered as transparent black (cleared canvas)
Source§

impl LayoutCanvasRenderingContextHelpers for LayoutDom<'_, WebGLRenderingContext>

Source§

fn canvas_data_source(self) -> Option<ImageKey>

None is rendered as transparent black (cleared canvas)
Source§

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

Source§

fn data_for_layout(self) -> &'dom str

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn get_span(self) -> Option<u32>

Source§

fn get_colspan(self) -> Option<u32>

Source§

fn get_rowspan(self) -> Option<u32>

Source§

fn is_html_element(&self) -> bool

Source§

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

Source§

fn style_attribute(self) -> *const Option<Arc<Locked<PropertyDeclarationBlock>>>

Source§

fn local_name(self) -> &'dom LocalName

Source§

fn namespace(self) -> &'dom Namespace

Source§

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

Source§

fn get_lang_for_layout(self) -> String

Source§

fn get_state_for_layout(self) -> ElementState

Source§

fn insert_selector_flags(self, flags: ElementSelectorFlags)

Source§

fn get_selector_flags(self) -> ElementSelectorFlags

Source§

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

The shadow root this element is a host of.
Source§

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

Source§

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

Source§

fn get_attr_vals_for_layout(self, name: &LocalName) -> Vec<&'dom AttrValue>

Source§

fn each_custom_state<F>(self, callback: F)
where F: FnMut(&AtomIdent),

Source§

impl<'dom> LayoutFileListHelpers<'dom> for LayoutDom<'dom, FileList>

Source§

fn len(&self) -> usize

Source§

fn file_for_layout(&self, index: u32) -> Option<&File>

Source§

impl LayoutHTMLCanvasElementHelpers for LayoutDom<'_, HTMLCanvasElement>

Source§

impl LayoutHTMLImageElementHelpers for LayoutDom<'_, HTMLImageElement>

Source§

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

Source§

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

In the past, we are handling the display of element inside the dom tree traversal. With the introduction of shadow DOM, these implementations will be replaced one by one and these will be obselete,

Source§

fn size_for_layout(self) -> u32

Source§

fn selection_for_layout(self) -> Option<Range<usize>>

Source§

impl LayoutHTMLTextAreaElementHelpers for LayoutDom<'_, HTMLTextAreaElement>

Source§

impl LayoutHTMLVideoElementHelpers for LayoutDom<'_, HTMLVideoElement>

Source§

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

Source§

fn is_text_input(&self) -> bool

Whether this element should layout as a special case input element.

Source§

fn type_id_for_layout(self) -> NodeTypeId

Source§

fn is_element_for_layout(&self) -> bool

Source§

fn is_text_node_for_layout(&self) -> bool

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

unsafe fn initialize_style_data(self)

Initialize the style data of this node. Read more
Source§

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

Initialize the opaque layout data of this node. Read more
Source§

unsafe fn clear_style_and_layout_data(self)

Clear the style and opaque layout data of this node. Read more
Source§

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§

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§

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

Source§

fn selection(self) -> Option<Range<usize>>

Source§

fn image_url(self) -> Option<ServoUrl>

Source§

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

Source§

fn image_density(self) -> Option<f64>

Source§

fn canvas_data(self) -> Option<HTMLCanvasData>

Source§

fn media_data(self) -> Option<HTMLMediaData>

Source§

fn svg_data(self) -> Option<SVGElementData>

Source§

fn iframe_browsing_context_id(self) -> Option<BrowsingContextId>

Source§

fn iframe_pipeline_id(self) -> Option<PipelineId>

Source§

fn opaque(self) -> OpaqueNode

Source§

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

Source§

fn is_in_ua_widget(&self) -> bool

Source§

impl LayoutSVGSVGElementHelpers for LayoutDom<'_, SVGSVGElement>

Source§

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

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

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,