Skip to content
Open
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
12 changes: 6 additions & 6 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2790,7 +2790,7 @@ impl JsonSchema for Properties {
#[cfg_attr(feature = "schemars", derive(JsonSchema))]
#[cfg_attr(feature = "serde", serde(deny_unknown_fields))]
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
pub struct Tree {
pub struct TreeInfo {
/// The identifier of the tree's root node.
pub root: NodeId,
/// The name of the UI toolkit in use.
Expand All @@ -2799,10 +2799,10 @@ pub struct Tree {
pub toolkit_version: Option<String>,
}

impl Tree {
impl TreeInfo {
#[inline]
pub fn new(root: NodeId) -> Tree {
Tree {
pub fn new(root: NodeId) -> TreeInfo {
TreeInfo {
root,
toolkit_name: None,
toolkit_version: None,
Expand Down Expand Up @@ -2853,7 +2853,7 @@ pub struct TreeUpdate {
/// if it has not changed since the previous update, but providing the same
/// information again is also allowed. This is required when initializing
/// a tree.
pub tree: Option<Tree>,
pub tree: Option<TreeInfo>,

/// The identifier of the tree that this update applies to.
///
Expand Down Expand Up @@ -3240,7 +3240,7 @@ mod tests {

#[test]
fn new_tree_should_have_root_id() {
let tree = Tree::new(NodeId(1));
let tree = TreeInfo::new(NodeId(1));
assert_eq!(tree.root, NodeId(1));
assert_eq!(tree.toolkit_name, None);
assert_eq!(tree.toolkit_version, None);
Expand Down
32 changes: 16 additions & 16 deletions consumer/src/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use accesskit::{Rect, Role};

use crate::node::Node;
use crate::node::NodeRef;

#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub enum FilterResult {
Expand All @@ -14,7 +14,7 @@ pub enum FilterResult {
ExcludeSubtree,
}

fn common_filter_base(node: &Node) -> Option<FilterResult> {
fn common_filter_base(node: &NodeRef) -> Option<FilterResult> {
if node.is_focused() {
return Some(FilterResult::Include);
}
Expand All @@ -36,12 +36,12 @@ fn common_filter_base(node: &Node) -> Option<FilterResult> {
None
}

fn common_filter_without_parent_checks(node: &Node) -> FilterResult {
fn common_filter_without_parent_checks(node: &NodeRef) -> FilterResult {
common_filter_base(node).unwrap_or(FilterResult::Include)
}

fn is_first_sibling_in_parent_bbox<'a>(
mut siblings: impl Iterator<Item = Node<'a>>,
mut siblings: impl Iterator<Item = NodeRef<'a>>,
parent_bbox: Rect,
) -> bool {
siblings.next().is_some_and(|sibling| {
Expand All @@ -51,7 +51,7 @@ fn is_first_sibling_in_parent_bbox<'a>(
})
}

pub fn common_filter(node: &Node) -> FilterResult {
pub fn common_filter(node: &NodeRef) -> FilterResult {
if let Some(result) = common_filter_base(node) {
return result;
}
Expand Down Expand Up @@ -91,7 +91,7 @@ pub fn common_filter(node: &Node) -> FilterResult {
FilterResult::Include
}

pub fn common_filter_with_root_exception(node: &Node) -> FilterResult {
pub fn common_filter_with_root_exception(node: &NodeRef) -> FilterResult {
if node.is_root() {
return FilterResult::Include;
}
Expand All @@ -100,7 +100,7 @@ pub fn common_filter_with_root_exception(node: &Node) -> FilterResult {

#[cfg(test)]
mod tests {
use accesskit::{Node, NodeId, Rect, Role, Tree, TreeId, TreeUpdate};
use accesskit::{Node, NodeId, Rect, Role, TreeId, TreeInfo, TreeUpdate};
use alloc::vec;

use super::{
Expand Down Expand Up @@ -128,7 +128,7 @@ mod tests {
}),
(NodeId(1), Node::new(Role::Button)),
],
tree: Some(Tree::new(NodeId(0))),
tree: Some(TreeInfo::new(NodeId(0))),
tree_id: TreeId::ROOT,
focus: NodeId(0),
};
Expand All @@ -151,7 +151,7 @@ mod tests {
node
}),
],
tree: Some(Tree::new(NodeId(0))),
tree: Some(TreeInfo::new(NodeId(0))),
tree_id: TreeId::ROOT,
focus: NodeId(0),
};
Expand All @@ -174,7 +174,7 @@ mod tests {
node
}),
],
tree: Some(Tree::new(NodeId(0))),
tree: Some(TreeInfo::new(NodeId(0))),
tree_id: TreeId::ROOT,
focus: NodeId(1),
};
Expand All @@ -193,7 +193,7 @@ mod tests {
}),
(NodeId(1), Node::new(Role::Button)),
],
tree: Some(Tree::new(NodeId(0))),
tree: Some(TreeInfo::new(NodeId(0))),
tree_id: TreeId::ROOT,
focus: NodeId(0),
};
Expand All @@ -218,7 +218,7 @@ mod tests {
}),
(NodeId(1), Node::new(Role::Button)),
],
tree: Some(Tree::new(NodeId(0))),
tree: Some(TreeInfo::new(NodeId(0))),
tree_id: TreeId::ROOT,
focus: NodeId(0),
};
Expand All @@ -239,7 +239,7 @@ mod tests {
}),
(NodeId(1), Node::new(Role::Button)),
],
tree: Some(Tree::new(NodeId(0))),
tree: Some(TreeInfo::new(NodeId(0))),
tree_id: TreeId::ROOT,
focus: NodeId(1),
};
Expand All @@ -259,7 +259,7 @@ mod tests {
}),
(NodeId(1), Node::new(Role::TextRun)),
],
tree: Some(Tree::new(NodeId(0))),
tree: Some(TreeInfo::new(NodeId(0))),
tree_id: TreeId::ROOT,
focus: NodeId(0),
};
Expand Down Expand Up @@ -345,7 +345,7 @@ mod tests {
node
}),
],
tree: Some(Tree::new(NodeId(0))),
tree: Some(TreeInfo::new(NodeId(0))),
tree_id: TreeId::ROOT,
focus: NodeId(0),
};
Expand Down Expand Up @@ -411,7 +411,7 @@ mod tests {
node
}),
],
tree: Some(Tree::new(NodeId(0))),
tree: Some(TreeInfo::new(NodeId(0))),
tree_id: TreeId::ROOT,
focus: NodeId(0),
};
Expand Down
Loading
Loading