#[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, CharacterData>
impl<'dom> LayoutDom<'dom, CharacterData>
pub(crate) fn data_for_layout(self) -> &'dom str
Source§impl<'dom> LayoutDom<'dom, Document>
impl<'dom> LayoutDom<'dom, Document>
pub(crate) fn is_html_document_for_layout(&self) -> bool
pub(crate) fn quirks_mode(self) -> QuirksMode
pub(crate) fn flush_shadow_root_stylesheets_if_necessary( self, stylist: &mut Stylist, guard: &SharedRwLockReadGuard<'_>, )
pub(crate) fn shadow_roots_styles_changed(self) -> bool
pub(crate) fn elements_with_id(self, id: &Atom) -> &[LayoutDom<'dom, Element>]
Source§impl<'dom> LayoutDom<'dom, DocumentFragment>
impl<'dom> LayoutDom<'dom, DocumentFragment>
pub(crate) fn shadowroot_host_for_layout(self) -> LayoutDom<'dom, Element>
Source§impl<'dom> LayoutDom<'dom, Element>
impl<'dom> LayoutDom<'dom, Element>
pub(crate) fn is_root(&self) -> bool
Sourcepub(crate) fn is_body_element_of_html_element_root(&self) -> bool
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.
pub(crate) fn attrs(self) -> &'dom [LayoutDom<'dom, Attr>]
pub(crate) fn has_class_or_part_for_layout( self, name: &AtomIdent, attr_name: &LocalName, case_sensitivity: CaseSensitivity, ) -> bool
pub(crate) fn get_classes_for_layout(self) -> Option<&'dom [Atom]>
pub(crate) fn get_parts_for_layout(self) -> Option<&'dom [Atom]>
pub(crate) fn style_data(self) -> Option<&'dom StyleData>
pub(crate) unsafe fn initialize_style_data(self)
pub(crate) unsafe fn clear_style_data(self)
pub(crate) fn synthesize_presentational_hints_for_legacy_attributes<V>(
self,
hints: &mut V,
)where
V: Push<ApplicableDeclarationBlock>,
pub(crate) fn get_span(self) -> Option<u32>
pub(crate) fn get_colspan(self) -> Option<u32>
pub(crate) fn get_rowspan(self) -> Option<u32>
pub(crate) fn is_html_element(&self) -> bool
pub(crate) fn id_attribute(self) -> *const Option<Atom>
pub(crate) fn style_attribute( self, ) -> *const Option<ServoArc<Locked<PropertyDeclarationBlock>>>
pub(crate) fn local_name(self) -> &'dom LocalName
pub(crate) fn namespace(self) -> &'dom Namespace
pub(crate) fn get_lang_attr_val_for_layout(self) -> Option<&'dom str>
pub(crate) fn get_lang_for_layout(self) -> String
pub(crate) fn get_state_for_layout(self) -> ElementState
pub(crate) fn insert_selector_flags(self, flags: ElementSelectorFlags)
pub(crate) fn get_selector_flags(self) -> ElementSelectorFlags
pub(crate) fn get_shadow_root_for_layout( self, ) -> Option<LayoutDom<'dom, ShadowRoot>>
pub(crate) fn get_attr_for_layout( self, namespace: &Namespace, name: &LocalName, ) -> Option<&'dom AttrValue>
pub(crate) fn get_attr_val_for_layout( self, namespace: &Namespace, name: &LocalName, ) -> Option<&'dom str>
pub(crate) fn get_attr_vals_for_layout( self, name: &LocalName, ) -> impl Iterator<Item = &'dom AttrValue>
pub(crate) fn each_custom_state_for_layout( self, callback: impl FnMut(&AtomIdent), )
Source§impl LayoutDom<'_, HTMLBodyElement>
impl LayoutDom<'_, HTMLBodyElement>
pub(crate) fn get_background_color(self) -> Option<AbsoluteColor>
pub(crate) fn get_color(self) -> Option<AbsoluteColor>
Source§impl LayoutDom<'_, HTMLCanvasElement>
impl LayoutDom<'_, HTMLCanvasElement>
pub(crate) fn data(self) -> HTMLCanvasData
Source§impl LayoutDom<'_, HTMLFontElement>
impl LayoutDom<'_, HTMLFontElement>
Source§impl LayoutDom<'_, HTMLHRElement>
impl LayoutDom<'_, HTMLHRElement>
pub(crate) fn get_color(self) -> Option<AbsoluteColor>
pub(crate) fn get_width(self) -> LengthOrPercentageOrAuto
pub(crate) fn get_size_info(self) -> Option<SizePresentationalHint>
Source§impl LayoutDom<'_, HTMLIFrameElement>
impl LayoutDom<'_, HTMLIFrameElement>
pub(crate) fn pipeline_id(self) -> Option<PipelineId>
pub(crate) fn browsing_context_id(self) -> Option<BrowsingContextId>
pub(crate) fn get_width(self) -> LengthOrPercentageOrAuto
pub(crate) fn get_height(self) -> LengthOrPercentageOrAuto
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>
pub(crate) fn image_url(self) -> Option<ServoUrl>
pub(crate) fn image_data(self) -> (Option<Image>, Option<ImageMetadata>)
pub(crate) fn image_density(self) -> Option<f64>
pub(crate) fn showing_broken_image_icon(self) -> bool
pub(crate) fn get_width(self) -> LengthOrPercentageOrAuto
pub(crate) fn get_height(self) -> LengthOrPercentageOrAuto
Source§impl<'dom> LayoutDom<'dom, HTMLInputElement>
impl<'dom> LayoutDom<'dom, HTMLInputElement>
Sourcepub(crate) fn size_for_layout(self) -> u32
pub(crate) 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
pub(crate) fn selection_for_layout(self) -> Option<SharedSelection>
Source§impl<'dom> LayoutDom<'dom, HTMLTableCellElement>
impl<'dom> LayoutDom<'dom, HTMLTableCellElement>
pub(crate) fn get_background_color(self) -> Option<AbsoluteColor>
pub(crate) fn get_colspan(self) -> Option<u32>
pub(crate) fn get_rowspan(self) -> Option<u32>
pub(crate) fn get_table(self) -> Option<LayoutDom<'dom, HTMLTableElement>>
pub(crate) fn get_width(self) -> LengthOrPercentageOrAuto
pub(crate) fn get_height(self) -> LengthOrPercentageOrAuto
Source§impl<'dom> LayoutDom<'dom, HTMLTableColElement>
impl<'dom> LayoutDom<'dom, HTMLTableColElement>
Source§impl LayoutDom<'_, HTMLTableElement>
impl LayoutDom<'_, HTMLTableElement>
pub(crate) fn get_background_color(self) -> Option<AbsoluteColor>
pub(crate) fn get_border(self) -> Option<u32>
pub(crate) fn get_cellpadding(self) -> Option<u32>
pub(crate) fn get_cellspacing(self) -> Option<u32>
pub(crate) fn get_width(self) -> LengthOrPercentageOrAuto
pub(crate) fn get_height(self) -> LengthOrPercentageOrAuto
Source§impl LayoutDom<'_, HTMLTableRowElement>
impl LayoutDom<'_, HTMLTableRowElement>
pub(crate) fn get_background_color(self) -> Option<AbsoluteColor>
pub(crate) fn get_height(self) -> LengthOrPercentageOrAuto
Source§impl LayoutDom<'_, HTMLTableSectionElement>
impl LayoutDom<'_, HTMLTableSectionElement>
pub(crate) fn get_background_color(self) -> Option<AbsoluteColor>
pub(crate) fn get_height(self) -> LengthOrPercentageOrAuto
Source§impl LayoutDom<'_, HTMLTextAreaElement>
impl LayoutDom<'_, HTMLTextAreaElement>
pub(crate) fn selection_for_layout(self) -> SharedSelection
pub(crate) fn get_cols(self) -> u32
pub(crate) fn get_rows(self) -> u32
Source§impl LayoutDom<'_, HTMLVideoElement>
impl LayoutDom<'_, HTMLVideoElement>
pub(crate) fn data(self) -> HTMLMediaData
pub(crate) fn get_width(self) -> LengthOrPercentageOrAuto
pub(crate) fn get_height(self) -> LengthOrPercentageOrAuto
Source§impl<'dom> LayoutDom<'dom, Node>
impl<'dom> LayoutDom<'dom, Node>
pub(crate) fn parent_node_ref(self) -> Option<LayoutDom<'dom, Node>>
pub(crate) fn type_id_for_layout(self) -> NodeTypeId
pub(crate) fn is_element_for_layout(&self) -> bool
pub(crate) fn is_text_node_for_layout(&self) -> bool
pub(crate) fn composed_parent_node_ref(self) -> Option<LayoutDom<'dom, Node>>
pub(crate) fn traversal_parent(self) -> Option<LayoutDom<'dom, Element>>
pub(crate) fn first_child_ref(self) -> Option<LayoutDom<'dom, Node>>
pub(crate) fn last_child_ref(self) -> Option<LayoutDom<'dom, Node>>
pub(crate) fn prev_sibling_ref(self) -> Option<LayoutDom<'dom, Node>>
pub(crate) fn next_sibling_ref(self) -> Option<LayoutDom<'dom, Node>>
pub(crate) fn owner_doc_for_layout(self) -> LayoutDom<'dom, Document>
pub(crate) fn containing_shadow_root_for_layout( self, ) -> Option<LayoutDom<'dom, ShadowRoot>>
pub(crate) fn assigned_slot_for_layout( self, ) -> Option<LayoutDom<'dom, HTMLSlotElement>>
pub(crate) unsafe fn get_flag(self, flag: NodeFlags) -> bool
pub(crate) unsafe fn set_flag(self, flag: NodeFlags, value: bool)
pub(crate) fn layout_data(self) -> Option<&'dom GenericLayoutData>
Sourcepub(crate) unsafe fn initialize_layout_data(
self,
new_data: Box<GenericLayoutData>,
)
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.
Sourcepub(crate) unsafe fn clear_layout_data(self)
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.
Sourcepub(crate) fn is_single_line_text_inner_editor(&self) -> bool
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.
Sourcepub(crate) fn is_text_container_of_single_line_input(&self) -> bool
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.
pub(crate) fn text_content(self) -> Cow<'dom, str>
Sourcepub(crate) fn selection(self) -> Option<SharedSelection>
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.
pub(crate) fn image_url(self) -> Option<ServoUrl>
pub(crate) fn image_data(self) -> Option<(Option<Image>, Option<ImageMetadata>)>
pub(crate) fn image_density(self) -> Option<f64>
pub(crate) fn showing_broken_image_icon(self) -> bool
pub(crate) fn canvas_data(self) -> Option<HTMLCanvasData>
pub(crate) fn media_data(self) -> Option<HTMLMediaData>
pub(crate) fn svg_data(self) -> Option<SVGElementData<'dom>>
pub(crate) fn iframe_browsing_context_id(self) -> Option<BrowsingContextId>
pub(crate) fn iframe_pipeline_id(self) -> Option<PipelineId>
pub(crate) fn opaque(self) -> OpaqueNode
pub(crate) fn implemented_pseudo_element(&self) -> Option<PseudoElement>
pub(crate) fn is_in_ua_widget(&self) -> bool
pub(crate) fn is_root_of_user_agent_widget(&self) -> bool
Source§impl<'dom> LayoutDom<'dom, ShadowRoot>
impl<'dom> LayoutDom<'dom, ShadowRoot>
pub(crate) fn get_host_for_layout(self) -> LayoutDom<'dom, Element>
pub(crate) fn get_style_data_for_layout(self) -> &'dom CascadeData
pub(crate) fn is_user_agent_widget(&self) -> bool
pub(crate) unsafe fn flush_stylesheets_for_layout( self, stylist: &mut Stylist, guard: &SharedRwLockReadGuard<'_>, )
Source§impl<'dom> LayoutDom<'dom, SVGSVGElement>
impl<'dom> LayoutDom<'dom, SVGSVGElement>
pub(crate) fn data(self) -> SVGElementData<'dom>
Trait Implementations§
Source§impl<'dom> From<LayoutDom<'dom, ShadowRoot>> for ServoDangerousStyleShadowRoot<'dom>
impl<'dom> From<LayoutDom<'dom, ShadowRoot>> for ServoDangerousStyleShadowRoot<'dom>
Source§fn from(shadow_root: LayoutDom<'dom, ShadowRoot>) -> Self
fn from(shadow_root: LayoutDom<'dom, ShadowRoot>) -> Self
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