pub struct ServoLayoutElement<'dom> {
element: LayoutDom<'dom, Element>,
}
Expand description
A wrapper around elements that ensures layout can only ever access safe properties.
Fields§
§element: LayoutDom<'dom, Element>
The wrapped private DOM Element.
Implementations§
Source§impl<'dom> ServoLayoutElement<'dom>
impl<'dom> ServoLayoutElement<'dom>
pub(super) fn from_layout_js(el: LayoutDom<'dom, Element>) -> Self
pub(super) fn is_html_element(&self) -> bool
fn get_attr_enum( &self, namespace: &Namespace, name: &LocalName, ) -> Option<&AttrValue>
fn get_attr(&self, namespace: &Namespace, name: &LocalName) -> Option<&str>
fn get_style_data(&self) -> Option<&StyleData>
Sourcepub unsafe fn unset_snapshot_flags(&self)
pub unsafe fn unset_snapshot_flags(&self)
Unset the snapshot flags on the underlying DOM object for this element.
§Safety
This function accesses and modifies the underlying DOM object and should not be used by more than a single thread at once.
Sourcepub unsafe fn set_has_snapshot(&self)
pub unsafe fn set_has_snapshot(&self)
Unset the snapshot flags on the underlying DOM object for this element.
§Safety
This function accesses and modifies the underlying DOM object and should not be used by more than a single thread at once.
Sourcefn is_body_element_of_html_element_root(&self) -> bool
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.
Sourcefn parent_element(&self) -> Option<Self>
fn parent_element(&self) -> Option<Self>
Returns the parent element of this element, if it has one.
fn is_root(&self) -> bool
Trait Implementations§
Source§impl<'dom> Clone for ServoLayoutElement<'dom>
impl<'dom> Clone for ServoLayoutElement<'dom>
Source§fn clone(&self) -> ServoLayoutElement<'dom>
fn clone(&self) -> ServoLayoutElement<'dom>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ServoLayoutElement<'_>
impl Debug for ServoLayoutElement<'_>
Source§impl<'dom> Element for ServoLayoutElement<'dom>
impl<'dom> Element for ServoLayoutElement<'dom>
type Impl = SelectorImpl
Source§fn opaque(&self) -> OpaqueElement
fn opaque(&self) -> OpaqueElement
fn parent_element(&self) -> Option<Self>
Source§fn parent_node_is_shadow_root(&self) -> bool
fn parent_node_is_shadow_root(&self) -> bool
Source§fn containing_shadow_host(&self) -> Option<Self>
fn containing_shadow_host(&self) -> Option<Self>
Source§fn is_pseudo_element(&self) -> bool
fn is_pseudo_element(&self) -> bool
Source§fn pseudo_element_originating_element(&self) -> Option<Self>
fn pseudo_element_originating_element(&self) -> Option<Self>
Source§fn prev_sibling_element(&self) -> Option<Self>
fn prev_sibling_element(&self) -> Option<Self>
Source§fn next_sibling_element(&self) -> Option<ServoLayoutElement<'dom>>
fn next_sibling_element(&self) -> Option<ServoLayoutElement<'dom>>
Source§fn first_element_child(&self) -> Option<Self>
fn first_element_child(&self) -> Option<Self>
fn attr_matches( &self, ns: &NamespaceConstraint<&Namespace>, local_name: &LocalName, operation: &AttrSelectorOperation<&AtomString>, ) -> bool
Source§fn is_root(&self) -> bool
fn is_root(&self) -> bool
:root
,
i.e. whether it is the root element of a document. Read morefn has_local_name(&self, name: &LocalName) -> bool
Source§fn has_namespace(&self, ns: &Namespace) -> bool
fn has_namespace(&self, ns: &Namespace) -> bool
Source§fn is_same_type(&self, other: &Self) -> bool
fn is_same_type(&self, other: &Self) -> bool
other
element have the same local name and namespace.fn match_non_ts_pseudo_class( &self, pseudo_class: &NonTSPseudoClass, _: &mut MatchingContext<'_, Self::Impl>, ) -> bool
fn match_pseudo_element( &self, pseudo: &PseudoElement, _context: &mut MatchingContext<'_, Self::Impl>, ) -> bool
fn has_id(&self, id: &AtomIdent, case_sensitivity: CaseSensitivity) -> bool
fn is_part(&self, name: &AtomIdent) -> bool
Source§fn imported_part(&self, name: &AtomIdent) -> Option<AtomIdent>
fn imported_part(&self, name: &AtomIdent) -> Option<AtomIdent>
exportparts
attribute in the reverse
direction, that is, in an outer-tree -> inner-tree direction.fn has_class(&self, name: &AtomIdent, case_sensitivity: CaseSensitivity) -> bool
Source§fn is_html_slot_element(&self) -> bool
fn is_html_slot_element(&self) -> bool
Source§fn assigned_slot(&self) -> Option<Self>
fn assigned_slot(&self) -> Option<Self>
fn is_html_element_in_html_document(&self) -> bool
Source§fn apply_selector_flags(&self, flags: ElementSelectorFlags)
fn apply_selector_flags(&self, flags: ElementSelectorFlags)
Source§fn add_element_unique_hashes(&self, filter: &mut BloomFilter) -> bool
fn add_element_unique_hashes(&self, filter: &mut BloomFilter) -> bool
fn has_custom_state(&self, name: &AtomIdent) -> bool
fn has_attr_in_no_namespace( &self, local_name: &<Self::Impl as SelectorImpl>::LocalName, ) -> bool
Source§fn ignores_nth_child_selectors(&self) -> bool
fn ignores_nth_child_selectors(&self) -> bool
Source§impl<'dom> Hash for ServoLayoutElement<'dom>
impl<'dom> Hash for ServoLayoutElement<'dom>
Source§impl<'dom> PartialEq for ServoLayoutElement<'dom>
impl<'dom> PartialEq for ServoLayoutElement<'dom>
Source§impl<'dom> TElement for ServoLayoutElement<'dom>
impl<'dom> TElement for ServoLayoutElement<'dom>
Source§fn matches_user_and_content_rules(&self) -> bool
fn matches_user_and_content_rules(&self) -> bool
Whether this element should match user and content rules. We would like to match rules from the same tree in all cases and optimize computation. UA Widget is an exception since we could have a pseudo element selector inside it.
Source§fn implemented_pseudo_element(&self) -> Option<PseudoElement>
fn implemented_pseudo_element(&self) -> Option<PseudoElement>
Returns the pseudo-element implemented by this element, if any. In other words, the element will match the specified pseudo element throughout the style computation.
Source§fn borrow_data(&self) -> Option<AtomicRef<'_, ElementData>>
fn borrow_data(&self) -> Option<AtomicRef<'_, ElementData>>
Immutably borrows the ElementData.
Source§fn mutate_data(&self) -> Option<AtomicRefMut<'_, ElementData>>
fn mutate_data(&self) -> Option<AtomicRefMut<'_, ElementData>>
Mutably borrows the ElementData.
Source§fn shadow_root(&self) -> Option<ServoShadowRoot<'dom>>
fn shadow_root(&self) -> Option<ServoShadowRoot<'dom>>
The shadow root this element is a host of.
Source§fn containing_shadow(&self) -> Option<ServoShadowRoot<'dom>>
fn containing_shadow(&self) -> Option<ServoShadowRoot<'dom>>
The shadow root which roots the subtree this element is contained in.
Source§fn implicit_scope_for_sheet_in_shadow_root(
opaque_host: OpaqueElement,
sheet_index: usize,
) -> Option<ImplicitScopeRoot>
fn implicit_scope_for_sheet_in_shadow_root( opaque_host: OpaqueElement, sheet_index: usize, ) -> Option<ImplicitScopeRoot>
Returns the implicit scope root for given sheet index and host.
Source§type ConcreteNode = ServoLayoutNode<'dom>
type ConcreteNode = ServoLayoutNode<'dom>
Source§type TraversalChildrenIterator = DOMDescendantIterator<ServoLayoutElement<'dom>>
type TraversalChildrenIterator = DOMDescendantIterator<ServoLayoutElement<'dom>>
Node
s. Read moreSource§fn as_node(&self) -> ServoLayoutNode<'dom>
fn as_node(&self) -> ServoLayoutNode<'dom>
Source§fn traversal_children(&self) -> LayoutIterator<Self::TraversalChildrenIterator>
fn traversal_children(&self) -> LayoutIterator<Self::TraversalChildrenIterator>
Source§fn traversal_parent(&self) -> Option<Self>
fn traversal_parent(&self) -> Option<Self>
Source§fn inheritance_parent(&self) -> Option<Self>
fn inheritance_parent(&self) -> Option<Self>
Source§fn is_html_element(&self) -> bool
fn is_html_element(&self) -> bool
Source§fn is_mathml_element(&self) -> bool
fn is_mathml_element(&self) -> bool
Source§fn is_svg_element(&self) -> bool
fn is_svg_element(&self) -> bool
Source§fn has_part_attr(&self) -> bool
fn has_part_attr(&self) -> bool
part
attribute.Source§fn exports_any_part(&self) -> bool
fn exports_any_part(&self) -> bool
Source§fn style_attribute(
&self,
) -> Option<ArcBorrow<'_, StyleLocked<PropertyDeclarationBlock>>>
fn style_attribute( &self, ) -> Option<ArcBorrow<'_, StyleLocked<PropertyDeclarationBlock>>>
Source§fn may_have_animations(&self) -> bool
fn may_have_animations(&self) -> bool
Source§fn animation_rule(
&self,
context: &SharedStyleContext<'_>,
) -> Option<Arc<StyleLocked<PropertyDeclarationBlock>>>
fn animation_rule( &self, context: &SharedStyleContext<'_>, ) -> Option<Arc<StyleLocked<PropertyDeclarationBlock>>>
Source§fn transition_rule(
&self,
context: &SharedStyleContext<'_>,
) -> Option<Arc<StyleLocked<PropertyDeclarationBlock>>>
fn transition_rule( &self, context: &SharedStyleContext<'_>, ) -> Option<Arc<StyleLocked<PropertyDeclarationBlock>>>
Source§fn state(&self) -> ElementState
fn state(&self) -> ElementState
Source§fn each_class<F>(&self, callback: F)
fn each_class<F>(&self, callback: F)
Source§fn each_attr_name<F>(&self, callback: F)
fn each_attr_name<F>(&self, callback: F)
Source§fn each_exported_part<F>(&self, name: &AtomIdent, callback: F)
fn each_exported_part<F>(&self, name: &AtomIdent, callback: F)
Source§fn has_dirty_descendants(&self) -> bool
fn has_dirty_descendants(&self) -> bool
Source§fn has_snapshot(&self) -> bool
fn has_snapshot(&self) -> bool
Source§fn handled_snapshot(&self) -> bool
fn handled_snapshot(&self) -> bool
Source§unsafe fn set_handled_snapshot(&self)
unsafe fn set_handled_snapshot(&self)
Source§unsafe fn set_dirty_descendants(&self)
unsafe fn set_dirty_descendants(&self)
Source§unsafe fn unset_dirty_descendants(&self)
unsafe fn unset_dirty_descendants(&self)
Source§fn store_children_to_process(&self, n: isize)
fn store_children_to_process(&self, n: isize)
Source§fn did_process_child(&self) -> isize
fn did_process_child(&self) -> isize
Source§unsafe fn clear_data(&self)
unsafe fn clear_data(&self)
Source§unsafe fn ensure_data(&self) -> AtomicRefMut<'_, ElementData>
unsafe fn ensure_data(&self) -> AtomicRefMut<'_, ElementData>
Source§fn skip_item_display_fixup(&self) -> bool
fn skip_item_display_fixup(&self) -> bool
Source§fn has_animations(&self, context: &SharedStyleContext<'_>) -> bool
fn has_animations(&self, context: &SharedStyleContext<'_>) -> bool
Source§fn has_css_animations(
&self,
context: &SharedStyleContext<'_>,
pseudo_element: Option<PseudoElement>,
) -> bool
fn has_css_animations( &self, context: &SharedStyleContext<'_>, pseudo_element: Option<PseudoElement>, ) -> bool
context
and pseudo_element
arguments are only used by Servo, since it stores animations globally and pseudo-elements
are not in the DOM.Source§fn has_css_transitions(
&self,
context: &SharedStyleContext<'_>,
pseudo_element: Option<PseudoElement>,
) -> bool
fn has_css_transitions( &self, context: &SharedStyleContext<'_>, pseudo_element: Option<PseudoElement>, ) -> bool
context
and pseudo_element
arguments are only used
by Servo, since it stores animations globally and pseudo-elements are not in the DOM.Source§fn lang_attr(&self) -> Option<SelectorAttrValue>
fn lang_attr(&self) -> Option<SelectorAttrValue>
xml:lang=""
attribute (or, if appropriate,
the lang=""
attribute) on this element.Source§fn match_element_lang(
&self,
override_lang: Option<Option<SelectorAttrValue>>,
value: &Lang,
) -> bool
fn match_element_lang( &self, override_lang: Option<Option<SelectorAttrValue>>, value: &Lang, ) -> bool
value
. If override_lang
is not None
, it specifies the value
of the xml:lang=""
or lang=""
attribute to use in place of
looking at the element and its ancestors. (This argument is used
to implement matching of :lang()
against snapshots.)Source§fn is_html_document_body_element(&self) -> bool
fn is_html_document_body_element(&self) -> bool
Source§fn synthesize_presentational_hints_for_legacy_attributes<V>(
&self,
_visited_handling: VisitedHandlingMode,
hints: &mut V,
)where
V: Push<ApplicableDeclarationBlock>,
fn synthesize_presentational_hints_for_legacy_attributes<V>(
&self,
_visited_handling: VisitedHandlingMode,
hints: &mut V,
)where
V: Push<ApplicableDeclarationBlock>,
hints
.Source§fn local_name(&self) -> &LocalName
fn local_name(&self) -> &LocalName
Source§fn query_container_size(&self, _display: &Display) -> Size2D<Option<Au>>
fn query_container_size(&self, _display: &Display) -> Size2D<Option<Au>>
Source§fn has_selector_flags(&self, flags: ElementSelectorFlags) -> bool
fn has_selector_flags(&self, flags: ElementSelectorFlags) -> bool
Source§fn relative_selector_search_direction(&self) -> ElementSelectorFlags
fn relative_selector_search_direction(&self) -> ElementSelectorFlags
Source§fn each_custom_state<F>(&self, callback: F)
fn each_custom_state<F>(&self, callback: F)
Source§fn slotted_nodes(&self) -> &[Self::ConcreteNode]
fn slotted_nodes(&self) -> &[Self::ConcreteNode]
Source§fn compute_layout_damage(
old: &ComputedValues,
new: &ComputedValues,
) -> RestyleDamage
fn compute_layout_damage( old: &ComputedValues, new: &ComputedValues, ) -> RestyleDamage
_old
to _new
.Source§fn owner_doc_matches_for_testing(&self, _: &Device) -> bool
fn owner_doc_matches_for_testing(&self, _: &Device) -> bool
Source§fn each_anonymous_content_child<F>(&self, _f: F)where
F: FnMut(Self),
fn each_anonymous_content_child<F>(&self, _f: F)where
F: FnMut(Self),
f
for each anonymous content child (apart from ::before and
::after) whose originating element is self
.Source§fn is_xul_element(&self) -> bool
fn is_xul_element(&self) -> bool
Source§fn unset_dirty_style_attribute(&self)
fn unset_dirty_style_attribute(&self)
Source§fn smil_override(
&self,
) -> Option<ArcBorrow<'_, Locked<PropertyDeclarationBlock>>>
fn smil_override( &self, ) -> Option<ArcBorrow<'_, Locked<PropertyDeclarationBlock>>>
Source§fn animation_declarations(
&self,
context: &SharedStyleContext<'_>,
) -> AnimationDeclarations
fn animation_declarations( &self, context: &SharedStyleContext<'_>, ) -> AnimationDeclarations
Source§fn may_generate_pseudo(
&self,
pseudo: &PseudoElement,
_primary_style: &ComputedValues,
) -> bool
fn may_generate_pseudo( &self, pseudo: &PseudoElement, _primary_style: &ComputedValues, ) -> bool
Source§fn has_current_styles(&self, data: &ElementData) -> bool
fn has_current_styles(&self, data: &ElementData) -> bool
Source§fn has_animation_only_dirty_descendants(&self) -> bool
fn has_animation_only_dirty_descendants(&self) -> bool
Source§unsafe fn set_animation_only_dirty_descendants(&self)
unsafe fn set_animation_only_dirty_descendants(&self)
Source§unsafe fn unset_animation_only_dirty_descendants(&self)
unsafe fn unset_animation_only_dirty_descendants(&self)
Source§unsafe fn clear_descendant_bits(&self)
unsafe fn clear_descendant_bits(&self)
Source§fn is_visited_link(&self) -> bool
fn is_visited_link(&self) -> bool
Source§fn has_animation_restyle_hints(&self) -> bool
fn has_animation_restyle_hints(&self) -> bool
Source§fn rule_hash_target(&self) -> Self
fn rule_hash_target(&self) -> Self
Source§fn each_applicable_non_document_style_rule_data<'a, F>(&self, f: F) -> boolwhere
Self: 'a,
F: FnMut(&'a CascadeData, Self),
fn each_applicable_non_document_style_rule_data<'a, F>(&self, f: F) -> boolwhere
Self: 'a,
F: FnMut(&'a CascadeData, Self),
Source§fn synthesize_view_transition_dynamic_rules<V>(&self, _rules: &mut V)where
V: Push<ApplicableDeclarationBlock>,
fn synthesize_view_transition_dynamic_rules<V>(&self, _rules: &mut V)where
V: Push<ApplicableDeclarationBlock>,
rules
.
https://drafts.csswg.org/css-view-transitions-1/#document-dynamic-view-transition-style-sheetimpl<'dom> Copy for ServoLayoutElement<'dom>
impl<'dom> Eq for ServoLayoutElement<'dom>
impl<'dom> StructuralPartialEq for ServoLayoutElement<'dom>
Auto Trait Implementations§
impl<'dom> Freeze for ServoLayoutElement<'dom>
impl<'dom> !RefUnwindSafe for ServoLayoutElement<'dom>
impl<'dom> !Send for ServoLayoutElement<'dom>
impl<'dom> !Sync for ServoLayoutElement<'dom>
impl<'dom> Unpin for ServoLayoutElement<'dom>
impl<'dom> !UnwindSafe for ServoLayoutElement<'dom>
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