Build a fake tree (working)

This commit is contained in:
delan azabani
2025-11-06 17:04:10 +08:00
parent 4779055946
commit c29ffd6ffa
3 changed files with 38 additions and 37 deletions

13
Cargo.lock generated
View File

@@ -2289,7 +2289,7 @@ dependencies = [
[[package]] [[package]]
name = "ecolor" name = "ecolor"
version = "0.33.0" version = "0.33.0"
source = "git+https://codeberg.org/shuppy/accesskit-test#5762fccc07f1b6d27f4d8154c69d08cdfa6d5da6" source = "git+https://codeberg.org/shuppy/accesskit-test#053a2f7737ba6e63737fb878d67b801f6df184ba"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"emath", "emath",
@@ -2298,7 +2298,7 @@ dependencies = [
[[package]] [[package]]
name = "egui" name = "egui"
version = "0.33.0" version = "0.33.0"
source = "git+https://codeberg.org/shuppy/accesskit-test#5762fccc07f1b6d27f4d8154c69d08cdfa6d5da6" source = "git+https://codeberg.org/shuppy/accesskit-test#053a2f7737ba6e63737fb878d67b801f6df184ba"
dependencies = [ dependencies = [
"accesskit", "accesskit",
"ahash", "ahash",
@@ -2328,8 +2328,7 @@ dependencies = [
[[package]] [[package]]
name = "egui-winit" name = "egui-winit"
version = "0.33.0" version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://codeberg.org/shuppy/accesskit-test#053a2f7737ba6e63737fb878d67b801f6df184ba"
checksum = "bb4ea8cb063c00d8f23ce11279c01eb63a195a72be0e21d429148246dab7983e"
dependencies = [ dependencies = [
"accesskit_winit", "accesskit_winit",
"arboard", "arboard",
@@ -2394,7 +2393,7 @@ dependencies = [
[[package]] [[package]]
name = "emath" name = "emath"
version = "0.33.0" version = "0.33.0"
source = "git+https://codeberg.org/shuppy/accesskit-test#5762fccc07f1b6d27f4d8154c69d08cdfa6d5da6" source = "git+https://codeberg.org/shuppy/accesskit-test#053a2f7737ba6e63737fb878d67b801f6df184ba"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
] ]
@@ -2522,7 +2521,7 @@ dependencies = [
[[package]] [[package]]
name = "epaint" name = "epaint"
version = "0.33.0" version = "0.33.0"
source = "git+https://codeberg.org/shuppy/accesskit-test#5762fccc07f1b6d27f4d8154c69d08cdfa6d5da6" source = "git+https://codeberg.org/shuppy/accesskit-test#053a2f7737ba6e63737fb878d67b801f6df184ba"
dependencies = [ dependencies = [
"ab_glyph", "ab_glyph",
"ahash", "ahash",
@@ -2539,7 +2538,7 @@ dependencies = [
[[package]] [[package]]
name = "epaint_default_fonts" name = "epaint_default_fonts"
version = "0.33.0" version = "0.33.0"
source = "git+https://codeberg.org/shuppy/accesskit-test#5762fccc07f1b6d27f4d8154c69d08cdfa6d5da6" source = "git+https://codeberg.org/shuppy/accesskit-test#053a2f7737ba6e63737fb878d67b801f6df184ba"
[[package]] [[package]]
name = "equator" name = "equator"

View File

@@ -241,6 +241,7 @@ codegen-units = 1
[patch.crates-io] [patch.crates-io]
egui = { git = "https://codeberg.org/shuppy/accesskit-test" } egui = { git = "https://codeberg.org/shuppy/accesskit-test" }
egui-winit = { git = "https://codeberg.org/shuppy/accesskit-test" }
# If you need to temporarily test Servo with a local fork of some upstream # If you need to temporarily test Servo with a local fork of some upstream
# crate, add that here. Use the form: # crate, add that here. Use the form:
# #

View File

@@ -549,40 +549,41 @@ impl Minibrowser {
// where they meet. then we can do what we want with that root. // where they meet. then we can do what we want with that root.
node.push_child(*root_accesskit_node_id); node.push_child(*root_accesskit_node_id);
}); });
if first_update {
let root_id = self.root_accesskit_node_id.expect("Guaranteed by accesskit_subtree_builder() call above");
self.accesskit_adapter.update_if_active(|| {
let mut root = Node::default();
root.set_role(Role::WebView);
let a_id = root_id.with(1);
let mut a = Node::default();
a.set_role(Role::Button);
let b_id = root_id.with(2);
let mut b = Node::default();
b.set_role(Role::Button);
let c_id = root_id.with(3);
let mut c = Node::default();
c.set_role(Role::Button);
root.set_children(vec![a_id, b_id, c_id]);
TreeUpdate {
nodes: vec![
(root_id, root),
(a_id, a),
(b_id, b),
(c_id, c),
],
tree: None,
// TODO: this needs to align with the focus in eguis updates,
// unless the focus has genuinely changed
focus: b_id,
}
});
}
}); });
*last_update = now; *last_update = now;
}); });
if let Some(root_id) = self.root_accesskit_node_id {
if let Some(accesskit_mut) = self.context.egui_winit.accesskit_mut() {
accesskit_mut.update_if_active(|| {
let mut root = Node::default();
root.set_role(Role::WebView);
let a_id = root_id.with(1);
let mut a = Node::default();
a.set_role(Role::Button);
let b_id = root_id.with(2);
let mut b = Node::default();
b.set_role(Role::Button);
let c_id = root_id.with(3);
let mut c = Node::default();
c.set_role(Role::Button);
root.set_children(vec![a_id, b_id, c_id]);
TreeUpdate {
nodes: vec![
(root_id, root),
(a_id, a),
(b_id, b),
(c_id, c),
],
tree: None,
// TODO: this needs to align with the focus in eguis updates,
// unless the focus has genuinely changed
focus: b_id,
}
});
}
}
} }
/// Paint the minibrowser, as of the last update. /// Paint the minibrowser, as of the last update.