#[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 TImplementations§
Source§impl<'dom, T> LayoutDom<'dom, T>where
T: Castable,
impl<'dom, T> LayoutDom<'dom, T>where
T: Castable,
Sourcepub(crate) fn upcast<U>(&self) -> LayoutDom<'dom, U>where
U: Castable,
T: DerivedFrom<U>,
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.
Sourcepub(crate) fn downcast<U>(&self) -> Option<LayoutDom<'dom, U>>where
U: DerivedFrom<T>,
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.
Sourcepub(crate) fn is<U>(&self) -> boolwhere
U: DerivedFrom<T>,
pub(crate) fn is<U>(&self) -> boolwhere
U: DerivedFrom<T>,
Returns whether this inner object is a U.
Source§impl<T> LayoutDom<'_, T>where
T: DomObject,
impl<T> LayoutDom<'_, T>where
T: DomObject,
Sourcepub(crate) unsafe fn get_jsobject(&self) -> *mut JSObject
pub(crate) unsafe fn get_jsobject(&self) -> *mut JSObject
Get the reflector.
Source§impl LayoutDom<'_, Node>
impl LayoutDom<'_, Node>
Sourcepub(crate) unsafe fn from_trusted_node_address(
inner: TrustedNodeAddress,
) -> Self
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,
impl<'dom, T> LayoutDom<'dom, T>where
T: 'dom + DomObject,
Sourcepub(crate) fn unsafe_get(self) -> &'dom T
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.
Sourcepub(crate) unsafe fn to_layout_slice(
slice: &'dom [Dom<T>],
) -> &'dom [LayoutDom<'dom, T>]
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, HTMLImageElement>
impl<'dom> LayoutDom<'dom, HTMLImageElement>
fn current_request(self) -> &'dom ImageRequest
fn dimension_attribute_source(self) -> LayoutDom<'dom, Element>
Source§impl<'dom> LayoutDom<'dom, HTMLInputElement>
impl<'dom> LayoutDom<'dom, HTMLInputElement>
fn get_raw_textinput_value(self) -> DOMString
fn input_type(self) -> InputType
fn textinput_sorted_selection_offsets_range(self) -> Range<Utf8CodeUnitLength> ⓘ
Source§impl<'dom> LayoutDom<'dom, HTMLTextAreaElement>
impl<'dom> LayoutDom<'dom, HTMLTextAreaElement>
Trait Implementations§
Source§impl<'dom> AttrHelpersForLayout<'dom> for LayoutDom<'dom, Attr>
impl<'dom> AttrHelpersForLayout<'dom> for LayoutDom<'dom, Attr>
Source§impl HTMLBodyElementLayoutHelpers for LayoutDom<'_, HTMLBodyElement>
impl HTMLBodyElementLayoutHelpers for LayoutDom<'_, HTMLBodyElement>
fn get_background_color(self) -> Option<AbsoluteColor>
fn get_color(self) -> Option<AbsoluteColor>
Source§impl HTMLFontElementLayoutHelpers for LayoutDom<'_, HTMLFontElement>
impl HTMLFontElementLayoutHelpers for LayoutDom<'_, HTMLFontElement>
Source§impl HTMLHRLayoutHelpers for LayoutDom<'_, HTMLHRElement>
impl HTMLHRLayoutHelpers for LayoutDom<'_, HTMLHRElement>
fn get_color(self) -> Option<AbsoluteColor>
fn get_width(self) -> LengthOrPercentageOrAuto
fn get_size_info(self) -> Option<SizePresentationalHint>
Source§impl HTMLIFrameElementLayoutMethods for LayoutDom<'_, HTMLIFrameElement>
impl HTMLIFrameElementLayoutMethods for LayoutDom<'_, HTMLIFrameElement>
fn pipeline_id(self) -> Option<PipelineId>
fn browsing_context_id(self) -> Option<BrowsingContextId>
fn get_width(self) -> LengthOrPercentageOrAuto
fn get_height(self) -> LengthOrPercentageOrAuto
Source§impl<'dom> HTMLTableCellElementLayoutHelpers<'dom> for LayoutDom<'dom, HTMLTableCellElement>
impl<'dom> HTMLTableCellElementLayoutHelpers<'dom> for LayoutDom<'dom, HTMLTableCellElement>
fn get_background_color(self) -> Option<AbsoluteColor>
fn get_colspan(self) -> Option<u32>
fn get_rowspan(self) -> Option<u32>
fn get_table(self) -> Option<LayoutDom<'dom, HTMLTableElement>>
fn get_width(self) -> LengthOrPercentageOrAuto
fn get_height(self) -> LengthOrPercentageOrAuto
Source§impl<'dom> HTMLTableColElementLayoutHelpers<'dom> for LayoutDom<'dom, HTMLTableColElement>
impl<'dom> HTMLTableColElementLayoutHelpers<'dom> for LayoutDom<'dom, HTMLTableColElement>
Source§impl HTMLTableElementLayoutHelpers for LayoutDom<'_, HTMLTableElement>
impl HTMLTableElementLayoutHelpers for LayoutDom<'_, HTMLTableElement>
fn get_background_color(self) -> Option<AbsoluteColor>
fn get_border(self) -> Option<u32>
fn get_cellpadding(self) -> Option<u32>
fn get_cellspacing(self) -> Option<u32>
fn get_width(self) -> LengthOrPercentageOrAuto
fn get_height(self) -> LengthOrPercentageOrAuto
Source§impl HTMLTableRowElementLayoutHelpers for LayoutDom<'_, HTMLTableRowElement>
impl HTMLTableRowElementLayoutHelpers for LayoutDom<'_, HTMLTableRowElement>
fn get_background_color(self) -> Option<AbsoluteColor>
fn get_height(self) -> LengthOrPercentageOrAuto
Source§impl HTMLTableSectionElementLayoutHelpers for LayoutDom<'_, HTMLTableSectionElement>
impl HTMLTableSectionElementLayoutHelpers for LayoutDom<'_, HTMLTableSectionElement>
fn get_background_color(self) -> Option<AbsoluteColor>
fn get_height(self) -> LengthOrPercentageOrAuto
Source§impl<'dom> LayoutCharacterDataHelpers<'dom> for LayoutDom<'dom, CharacterData>
impl<'dom> LayoutCharacterDataHelpers<'dom> for LayoutDom<'dom, CharacterData>
fn data_for_layout(self) -> &'dom str
Source§impl<'dom> LayoutDocumentHelpers<'dom> for LayoutDom<'dom, Document>
impl<'dom> LayoutDocumentHelpers<'dom> for LayoutDom<'dom, Document>
fn is_html_document_for_layout(&self) -> bool
fn quirks_mode(self) -> QuirksMode
fn shadow_roots(self) -> Vec<LayoutDom<'dom, ShadowRoot>>
fn shadow_roots_styles_changed(self) -> bool
fn flush_shadow_roots_stylesheets(self)
Source§impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element>
impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element>
fn attrs(self) -> &'dom [LayoutDom<'dom, Attr>]
fn has_class_or_part_for_layout( self, name: &AtomIdent, attr_name: &LocalName, case_sensitivity: CaseSensitivity, ) -> bool
fn get_classes_for_layout(self) -> Option<&'dom [Atom]>
fn get_parts_for_layout(self) -> Option<&'dom [Atom]>
fn synthesize_presentational_hints_for_legacy_attributes<V>(self, hints: &mut V)where
V: Push<ApplicableDeclarationBlock>,
fn get_span(self) -> Option<u32>
fn get_colspan(self) -> Option<u32>
fn get_rowspan(self) -> Option<u32>
fn is_html_element(&self) -> bool
fn id_attribute(self) -> *const Option<Atom>
fn style_attribute(self) -> *const Option<Arc<Locked<PropertyDeclarationBlock>>>
fn local_name(self) -> &'dom LocalName
fn namespace(self) -> &'dom Namespace
fn get_lang_attr_val_for_layout(self) -> Option<&'dom str>
fn get_lang_for_layout(self) -> String
fn get_state_for_layout(self) -> ElementState
fn insert_selector_flags(self, flags: ElementSelectorFlags)
fn get_selector_flags(self) -> ElementSelectorFlags
Source§fn get_shadow_root_for_layout(self) -> Option<LayoutDom<'dom, ShadowRoot>>
fn get_shadow_root_for_layout(self) -> Option<LayoutDom<'dom, ShadowRoot>>
fn get_attr_for_layout( self, namespace: &Namespace, name: &LocalName, ) -> Option<&'dom AttrValue>
fn get_attr_val_for_layout( self, namespace: &Namespace, name: &LocalName, ) -> Option<&'dom str>
fn get_attr_vals_for_layout( self, name: &LocalName, ) -> impl Iterator<Item = &'dom AttrValue>
fn each_custom_state_for_layout(self, callback: impl FnMut(&AtomIdent))
Source§impl LayoutHTMLCanvasElementHelpers for LayoutDom<'_, HTMLCanvasElement>
impl LayoutHTMLCanvasElementHelpers for LayoutDom<'_, HTMLCanvasElement>
fn data(self) -> HTMLCanvasData
Source§impl LayoutHTMLImageElementHelpers for LayoutDom<'_, HTMLImageElement>
impl LayoutHTMLImageElementHelpers for LayoutDom<'_, HTMLImageElement>
fn image_url(self) -> Option<ServoUrl>
fn image_data(self) -> (Option<Image>, Option<ImageMetadata>)
fn image_density(self) -> Option<f64>
fn showing_broken_image_icon(self) -> bool
fn get_width(self) -> LengthOrPercentageOrAuto
fn get_height(self) -> LengthOrPercentageOrAuto
Source§impl<'dom> LayoutHTMLInputElementHelpers<'dom> for LayoutDom<'dom, HTMLInputElement>
impl<'dom> LayoutHTMLInputElementHelpers<'dom> for LayoutDom<'dom, HTMLInputElement>
Source§fn size_for_layout(self) -> u32
fn size_for_layout(self) -> u32
Textual input, specifically text entry and domain specific input has a default preferred size.
https://html.spec.whatwg.org/multipage/#the-input-element-as-a-text-entry-widget https://html.spec.whatwg.org/multipage/#the-input-element-as-domain-specific-widgets
fn selection_for_layout(self) -> Option<Range<usize>>
Source§impl LayoutHTMLVideoElementHelpers for LayoutDom<'_, HTMLVideoElement>
impl LayoutHTMLVideoElementHelpers for LayoutDom<'_, HTMLVideoElement>
fn data(self) -> HTMLMediaData
fn get_width(self) -> LengthOrPercentageOrAuto
fn get_height(self) -> LengthOrPercentageOrAuto
Source§impl<'dom> LayoutNodeHelpers<'dom> for LayoutDom<'dom, Node>
impl<'dom> LayoutNodeHelpers<'dom> for LayoutDom<'dom, Node>
Source§fn selection(self) -> Option<Range<usize>>
fn selection(self) -> Option<Range<usize>>
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.
fn type_id_for_layout(self) -> NodeTypeId
fn is_element_for_layout(&self) -> bool
fn is_text_node_for_layout(&self) -> bool
fn parent_node_ref(self) -> Option<LayoutDom<'dom, Node>>
fn composed_parent_node_ref(self) -> Option<LayoutDom<'dom, Node>>
fn first_child_ref(self) -> Option<LayoutDom<'dom, Node>>
fn last_child_ref(self) -> Option<LayoutDom<'dom, Node>>
fn prev_sibling_ref(self) -> Option<LayoutDom<'dom, Node>>
fn next_sibling_ref(self) -> Option<LayoutDom<'dom, Node>>
fn owner_doc_for_layout(self) -> LayoutDom<'dom, Document>
fn containing_shadow_root_for_layout( self, ) -> Option<LayoutDom<'dom, ShadowRoot>>
fn assigned_slot_for_layout(self) -> Option<LayoutDom<'dom, HTMLSlotElement>>
unsafe fn get_flag(self, flag: NodeFlags) -> bool
unsafe fn set_flag(self, flag: NodeFlags, value: bool)
fn style_data(self) -> Option<&'dom StyleData>
fn layout_data(self) -> Option<&'dom GenericLayoutData>
Source§unsafe fn initialize_style_data(self)
unsafe fn initialize_style_data(self)
Source§unsafe fn initialize_layout_data(self, new_data: Box<GenericLayoutData>)
unsafe fn initialize_layout_data(self, new_data: Box<GenericLayoutData>)
Source§unsafe fn clear_style_and_layout_data(self)
unsafe fn clear_style_and_layout_data(self)
Source§fn is_single_line_text_inner_editor(&self) -> bool
fn is_single_line_text_inner_editor(&self) -> bool
Source§fn is_text_container_of_single_line_input(&self) -> bool
fn is_text_container_of_single_line_input(&self) -> bool
fn text_content(self) -> Cow<'dom, str>
fn image_url(self) -> Option<ServoUrl>
fn image_data(self) -> Option<(Option<Image>, Option<ImageMetadata>)>
fn image_density(self) -> Option<f64>
fn showing_broken_image_icon(self) -> bool
fn canvas_data(self) -> Option<HTMLCanvasData>
fn media_data(self) -> Option<HTMLMediaData>
fn svg_data(self) -> Option<SVGElementData>
fn iframe_browsing_context_id(self) -> Option<BrowsingContextId>
fn iframe_pipeline_id(self) -> Option<PipelineId>
fn opaque(self) -> OpaqueNode
fn implemented_pseudo_element(&self) -> Option<PseudoElement>
fn is_in_ua_widget(&self) -> bool
Source§impl LayoutSVGSVGElementHelpers for LayoutDom<'_, SVGSVGElement>
impl LayoutSVGSVGElementHelpers for LayoutDom<'_, SVGSVGElement>
fn data(self) -> SVGElementData
Source§impl<'dom> LayoutShadowRootHelpers<'dom> for LayoutDom<'dom, ShadowRoot>
impl<'dom> LayoutShadowRootHelpers<'dom> for LayoutDom<'dom, ShadowRoot>
fn get_host_for_layout(self) -> LayoutDom<'dom, Element>
fn get_style_data_for_layout(self) -> &'dom CascadeData
fn is_ua_widget(&self) -> bool
unsafe fn flush_stylesheets<E: TElement>( self, stylist: &mut Stylist, guard: &SharedRwLockReadGuard<'_>, )
impl<T> Copy for LayoutDom<'_, T>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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