Struct script::layout_dom::ServoThreadSafeLayoutElement
source · pub struct ServoThreadSafeLayoutElement<'dom> {
pub(super) element: ServoLayoutElement<'dom>,
pub(super) pseudo: PseudoElementType,
}
Expand description
A wrapper around elements that ensures layout can only ever access safe properties and cannot race on elements.
Fields§
§element: ServoLayoutElement<'dom>
§pseudo: PseudoElementType
The pseudo-element type, with (optionally) a specified display value to override the stylesheet.
Trait Implementations§
source§impl<'dom> Clone for ServoThreadSafeLayoutElement<'dom>
impl<'dom> Clone for ServoThreadSafeLayoutElement<'dom>
source§fn clone(&self) -> ServoThreadSafeLayoutElement<'dom>
fn clone(&self) -> ServoThreadSafeLayoutElement<'dom>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'dom> Debug for ServoThreadSafeLayoutElement<'dom>
impl<'dom> Debug for ServoThreadSafeLayoutElement<'dom>
source§impl<'dom> Element for ServoThreadSafeLayoutElement<'dom>
impl<'dom> Element for ServoThreadSafeLayoutElement<'dom>
This implementation of ::selectors::Element
is used for implementing lazy
pseudo-elements.
Lazy pseudo-elements in Servo only allows selectors using safe properties,
i.e., local_name, attributes, so they can only be used for private
pseudo-elements (like ::-servo-details-content
).
Probably a few more of this functions can be implemented (like has_class
, etc.),
but they have no use right now.
Note that the element implementation is needed only for selector matching, not for inheritance (styles are inherited appropriately).
type Impl = SelectorImpl
source§fn opaque(&self) -> OpaqueElement
fn opaque(&self) -> OpaqueElement
Converts self into an opaque representation.
source§fn is_pseudo_element(&self) -> bool
fn is_pseudo_element(&self) -> bool
Whether we’re matching on a pseudo-element.
fn parent_element(&self) -> Option<Self>
source§fn parent_node_is_shadow_root(&self) -> bool
fn parent_node_is_shadow_root(&self) -> bool
Whether the parent node of this element is a shadow root.
source§fn containing_shadow_host(&self) -> Option<Self>
fn containing_shadow_host(&self) -> Option<Self>
The host of the containing shadow root, if any.
source§fn prev_sibling_element(&self) -> Option<Self>
fn prev_sibling_element(&self) -> Option<Self>
Skips non-element nodes
source§fn next_sibling_element(&self) -> Option<Self>
fn next_sibling_element(&self) -> Option<Self>
Skips non-element nodes
source§fn first_element_child(&self) -> Option<Self>
fn first_element_child(&self) -> Option<Self>
Skips non-element nodes
source§fn is_html_slot_element(&self) -> bool
fn is_html_slot_element(&self) -> bool
Returns whether the element is an HTML element.
fn is_html_element_in_html_document(&self) -> bool
fn has_local_name(&self, name: &LocalName) -> bool
source§fn has_namespace(&self, ns: &Namespace) -> bool
fn has_namespace(&self, ns: &Namespace) -> bool
Empty string for no namespace
source§fn is_same_type(&self, other: &Self) -> bool
fn is_same_type(&self, other: &Self) -> bool
Whether this element and the
other
element have the same local name and namespace.fn match_pseudo_element( &self, _pseudo: &PseudoElement, _context: &mut MatchingContext<'_, Self::Impl>, ) -> bool
fn attr_matches( &self, ns: &NamespaceConstraint<&Namespace>, local_name: &LocalName, operation: &AttrSelectorOperation<&AtomString>, ) -> bool
fn match_non_ts_pseudo_class( &self, _: &NonTSPseudoClass, _: &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, _: &AtomIdent) -> Option<AtomIdent>
fn imported_part(&self, _: &AtomIdent) -> Option<AtomIdent>
Returns the mapping from the
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_root(&self) -> bool
fn is_root(&self) -> bool
Returns whether this element matches
:root
,
i.e. whether it is the root element of a document. Read moresource§fn apply_selector_flags(&self, flags: ElementSelectorFlags)
fn apply_selector_flags(&self, flags: ElementSelectorFlags)
Sets selector flags on the elemnt itself or the parent, depending on the
flags, which indicate what kind of work may need to be performed when
DOM state changes.
source§fn add_element_unique_hashes(&self, filter: &mut BloomFilter) -> bool
fn add_element_unique_hashes(&self, filter: &mut BloomFilter) -> bool
Add hashes unique to this element to the given filter, returning true
if any got added.
fn has_custom_state(&self, _name: &AtomIdent) -> bool
source§fn pseudo_element_originating_element(&self) -> Option<Self>
fn pseudo_element_originating_element(&self) -> Option<Self>
The parent of a given pseudo-element, after matching a pseudo-element
selector. Read more
fn has_attr_in_no_namespace( &self, local_name: &<Self::Impl as SelectorImpl>::LocalName, ) -> bool
source§fn assigned_slot(&self) -> Option<Self>
fn assigned_slot(&self) -> Option<Self>
Returns the assigned element this element is assigned to. Read more
source§fn ignores_nth_child_selectors(&self) -> bool
fn ignores_nth_child_selectors(&self) -> bool
Returns whether this element should ignore matching nth child
selector.
source§impl<'dom> ThreadSafeLayoutElement<'dom> for ServoThreadSafeLayoutElement<'dom>
impl<'dom> ThreadSafeLayoutElement<'dom> for ServoThreadSafeLayoutElement<'dom>
type ConcreteThreadSafeLayoutNode = ServoThreadSafeLayoutNode<'dom>
§type ConcreteElement = ServoLayoutElement<'dom>
type ConcreteElement = ServoLayoutElement<'dom>
This type alias is just a work-around to avoid writing Read more
fn as_node(&self) -> ServoThreadSafeLayoutNode<'dom>
fn get_pseudo_element_type(&self) -> PseudoElementType
source§fn with_pseudo(&self, pseudo: PseudoElementType) -> Self
fn with_pseudo(&self, pseudo: PseudoElementType) -> Self
Creates a new
ThreadSafeLayoutElement
for the same LayoutElement
with a different pseudo-element type.source§fn type_id(&self) -> Option<LayoutNodeType>
fn type_id(&self) -> Option<LayoutNodeType>
Returns the type ID of this node.
Returns
None
if this is a pseudo-element; otherwise, returns Some
.source§fn unsafe_get(self) -> ServoLayoutElement<'dom>
fn unsafe_get(self) -> ServoLayoutElement<'dom>
Returns access to the underlying TElement. This is breaks the abstraction
barrier of ThreadSafeLayout wrapper layer, and can lead to races if not used
carefully. Read more
source§fn get_local_name(&self) -> &LocalName
fn get_local_name(&self) -> &LocalName
Get the local name of this element. See
https://dom.spec.whatwg.org/#concept-element-local-name.
fn get_attr_enum( &self, namespace: &Namespace, name: &LocalName, ) -> Option<&AttrValue>
fn get_attr<'a>( &'a self, namespace: &Namespace, name: &LocalName, ) -> Option<&'a str>
fn style_data(&self) -> AtomicRef<'_, ElementData>
fn is_shadow_host(&self) -> bool
source§fn is_body_element_of_html_element_root(&self) -> bool
fn is_body_element_of_html_element_root(&self) -> bool
Returns whether this node is a body element of an html element root
in an HTML element document. Read more
fn get_before_pseudo(&self) -> Option<Self>
fn get_after_pseudo(&self) -> Option<Self>
fn get_details_summary_pseudo(&self) -> Option<Self>
fn get_details_content_pseudo(&self) -> Option<Self>
source§fn style(&self, context: &SharedStyleContext<'_>) -> Arc<ComputedValues>
fn style(&self, context: &SharedStyleContext<'_>) -> Arc<ComputedValues>
Returns the style results for the given node. If CSS selector matching
has not yet been performed, fails. Read more
fn selected_style(&self) -> Arc<ComputedValues>
source§fn resolved_style(&self) -> Arc<ComputedValues>
fn resolved_style(&self) -> Arc<ComputedValues>
Returns the already resolved style of the node. Read more
impl<'dom> Copy for ServoThreadSafeLayoutElement<'dom>
Auto Trait Implementations§
impl<'dom> Freeze for ServoThreadSafeLayoutElement<'dom>
impl<'dom> !RefUnwindSafe for ServoThreadSafeLayoutElement<'dom>
impl<'dom> !Send for ServoThreadSafeLayoutElement<'dom>
impl<'dom> !Sync for ServoThreadSafeLayoutElement<'dom>
impl<'dom> Unpin for ServoThreadSafeLayoutElement<'dom>
impl<'dom> !UnwindSafe for ServoThreadSafeLayoutElement<'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
Mutably borrows from an owned value. Read more
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>
Creates a filterable data provider with the given name for debugging. Read more
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>
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 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>
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 moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert