Skip to content

Commit

Permalink
fix!: Drop Tree::root_scroller (#279)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwcampbell authored Aug 27, 2023
1 parent d360d20 commit fc6c4e0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
7 changes: 1 addition & 6 deletions bindings/c/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -873,24 +873,19 @@ impl node_builder {
#[repr(C)]
pub struct tree {
pub root: node_id,
pub root_scroller: opt_node_id,
}

impl tree {
#[no_mangle]
pub extern "C" fn accesskit_tree_new(root: node_id) -> tree {
tree {
root,
root_scroller: opt_node_id::default(),
}
tree { root }
}
}

impl From<tree> for Tree {
fn from(tree: tree) -> Self {
Self {
root: tree.root.into(),
root_scroller: tree.root_scroller.into(),
}
}
}
Expand Down
10 changes: 1 addition & 9 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2336,20 +2336,12 @@ impl JsonSchema for Node {
#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))]
pub struct Tree {
pub root: NodeId,

/// The node that's used as the root scroller, if any. On some platforms
/// like Android we need to ignore accessibility scroll offsets for
/// that node and get them from the viewport instead.
pub root_scroller: Option<NodeId>,
}

impl Tree {
#[inline]
pub fn new(root: NodeId) -> Tree {
Tree {
root,
root_scroller: None,
}
Tree { root }
}
}

Expand Down
3 changes: 0 additions & 3 deletions consumer/src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ impl State {
fn validate_global(&self) {
assert!(self.nodes.contains_key(&self.data.root));
assert!(self.nodes.contains_key(&self.focus));
if let Some(id) = self.data.root_scroller {
assert!(self.nodes.contains_key(&id));
}
}

fn update(
Expand Down

0 comments on commit fc6c4e0

Please sign in to comment.