Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2105,6 +2105,7 @@ vec_property_methods! {
#[cfg(test)]
mod custom_actions {
use super::{CustomAction, Node, Role};
use core::slice;

#[test]
fn getter_should_return_default_value() {
Expand Down Expand Up @@ -2139,7 +2140,7 @@ mod custom_actions {
description: "second test action".into(),
};
node.push_custom_action(first_action.clone());
assert_eq!(node.custom_actions(), &[first_action.clone()]);
assert_eq!(node.custom_actions(), slice::from_ref(&first_action));
node.push_custom_action(second_action.clone());
assert_eq!(node.custom_actions(), &[first_action, second_action]);
}
Expand Down
20 changes: 10 additions & 10 deletions consumer/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl<'a> Position<'a> {
self.inner.downgrade()
}

pub fn inner_node(&self) -> &Node {
pub fn inner_node(&self) -> &Node<'a> {
&self.inner.node
}

Expand Down Expand Up @@ -520,7 +520,7 @@ impl<'a> Range<'a> {
Self { node, start, end }
}

pub fn node(&self) -> &Node {
pub fn node(&self) -> &Node<'a> {
&self.node
}

Expand Down Expand Up @@ -913,7 +913,7 @@ impl<'a> Node<'a> {
}
}

pub fn document_range(&self) -> Range {
pub fn document_range(&self) -> Range<'_> {
let start = self.document_start();
let end = self.document_end();
Range::new(*self, start, end)
Expand All @@ -923,15 +923,15 @@ impl<'a> Node<'a> {
self.data().text_selection().is_some()
}

pub fn text_selection(&self) -> Option<Range> {
pub fn text_selection(&self) -> Option<Range<'_>> {
self.data().text_selection().map(|selection| {
let anchor = InnerPosition::clamped_upgrade(self.tree_state, selection.anchor).unwrap();
let focus = InnerPosition::clamped_upgrade(self.tree_state, selection.focus).unwrap();
Range::new(*self, anchor, focus)
})
}

pub fn text_selection_anchor(&self) -> Option<Position> {
pub fn text_selection_anchor(&self) -> Option<Position<'_>> {
self.data().text_selection().map(|selection| {
let anchor = InnerPosition::clamped_upgrade(self.tree_state, selection.anchor).unwrap();
Position {
Expand All @@ -941,7 +941,7 @@ impl<'a> Node<'a> {
})
}

pub fn text_selection_focus(&self) -> Option<Position> {
pub fn text_selection_focus(&self) -> Option<Position<'_>> {
self.data().text_selection().map(|selection| {
let focus = InnerPosition::clamped_upgrade(self.tree_state, selection.focus).unwrap();
Position {
Expand All @@ -953,7 +953,7 @@ impl<'a> Node<'a> {

/// Returns the nearest text position to the given point
/// in this node's coordinate space.
pub fn text_position_at_point(&self, point: Point) -> Position {
pub fn text_position_at_point(&self, point: Point) -> Position<'_> {
let id = self.id();
if let Some((node, point)) = self.hit_test(point, &move |node| text_node_filter(id, node)) {
if node.role() == Role::TextRun {
Expand Down Expand Up @@ -1022,7 +1022,7 @@ impl<'a> Node<'a> {
}
}

pub fn line_range_from_index(&self, line_index: usize) -> Option<Range> {
pub fn line_range_from_index(&self, line_index: usize) -> Option<Range<'_>> {
let mut pos = self.document_range().start();

if line_index > 0 {
Expand All @@ -1045,7 +1045,7 @@ impl<'a> Node<'a> {
Some(Range::new(*self, pos.inner, end.inner))
}

pub fn text_position_from_global_usv_index(&self, index: usize) -> Option<Position> {
pub fn text_position_from_global_usv_index(&self, index: usize) -> Option<Position<'_>> {
let mut total_length = 0usize;
for node in self.text_runs() {
let node_text = node.data().value().unwrap();
Expand Down Expand Up @@ -1087,7 +1087,7 @@ impl<'a> Node<'a> {
None
}

pub fn text_position_from_global_utf16_index(&self, index: usize) -> Option<Position> {
pub fn text_position_from_global_utf16_index(&self, index: usize) -> Option<Position<'_>> {
let mut total_length = 0usize;
for node in self.text_runs() {
let node_text = node.data().value().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion platforms/atspi-common/src/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ impl Adapter {
}
}

fn root_window(current_state: &TreeState) -> Option<Node> {
fn root_window(current_state: &TreeState) -> Option<Node<'_>> {
const WINDOW_ROLES: &[Role] = &[Role::AlertDialog, Role::Dialog, Role::Window];
let root = current_state.root();
if WINDOW_ROLES.contains(&root.role()) {
Expand Down
Loading