pub enum DocGuard<'a> {
Ref(&'a BaseDocument),
RefCell(Ref<'a, BaseDocument>),
RwLock(RwLockReadGuard<'a, BaseDocument>),
Mutex(MutexGuard<'a, BaseDocument>),
}Variants§
Ref(&'a BaseDocument)
RefCell(Ref<'a, BaseDocument>)
RwLock(RwLockReadGuard<'a, BaseDocument>)
Mutex(MutexGuard<'a, BaseDocument>)
Methods from Deref<Target = BaseDocument>§
pub fn guard(&self) -> &SharedRwLock
pub fn tree(&self) -> &Slab<Node>
pub fn id(&self) -> usize
pub fn get_node(&self, node_id: usize) -> Option<&Node>
pub fn get_focussed_node_id(&self) -> Option<usize>
Sourcepub fn label_bound_input_element(&self, label_node_id: usize) -> Option<&Node>
pub fn label_bound_input_element(&self, label_node_id: usize) -> Option<&Node>
Find the label’s bound input elements: the element id referenced by the “for” attribute of a given label element or the first input element which is nested in the label Note that although there should only be one bound element, we return all possibilities instead of just the first in order to allow the caller to decide which one is correct
pub fn root_node(&self) -> &Node
pub fn try_root_element(&self) -> Option<&Node>
pub fn root_element(&self) -> &Node
Sourcepub fn has_changes(&self) -> bool
pub fn has_changes(&self) -> bool
Whether the document has been mutated
pub fn print_tree(&self)
pub fn print_subtree(&self, node_id: usize)
pub fn make_stylesheet( &self, css: impl AsRef<str>, origin: Origin, ) -> DocumentStyleSheet
Sourcepub fn has_pending_critical_resources(&self) -> bool
pub fn has_pending_critical_resources(&self) -> bool
Whether the Document has pending requests for “critical” resources (that should block rendering)
pub fn hit(&self, x: f32, y: f32) -> Option<HitResult>
pub fn get_hover_node_id(&self) -> Option<usize>
Sourcepub fn media_type(&self) -> &MediaType
pub fn media_type(&self) -> &MediaType
Returns the current CSS media type used to evaluate @media rules.
pub fn viewport(&self) -> &Viewport
pub fn get_viewport(&self) -> Viewport
pub fn devtools(&self) -> &DevtoolSettings
pub fn is_animating(&self) -> bool
pub fn get_cursor(&self) -> Option<CursorIcon>
pub fn viewport_scroll(&self) -> Point<f64>
Sourcepub fn get_client_bounding_rect(&self, node_id: usize) -> Option<BoundingRect>
pub fn get_client_bounding_rect(&self, node_id: usize) -> Option<BoundingRect>
Computes the size and position of the Node relative to the viewport
pub fn find_title_node(&self) -> Option<&Node>
Sourcepub fn find_text_position(&self, x: f32, y: f32) -> Option<(usize, usize)>
pub fn find_text_position(&self, x: f32, y: f32) -> Option<(usize, usize)>
Find the text position (inline_root_id, byte_offset) at a given point. Uses hit() for proper coordinate transformation, then finds the inline root and byte offset.
Sourcepub fn has_text_selection(&self) -> bool
pub fn has_text_selection(&self) -> bool
Check if there is an active (non-empty) text selection
Sourcepub fn get_selected_text(&self) -> Option<String>
pub fn get_selected_text(&self) -> Option<String>
Get the selected text content, supporting selection across multiple inline roots.
Sourcepub fn get_text_selection_ranges(&self) -> Vec<(usize, usize, usize)>
pub fn get_text_selection_ranges(&self) -> Vec<(usize, usize, usize)>
Get all selection ranges as Vec<(node_id, start_offset, end_offset)>. Returns empty vec if no selection.
pub fn print_taffy_tree(&self)
pub fn debug_log_node(&self, node_id: usize)
Sourcepub fn submit_form(&self, node_id: usize, submitter_id: usize)
pub fn submit_form(&self, node_id: usize, submitter_id: usize)
Submits a form with the given form node ID and submitter node ID
§Arguments
node_id- The ID of the form node to submitsubmitter_id- The ID of the node that triggered the submission
https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-algorithm
Sourcepub fn get_element_by_id(&self, id: &str) -> Option<usize>
pub fn get_element_by_id(&self, id: &str) -> Option<usize>
Find the node with the specified id attribute (if one exists)
Sourcepub fn query_selector<'input>(
&self,
selector: &'input str,
) -> Result<Option<usize>, ParseError<'input>>
pub fn query_selector<'input>( &self, selector: &'input str, ) -> Result<Option<usize>, ParseError<'input>>
Find the first node that matches the selector specified as a string Returns:
- Err(_) if parsing the selector fails
- Ok(None) if nothing matches
- Ok(Some(node_id)) with the first node ID that matches if one is found
Sourcepub fn query_selector_raw(
&self,
selector_list: &SelectorList<SelectorImpl>,
) -> Option<usize>
pub fn query_selector_raw( &self, selector_list: &SelectorList<SelectorImpl>, ) -> Option<usize>
Find the first node that matches the selector(s) specified in selector_list
Sourcepub fn query_selector_all<'input>(
&self,
selector: &'input str,
) -> Result<SmallVec<[usize; 32]>, ParseError<'input>>
pub fn query_selector_all<'input>( &self, selector: &'input str, ) -> Result<SmallVec<[usize; 32]>, ParseError<'input>>
Find all nodes that match the selector specified as a string Returns:
Err(_)if parsing the selector failsOk(SmallVec<usize>)with all matching nodes otherwise
Sourcepub fn query_selector_all_raw(
&self,
selector_list: &SelectorList<SelectorImpl>,
) -> SmallVec<[usize; 32]>
pub fn query_selector_all_raw( &self, selector_list: &SelectorList<SelectorImpl>, ) -> SmallVec<[usize; 32]>
Find all nodes that match the selector(s) specified in selector_list
pub fn try_parse_selector_list<'input>( &self, input: &'input str, ) -> Result<SelectorList<SelectorImpl>, ParseError<'input>>
Sourcepub fn node_chain(&self, node_id: usize) -> Vec<usize>
pub fn node_chain(&self, node_id: usize) -> Vec<usize>
Collect the nodes into a chain by traversing upwards
pub fn visit<F>(&self, visit: F)
Sourcepub fn non_anon_ancestor_if_anon(&self, node_id: usize) -> usize
pub fn non_anon_ancestor_if_anon(&self, node_id: usize) -> usize
If the node is non-anonymous then returns the node’s id Else find’s the first non-anonymous ancester of the node
pub fn next_node( &self, start: &Node, filter: impl FnMut(&Node) -> bool, ) -> Option<usize>
pub fn node_layout_ancestors(&self, node_id: usize) -> Vec<usize>
pub fn maybe_node_layout_ancestors(&self, node_id: Option<usize>) -> Vec<usize>
Sourcepub fn compare_document_order(&self, node_a: usize, node_b: usize) -> Ordering
pub fn compare_document_order(&self, node_a: usize, node_b: usize) -> Ordering
Compare the document order of two nodes. Returns Ordering::Less if node_a comes before node_b in document order. Returns Ordering::Greater if node_a comes after node_b. Returns Ordering::Equal if they are the same node.
Sourcepub fn collect_inline_roots_in_range(
&self,
start_node: usize,
end_node: usize,
) -> Vec<usize>
pub fn collect_inline_roots_in_range( &self, start_node: usize, end_node: usize, ) -> Vec<usize>
Collect all inline root nodes between start_node and end_node in document order. Both start and end are assumed to be inline roots. Returns the nodes in document order (from first to last).
pub fn build_accessibility_tree(&self) -> TreeUpdate
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for DocGuard<'a>
impl<'a> !RefUnwindSafe for DocGuard<'a>
impl<'a> !Send for DocGuard<'a>
impl<'a> !Sync for DocGuard<'a>
impl<'a> Unpin for DocGuard<'a>
impl<'a> UnsafeUnpin for DocGuard<'a>
impl<'a> !UnwindSafe for DocGuard<'a>
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> 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