[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: RFR: 8317771 [macos14] Expand/collapse a JTree using keyboard freezes the application in macOS 1
From:       Artem Semenov <asemenov () openjdk ! org>
Date:       2023-12-25 12:30:48
Message-ID: _TnQXl6SK395WUSKc9tolVFx6L9BODof-CNefNaELWM=.30f29b5e-fd2d-465c-b1da-57e18fc12043 () github ! com
[Download RAW message or body]

On Thu, 21 Dec 2023 21:13:14 GMT, Alexander Zuev <kizune@openjdk.org> wrote:

> > NSAccessibility Outline is an accessibility representation of trees.
> > This representation requires that the visible children be represented as a flat \
> > array. The child linearization algorithm available in \
> > ```CAccessibility.getChildrenAndRolesRecursive()``` is universal, i.e. suitable \
> > for any object with the role of a tree, but is not efficient, since it traverses \
> > the entire tree and selects suitable children. For JTree, this algorithm can be \
> > optimized by using TreePath, but the old algorithm will have to be retained to \
> > maintain versatility.
> 
> src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java line 799:
> 
> > 797:                         for (int i = 0; i < count; i++) {
> > 798:                             TreePath path = tree.getPathForRow(i);
> > 799:                             Accessible an = createAccessibleTreeNode(tree, \
> > path);
> 
> I see that you are creating the accessible tree node with reflection calling its \
> constructor. Can you just elaborate if it is the only way to get hold of it and why \
> getting a tree.getAccessible().getAccessibleChild(i) does not work or what kind of \
> problem getting the tree node this way creates?

A little lower, the access algorithm is implemented in the way you showed.
But to speed things up, I want to avoid recursion through the native and for this it \
is easier to initialize those nodes that are present in the tree path through the \
constructor. Why do I propose to use reflection? Otherwise, you will either have to \
make the constructor of a double-nested class public, or create a chain of methods \
that allow you to instantiate this class through a new call in CAccessibility.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/17165#discussion_r1436078711


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic