Skip to main content

ElementContext

Trait ElementContext 

Source
pub trait ElementContext {
    // Required methods
    fn opaque_element(&self) -> Option<OpaqueElement>;
    fn opaque_parent(&self) -> Option<OpaqueNode>;
    fn get_attr(
        &self,
        attr: &LocalName,
        namespace: &Namespace,
    ) -> Option<String>;
    fn get_tree_counting_result(
        &self,
        caches: &mut TreeCountingCaches,
    ) -> TreeCountingResult;
}
Expand description

Provides element-level context needed during style computation.

Required Methods§

Source

fn opaque_element(&self) -> Option<OpaqueElement>

Opaque handle to the element.

Source

fn opaque_parent(&self) -> Option<OpaqueNode>

Opaque handle to the element’s parent node.

Source

fn get_attr(&self, attr: &LocalName, namespace: &Namespace) -> Option<String>

Return the value of the given custom attribute if it exists.

Source

fn get_tree_counting_result( &self, caches: &mut TreeCountingCaches, ) -> TreeCountingResult

Traverse the siblings of the element, returning the element’s sibling-index() and sibling-count(). Also populates caches with the sibling-index() and sibling-count() values for all siblings of this element.

Implementors§