Skip to content

Commit 64041ee

Browse files
lukewarlowdelan
andcommitted
Print action requests from our subtree
Co-authored-by: Delan Azabani <[email protected]> Signed-off-by: Luke Warlow <[email protected]>
1 parent 6bab93a commit 64041ee

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

components/layout/accessibility_tree.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::rc::Rc;
66
use std::sync::LazyLock;
77

88
pub(crate) use accessibility_traits::AccessibilityTree;
9-
use accesskit::{Node as AxNode, NodeId as AxNodeId, Role, Tree as AxTree};
9+
use accesskit::{Action, Node as AxNode, NodeId as AxNodeId, Role, Tree as AxTree};
1010
use html5ever::{LocalName, local_name};
1111
use layout_api::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
1212
use log::trace;
@@ -77,6 +77,7 @@ impl AccessibilityTreeCalculator {
7777
}
7878
}
7979
}
80+
ax_next.add_action(Action::Click);
8081
ax_nodes.insert(ax_next_id, ax_next);
8182
}
8283
AccessibilityTree {

ports/servoshell/desktop/app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl ApplicationHandler<AppEvent> for App {
213213
.and_then(|window_id| state.window(ServoShellWindowId::from(u64::from(window_id))))
214214
{
215215
if let Some(headed_window) = window.platform_window().as_headed_window() {
216-
headed_window.handle_winit_app_event(app_event);
216+
headed_window.handle_winit_app_event(&window, app_event);
217217
}
218218
}
219219

ports/servoshell/desktop/headed_window.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,21 @@ impl HeadedWindow {
758758
}
759759
}
760760

761-
pub(crate) fn handle_winit_app_event(&self, app_event: AppEvent) {
761+
pub(crate) fn handle_winit_app_event(&self, _window: &ServoShellWindow, app_event: AppEvent) {
762762
if let AppEvent::Accessibility(ref event) = app_event {
763+
match &event.window_event {
764+
egui_winit::accesskit_winit::WindowEvent::InitialTreeRequested => {
765+
// TODO get the initial tree from servo
766+
},
767+
egui_winit::accesskit_winit::WindowEvent::ActionRequested(req) => {
768+
// TODO use window to get active webview, then do something with action request.
769+
if req.target_tree != TreeId::ROOT {
770+
println!("{:?}", req);
771+
}
772+
},
773+
_ => {},
774+
}
775+
763776
if self
764777
.gui
765778
.borrow_mut()

0 commit comments

Comments
 (0)