Print action requests from our subtree

Co-authored-by: Delan Azabani <dazabani@igalia.com>
Signed-off-by: Luke Warlow <lwarlow@igalia.com>
This commit is contained in:
Luke Warlow
2026-01-07 20:36:32 +08:00
committed by Delan Azabani
parent 6bab93ae4c
commit 64041ee394
3 changed files with 17 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ use std::rc::Rc;
use std::sync::LazyLock;
pub(crate) use accessibility_traits::AccessibilityTree;
use accesskit::{Node as AxNode, NodeId as AxNodeId, Role, Tree as AxTree};
use accesskit::{Action, Node as AxNode, NodeId as AxNodeId, Role, Tree as AxTree};
use html5ever::{LocalName, local_name};
use layout_api::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
use log::trace;
@@ -77,6 +77,7 @@ impl AccessibilityTreeCalculator {
}
}
}
ax_next.add_action(Action::Click);
ax_nodes.insert(ax_next_id, ax_next);
}
AccessibilityTree {

View File

@@ -213,7 +213,7 @@ impl ApplicationHandler<AppEvent> for App {
.and_then(|window_id| state.window(ServoShellWindowId::from(u64::from(window_id))))
{
if let Some(headed_window) = window.platform_window().as_headed_window() {
headed_window.handle_winit_app_event(app_event);
headed_window.handle_winit_app_event(&window, app_event);
}
}

View File

@@ -758,8 +758,21 @@ impl HeadedWindow {
}
}
pub(crate) fn handle_winit_app_event(&self, app_event: AppEvent) {
pub(crate) fn handle_winit_app_event(&self, _window: &ServoShellWindow, app_event: AppEvent) {
if let AppEvent::Accessibility(ref event) = app_event {
match &event.window_event {
egui_winit::accesskit_winit::WindowEvent::InitialTreeRequested => {
// TODO get the initial tree from servo
},
egui_winit::accesskit_winit::WindowEvent::ActionRequested(req) => {
// TODO use window to get active webview, then do something with action request.
if req.target_tree != TreeId::ROOT {
println!("{:?}", req);
}
},
_ => {},
}
if self
.gui
.borrow_mut()