Giter VIP home page Giter VIP logo

fama11y-tree's Introduction

fama11y-tree

An example on how to build a tree of all objects using atspi.

     Root
     ├── Child1
     │   ├── Grandchild1
     │   └── Grandchild2
     │       ├── Great-Grandchild1
     │       └── Great-Grandchild2
     └── Child2
         ├── Grandchild1
         └── Grandchild2

MSRV

Async fn recursive version

The A11yNode::from_accessible_proxy_recursive method currently requires Rust 1.77.2 or higher.

Cargo-msrv reports:

error[E0733]: recursion in an `async fn` requires boxing                                                                                                                             │
│   --> src/main.rs:67:5                                                                                                                                                               │
│    |                                                                                                                                                                                 │
│ 67 |     async fn from_accessible_proxy(ap: AccessibleProxy<'_>) -> Result<A11yNode> {                                                                                               │
│    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive `async fn`                                                                            │
│    |                                                                                                                                                                                 │
│    = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`                                                                                                   │
│    = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion

Async iterative version

The A11yNode::from_accessible_proxy_iterative method requires Rust 1.75.0 or higher.

Performance

processes objects recursive method iterative method
25 241 11.87871ms 31.792694ms
26 2900 288.716071ms 474.438153ms
28 4960 992.864247ms 808.82431ms
27 6948 1.447283253s 1.077571422s
28 7509 1.515564922s 1.08042886s
30 7813 1.589614858s 1.119880292s

It appears 'recursive' is faster with a small number of accessible applications, however 'iterative´ is faster when a larger number of objects is exposed on the bus. Note that it does not take that many applications to reach the point where iterative is faster.

Known issues

xdg-dbus-proxy

xdg-dbus-proxy does not seem to implement all methods on the Accessible interface. This results in an error if applcations require it:

Error: MethodError(OwnedErrorName("org.freedesktop.DBus.Error.UnknownMethod"), Some("Method \"GetRole\" with signature \"\" on interface \"org.a11y.atspi.Accessible\" doesn't exist\n"), Msg { type: Error, serial: 53, sender: UniqueName(":1.106"), reply-serial: 48, body: Signature("s"), fds: [] })

LibreOffice Calc

It appears LibreOffice Calc exposes 2^31 accessible objects (the table cells), which leads to an impractical and impossible situation.

When fama11y-tree calls GetChildren on the Accessible interface of their parent's frame, Calc will try and send them all. Which results in Calc freezing.

Not sure what is going on, maybe Calc tries to gather data to construct a reply message containing all children which - even if it succeeds at that - it would not send a message that size because D-Bus protocol prohibits sending messages exceeding 128 megabyte.

The problems:

  • Calc unresponsive and the accessible technology waits indefinitely for a reply.
  • eg. A screen-readers' cache could never handle a list of children that large.
  • D-Bus messages are not allowed to exceed 128 megabytes.

Exposing a subset, eg. exposing 'visible cells' only could make this more practical and sending the reply feasible.

Related bug: 156657

fama11y-tree's People

Contributors

luukvanderduim avatar ttwno avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

ttwno

fama11y-tree's Issues

Fails to build on Debian testing: error[E0733]: recursion in an `async fn` requires boxing

Running cargo build with current git master as of 3fdf960 on Debian testing fails for me like this:

   Compiling fama11y-tree v0.2.0 (/home/michi/development/git/fama11y-tree)
error[E0733]: recursion in an `async fn` requires boxing
  --> src/main.rs:79:5
   |
79 |     async fn from_accessible_proxy_recursive(ap: AccessibleProxy<'_>) -> Result<A11yNode> {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ recursive `async fn`
   |
   = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
   = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion

For more information about this error, try `rustc --explain E0733`.
error: could not compile `fama11y-tree` (bin "fama11y-tree") due to previous error

Potentially relevant packages:

$ dpkg -l cargo rustc
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Architecture Description
+++-==============-==============-============-=================================
ii  cargo          1.75.0+dfsg1-4 amd64        Rust package manager
ii  rustc          1.75.0+dfsg1-4 amd64        Rust systems programming language

Does not detect cycles

I know AT-SPI should not give out cycles, but I had a tab open that had a cycle (I assume) and the script runs forever (or at least 15 minutes, hehe).

You should probably add some cycle detection just in case it does encounter a cycle of some kind.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.