Struct script::layout_dom::element::ServoLayoutElement

source ·
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>

source

pub(super) fn from_layout_js(el: LayoutDom<'dom, Element>) -> Self

source

pub(super) fn is_html_element(&self) -> bool

source

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

source

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

source

fn get_style_data(&self) -> Option<&StyleData>

source

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.

source

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.

source

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.

source

fn parent_element(&self) -> Option<Self>

Returns the parent element of this element, if it has one.

source

fn is_root(&self) -> bool

Trait Implementations§

source§

impl<'dom> Clone for ServoLayoutElement<'dom>

source§

fn clone(&self) -> ServoLayoutElement<'dom>

Returns a copy 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<'dom> Debug for ServoLayoutElement<'dom>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'dom> Element for ServoLayoutElement<'dom>

§

type Impl = SelectorImpl

source§

fn opaque(&self) -> OpaqueElement

Converts self into an opaque representation.
source§

fn parent_element(&self) -> Option<Self>

source§

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>

The host of the containing shadow root, if any.
source§

fn prev_sibling_element(&self) -> Option<Self>

Skips non-element nodes
source§

fn next_sibling_element(&self) -> Option<ServoLayoutElement<'dom>>

Skips non-element nodes
source§

fn first_element_child(&self) -> Option<Self>

Skips non-element nodes
source§

fn attr_matches( &self, ns: &NamespaceConstraint<&Namespace>, local_name: &LocalName, operation: &AttrSelectorOperation<&AtomString>, ) -> bool

source§

fn is_root(&self) -> bool

Returns whether this element matches :root, i.e. whether it is the root element of a document. Read more
source§

fn is_empty(&self) -> bool

Returns whether this element matches :empty. Read more
source§

fn has_local_name(&self, name: &LocalName) -> bool

source§

fn has_namespace(&self, ns: &Namespace) -> bool

Empty string for no namespace
source§

fn is_same_type(&self, other: &Self) -> bool

Whether this element and the other element have the same local name and namespace.
source§

fn is_pseudo_element(&self) -> bool

Whether we’re matching on a pseudo-element.
source§

fn match_pseudo_element( &self, _pseudo: &PseudoElement, _context: &mut MatchingContext<'_, Self::Impl>, ) -> bool

source§

fn match_non_ts_pseudo_class( &self, pseudo_class: &NonTSPseudoClass, _: &mut MatchingContext<'_, Self::Impl>, ) -> bool

Whether this element is a link.
source§

fn has_id(&self, id: &AtomIdent, case_sensitivity: CaseSensitivity) -> bool

source§

fn is_part(&self, _name: &AtomIdent) -> bool

source§

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.
source§

fn has_class(&self, name: &AtomIdent, case_sensitivity: CaseSensitivity) -> bool

source§

fn is_html_slot_element(&self) -> bool

Returns whether the element is an HTML element.
source§

fn is_html_element_in_html_document(&self) -> bool

source§

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

Add hashes unique to this element to the given filter, returning true if any got added.
source§

fn has_custom_state(&self, _name: &AtomIdent) -> bool

source§

fn pseudo_element_originating_element(&self) -> Option<Self>

The parent of a given pseudo-element, after matching a pseudo-element selector. Read more
source§

fn has_attr_in_no_namespace( &self, local_name: &<Self::Impl as SelectorImpl>::LocalName, ) -> bool

source§

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

Returns whether this element should ignore matching nth child selector.
source§

impl<'dom> Hash for ServoLayoutElement<'dom>

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<'dom> PartialEq for ServoLayoutElement<'dom>

source§

fn eq(&self, other: &ServoLayoutElement<'dom>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'dom> TElement for ServoLayoutElement<'dom>

source§

fn has_data(&self) -> bool

Whether there is an ElementData container.

source§

fn borrow_data(&self) -> Option<AtomicRef<'_, ElementData>>

Immutably borrows the ElementData.

source§

fn mutate_data(&self) -> Option<AtomicRefMut<'_, ElementData>>

Mutably borrows the ElementData.

source§

fn shadow_root(&self) -> Option<ServoShadowRoot<'dom>>

The shadow root this element is a host of.

source§

fn containing_shadow(&self) -> Option<ServoShadowRoot<'dom>>

The shadow root which roots the subtree this element is contained in.

source§

fn unopaque(opaque: OpaqueElement) -> Self

Convert an opaque element back into the element.

§

type ConcreteNode = ServoLayoutNode<'dom>

The concrete node type.
§

type TraversalChildrenIterator = DomChildrenIncludingShadowDom<<ServoLayoutElement<'dom> as TElement>::ConcreteNode>

A concrete children iterator type in order to iterate over the Nodes. Read more
source§

fn as_node(&self) -> ServoLayoutNode<'dom>

Get this element as a node.
source§

fn traversal_children(&self) -> LayoutIterator<Self::TraversalChildrenIterator>

Get this node’s children from the perspective of a restyle traversal.
source§

fn is_html_element(&self) -> bool

Return whether this element is an element in the HTML namespace.
source§

fn is_mathml_element(&self) -> bool

Return whether this element is an element in the MathML namespace.
source§

fn is_svg_element(&self) -> bool

Return whether this element is an element in the SVG namespace.
source§

fn has_part_attr(&self) -> bool

Returns whether this element has a part attribute.
source§

fn exports_any_part(&self) -> bool

Returns whether this element exports any part from its shadow tree.
source§

fn style_attribute( &self, ) -> Option<ArcBorrow<'_, StyleLocked<PropertyDeclarationBlock>>>

Get this element’s style attribute.
source§

fn may_have_animations(&self) -> bool

In Gecko, element has a flag that represents the element may have any type of animations or not to bail out animation stuff early. Whereas Servo doesn’t have such flag.
source§

fn animation_rule( &self, context: &SharedStyleContext<'_>, ) -> Option<Arc<StyleLocked<PropertyDeclarationBlock>>>

Get this element’s animation rule.
source§

fn transition_rule( &self, context: &SharedStyleContext<'_>, ) -> Option<Arc<StyleLocked<PropertyDeclarationBlock>>>

Get this element’s transition rule.
source§

fn state(&self) -> ElementState

Get this element’s state, for non-tree-structural pseudos.
source§

fn id(&self) -> Option<&Atom>

The ID for this element.
source§

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

Internal iterator for the classes of this element.
source§

fn each_attr_name<F>(&self, callback: F)
where F: FnMut(&LocalName),

Internal iterator for the attribute names of this element.
source§

fn has_dirty_descendants(&self) -> bool

Returns true if this element may have a descendant needing style processing. Read more
source§

fn has_snapshot(&self) -> bool

Returns whether state or attributes that may change style have changed on the element, and thus whether the element has been snapshotted to do restyle hint computation.
source§

fn handled_snapshot(&self) -> bool

Returns whether the current snapshot if present has been handled.
source§

unsafe fn set_handled_snapshot(&self)

Flags this element as having handled already its snapshot.
source§

unsafe fn set_dirty_descendants(&self)

Flag that this element has a descendant for style processing. Read more
source§

unsafe fn unset_dirty_descendants(&self)

Flag that this element has no descendant for style processing. Read more
source§

fn store_children_to_process(&self, n: isize)

Atomically stores the number of children of this node that we will need to process during bottom-up traversal.
source§

fn did_process_child(&self) -> isize

Atomically notes that a child has been processed during bottom-up traversal. Returns the number of children left to process.
source§

unsafe fn clear_data(&self)

Clears the element data reference, if any. Read more
source§

unsafe fn ensure_data(&self) -> AtomicRefMut<'_, ElementData>

Gets a reference to the ElementData container, or creates one. Read more
source§

fn skip_item_display_fixup(&self) -> bool

Whether we should skip any root- or item-based display property blockification on this element. (This function exists so that Gecko native anonymous content can opt out of this style fixup.)
source§

fn has_animations(&self, context: &SharedStyleContext<'_>) -> bool

Returns true if the element has relevant animations. Relevant animations are those animations that are affecting the element’s style or are scheduled to do so in the future.
source§

fn has_css_animations( &self, context: &SharedStyleContext<'_>, pseudo_element: Option<PseudoElement>, ) -> bool

Returns true if the element has a CSS animation. The 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

Returns true if the element has a CSS transition (including running transitions and completed transitions). The 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>

Returns the value of the 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

Returns whether this element’s language matches the language tag 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

Returns whether this element is the main body element of the HTML document it is on.
source§

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

Generate the proper applicable declarations due to presentational hints, and insert them into hints.
source§

fn local_name(&self) -> &LocalName

Returns element’s local name.
source§

fn namespace(&self) -> &Namespace

Returns element’s namespace.
source§

fn query_container_size(&self, _display: &Display) -> Size2D<Option<Au>>

Returns the size of the element to be used in container size queries. This will usually be the size of the content area of the primary box, but can be None if there is no box or if some axis lacks size containment.
source§

fn has_selector_flags(&self, flags: ElementSelectorFlags) -> bool

Returns true if the element has all of specified selector flags.
source§

fn relative_selector_search_direction(&self) -> ElementSelectorFlags

Returns the search direction for relative selector invalidation, if it is on the search path.
source§

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

Internal iterator for the classes of this element.
source§

fn owner_doc_matches_for_testing(&self, _: &Device) -> bool

A debug-only check that the device’s owner doc matches the actual doc we’re the root of. Read more
source§

fn matches_user_and_content_rules(&self) -> bool

Whether this element should match user and content rules. Read more
source§

fn traversal_parent(&self) -> Option<Self>

Get this node’s parent element from the perspective of a restyle traversal.
source§

fn inheritance_parent(&self) -> Option<Self>

Returns the parent element we should inherit from. Read more
source§

fn before_pseudo_element(&self) -> Option<Self>

The ::before pseudo-element of this element, if it exists.
source§

fn after_pseudo_element(&self) -> Option<Self>

The ::after pseudo-element of this element, if it exists.
source§

fn marker_pseudo_element(&self) -> Option<Self>

The ::marker pseudo-element of this element, if it exists.
source§

fn each_anonymous_content_child<F>(&self, _f: F)
where F: FnMut(Self),

Execute f for each anonymous content child (apart from ::before and ::after) whose originating element is self.
source§

fn is_xul_element(&self) -> bool

Return whether this element is an element in the XUL namespace.
source§

fn slotted_nodes(&self) -> &[Self::ConcreteNode]

Return the list of slotted nodes of this node.
source§

fn unset_dirty_style_attribute(&self)

Unset the style attribute’s dirty bit. Servo doesn’t need to manage ditry bit for style attribute.
source§

fn smil_override( &self, ) -> Option<ArcBorrow<'_, Locked<PropertyDeclarationBlock>>>

Get this element’s SMIL override declarations.
source§

fn animation_declarations( &self, context: &SharedStyleContext<'_>, ) -> AnimationDeclarations

Get the combined animation and transition rules. Read more
source§

fn each_part<F>(&self, _callback: F)

Internal iterator for the part names of this element.
source§

fn each_exported_part<F>( &self, _name: &GenericAtomIdent<AtomStaticSet>, _callback: F, )

Internal iterator for the part names that this element exports for a given part name.
source§

fn may_generate_pseudo( &self, pseudo: &PseudoElement, _primary_style: &ComputedValues, ) -> bool

Whether a given element may generate a pseudo-element. Read more
source§

fn has_current_styles(&self, data: &ElementData) -> bool

Returns whether the element’s styles are up-to-date after traversal (i.e. in post traversal).
source§

fn has_animation_only_dirty_descendants(&self) -> bool

Similar to the dirty_descendants but for representing a descendant of the element needs to be updated in animation-only traversal.
source§

unsafe fn set_animation_only_dirty_descendants(&self)

Flag that this element has a descendant for animation-only restyle processing. Read more
source§

unsafe fn unset_animation_only_dirty_descendants(&self)

Flag that this element has no descendant for animation-only restyle processing. Read more
source§

unsafe fn clear_descendant_bits(&self)

Clear all bits related describing the dirtiness of descendants. Read more
Returns true if this element is a visited link. Read more
source§

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

Returns the pseudo-element implemented by this element, if any. Read more
source§

fn has_animation_restyle_hints(&self) -> bool

Returns true if the element has animation restyle hints.
source§

fn rule_hash_target(&self) -> Self

Return the element which we can use to look up rules in the selector maps. Read more
source§

fn each_applicable_non_document_style_rule_data<'a, F>(&self, f: F) -> bool
where Self: 'a, F: FnMut(&'a CascadeData, Self),

Executes the callback for each applicable style rule data which isn’t the main document’s data (which stores UA / author rules). Read more
source§

impl<'dom> Copy for ServoLayoutElement<'dom>

source§

impl<'dom> Eq for ServoLayoutElement<'dom>

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
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> 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<E> MatchMethods for E
where E: TElement,

source§

fn layout_parent(&self) -> Self

Returns the closest parent element that doesn’t have a display: contents style (and thus generates a box). Read more
source§

fn finish_restyle( &self, context: &mut StyleContext<'_, Self>, data: &mut ElementData, new_styles: ResolvedElementStyles, important_rules_changed: bool, ) -> ChildRestyleRequirement

Updates the styles with the new ones, diffs them, and stores the restyle damage.
source§

fn replace_rules( &self, replacements: RestyleHint, context: &mut StyleContext<'_, Self>, cascade_inputs: &mut ElementCascadeInputs, ) -> bool

Updates the rule nodes without re-running selector matching, using just the rule tree. Read more
source§

fn compute_style_difference( &self, old_values: &ComputedValues, new_values: &ComputedValues, pseudo: Option<&PseudoElement>, ) -> StyleDifference

Given the old and new style of this element, and whether it’s a pseudo-element, compute the restyle damage used to determine which kind of layout or painting operations we’ll need.
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.
§

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

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

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

§

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

§

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