Trait style::dom::TElement [] [src]

pub trait TElement: Eq + PartialEq + Debug + Hash + Sized + Copy + Clone + SelectorsElement<Impl = SelectorImpl> {
    type ConcreteNode: TNode<ConcreteElement = Self>;
    type TraversalChildrenIterator: Iterator<Item = Self::ConcreteNode>;
    type FontMetricsProvider: FontMetricsProvider + Send;
    fn as_node(&self) -> Self::ConcreteNode;
fn traversal_children(
        &self
    ) -> LayoutIterator<Self::TraversalChildrenIterator>;
fn style_attribute(
        &self
    ) -> Option<ArcBorrow<Locked<PropertyDeclarationBlock>>>;
fn get_state(&self) -> ElementState;
fn has_attr(&self, namespace: &Namespace, attr: &LocalName) -> bool;
fn get_id(&self) -> Option<Atom>;
fn each_class<F>(&self, callback: F)
    where
        F: FnMut(&Atom)
;
fn has_dirty_descendants(&self) -> bool;
fn has_snapshot(&self) -> bool;
fn handled_snapshot(&self) -> bool;
unsafe fn set_handled_snapshot(&self);
unsafe fn set_dirty_descendants(&self);
unsafe fn unset_dirty_descendants(&self);
fn store_children_to_process(&self, n: isize);
fn did_process_child(&self) -> isize;
unsafe fn ensure_data(&self) -> AtomicRefMut<ElementData>;
unsafe fn clear_data(&self);
fn get_data(&self) -> Option<&AtomicRefCell<ElementData>>;
fn skip_root_and_item_based_display_fixup(&self) -> bool;
unsafe fn set_selector_flags(&self, flags: ElementSelectorFlags);
fn has_selector_flags(&self, flags: ElementSelectorFlags) -> bool;
fn has_animations(&self) -> bool;
fn has_css_animations(&self) -> bool;
fn has_css_transitions(&self) -> bool;
fn lang_attr(&self) -> Option<AttrValue>;
fn match_element_lang(
        &self,
        override_lang: Option<Option<AttrValue>>,
        value: &PseudoClassStringArg
    ) -> bool;
fn is_html_document_body_element(&self) -> bool;
fn synthesize_presentational_hints_for_legacy_attributes<V>(
        &self,
        visited_handling: VisitedHandlingMode,
        hints: &mut V
    )
    where
        V: Push<ApplicableDeclarationBlock>
; fn owner_doc_matches_for_testing(&self, _: &Device) -> bool { ... }
fn matches_user_and_author_rules(&self) -> bool { ... }
fn depth(&self) -> usize { ... }
fn style_scope(&self) -> Self::ConcreteNode { ... }
fn traversal_parent(&self) -> Option<Self> { ... }
fn inheritance_parent(&self) -> Option<Self> { ... }
fn before_pseudo_element(&self) -> Option<Self> { ... }
fn after_pseudo_element(&self) -> Option<Self> { ... }
fn each_anonymous_content_child<F>(&self, _f: F)
    where
        F: FnMut(Self)
, { ... }
fn closest_non_native_anonymous_ancestor(&self) -> Option<Self> { ... }
fn unset_dirty_style_attribute(&self) { ... }
fn get_smil_override(
        &self
    ) -> Option<ArcBorrow<Locked<PropertyDeclarationBlock>>> { ... }
fn get_animation_rule_by_cascade(
        &self,
        _cascade_level: CascadeLevel
    ) -> Option<Arc<Locked<PropertyDeclarationBlock>>> { ... }
fn get_animation_rules(&self) -> AnimationRules { ... }
fn get_animation_rule(
        &self
    ) -> Option<Arc<Locked<PropertyDeclarationBlock>>> { ... }
fn get_transition_rule(
        &self
    ) -> Option<Arc<Locked<PropertyDeclarationBlock>>> { ... }
fn may_generate_pseudo(
        &self,
        pseudo: &PseudoElement,
        _primary_style: &ComputedValues
    ) -> bool { ... }
fn has_current_styles_for_traversal(
        &self,
        data: &ElementData,
        traversal_flags: TraversalFlags
    ) -> bool { ... }
fn has_current_styles(&self, data: &ElementData) -> bool { ... }
fn has_animation_only_dirty_descendants(&self) -> bool { ... }
unsafe fn set_animation_only_dirty_descendants(&self) { ... }
unsafe fn unset_animation_only_dirty_descendants(&self) { ... }
unsafe fn clear_descendant_bits(&self) { ... }
unsafe fn clear_dirty_bits(&self) { ... }
fn is_visited_link(&self) -> bool { ... }
fn is_native_anonymous(&self) -> bool { ... }
fn implemented_pseudo_element(&self) -> Option<PseudoElement> { ... }
fn borrow_data(&self) -> Option<AtomicRef<ElementData>> { ... }
fn mutate_data(&self) -> Option<AtomicRefMut<ElementData>> { ... }
fn may_have_animations(&self) -> bool { ... }
fn has_animation_restyle_hints(&self) -> bool { ... }
fn xbl_binding_anonymous_content(&self) -> Option<Self::ConcreteNode> { ... }
fn rule_hash_target(&self) -> Self { ... }
fn each_xbl_stylist<'a, F>(&self, _: F) -> bool
    where
        Self: 'a,
        F: FnMut(AtomicRef<'a, Stylist>)
, { ... } }

The element trait, the main abstraction the style crate acts over.

Associated Types

The concrete node type.

A concrete children iterator type in order to iterate over the Nodes.

TODO(emilio): We should eventually replace this with the impl Trait syntax.

Type of the font metrics provider

XXXManishearth It would be better to make this a type parameter on ThreadLocalStyleContext and StyleContext

Required Methods

Get this element as a node.

Important traits for LayoutIterator<T>

Get this node's children from the perspective of a restyle traversal.

Get this element's style attribute.

Get this element's state, for non-tree-structural pseudos.

Whether this element has an attribute with a given namespace.

The ID for this element.

Internal iterator for the classes of this element.

Returns true if this element may have a descendant needing style processing.

Note that we cannot guarantee the existence of such an element, because it may have been removed from the DOM between marking it for restyle and the actual restyle traversal.

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.

Returns whether the current snapshot if present has been handled.

Flags this element as having handled already its snapshot.

Flag that this element has a descendant for style processing.

Only safe to call with exclusive access to the element.

Flag that this element has no descendant for style processing.

Only safe to call with exclusive access to the element.

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

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

Gets a reference to the ElementData container, or creates one.

Unsafe because it can race to allocate and leak if not used with exclusive access to the element.

Clears the element data reference, if any.

Unsafe following the same reasoning as ensure_data.

Gets a reference to the ElementData container.

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.)

Sets selector flags, which indicate what kinds of selectors may have matched on this element and therefore what kind of work may need to be performed when DOM state changes.

This is unsafe, like all the flag-setting methods, because it's only safe to call with exclusive access to the element. When setting flags on the parent during parallel traversal, we use SequentialTask to queue up the set to run after the threads join.

Returns true if the element has all the specified selector flags.

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.

Returns true if the element has a CSS animation.

Returns true if the element has a CSS transition (including running transitions and completed transitions).

Returns the value of the xml:lang="" attribute (or, if appropriate, the lang="" attribute) on this element.

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.)

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

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

Provided Methods

A debug-only check that the device's owner doc matches the actual doc we're the root of.

Otherwise we may set document-level state incorrectly, like the root font-size used for rem units.

Whether this element should match user and author rules.

We use this for Native Anonymous Content in Gecko.

Returns the depth of this element in the DOM.

The style scope of this element is a node that represents which rules apply to the element.

In Servo, where we don't know about Shadow DOM or XBL, the style scope is always the document.

Get this node's parent element from the perspective of a restyle traversal.

Returns the parent element we should inherit from.

This is pretty much always the parent element itself, except in the case of Gecko's Native Anonymous Content, which uses the traversal parent (i.e. the flattened tree parent) and which also may need to find the closest non-NAC ancestor.

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

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

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

For a given NAC element, return the closest non-NAC ancestor, which is guaranteed to exist.

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

Get this element's SMIL override declarations.

Get this element's animation rule by the cascade level.

Get the combined animation and transition rules.

Get this element's animation rule.

Get this element's transition rule.

Whether a given element may generate a pseudo-element.

This is useful to avoid computing, for example, pseudo styles for ::-first-line or ::-first-letter, when we know it won't affect us.

TODO(emilio, bz): actually implement the logic for it.

Returns whether the element's styles are up-to-date for |traversal_flags|.

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

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

Flag that this element has a descendant for animation-only restyle processing.

Only safe to call with exclusive access to the element.

Flag that this element has no descendant for animation-only restyle processing.

Only safe to call with exclusive access to the element.

Clear all bits related describing the dirtiness of descendants.

In Gecko, this corresponds to the regular dirty descendants bit, the animation-only dirty descendants bit, and the lazy frame construction descendants bit.

Clear all element flags related to dirtiness.

In Gecko, this corresponds to the regular dirty descendants bit, the animation-only dirty descendants bit, the lazy frame construction bit, and the lazy frame construction descendants bit.

Returns true if this element is a visited link.

Servo doesn't support visited styles yet.

Returns true if this element is native anonymous (only Gecko has native anonymous content).

Returns the pseudo-element implemented by this element, if any.

Gecko traverses pseudo-elements during the style traversal, and we need to know this so we can properly grab the pseudo-element style from the parent element.

Note that we still need to compute the pseudo-elements before-hand, given otherwise we don't know if we need to create an element or not.

Servo doesn't have to deal with this.

Immutably borrows the ElementData.

Mutably borrows the ElementData.

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.

Returns true if the element has animation restyle hints.

Returns the anonymous content for the current element's XBL binding, given if any.

This is used in Gecko for XBL and shadow DOM.

Return the element which we can use to look up rules in the selector maps.

This is always the element itself, except in the case where we are an element-backed pseudo-element, in which case we return the originating element.

Implements Gecko's nsBindingManager::WalkRules.

Returns whether to cut off the inheritance.

Implementors