RFR: 8329667: [macos] Issue with JTree related fix for JDK-8317771 [v3]

Alexander Zuev kizune at openjdk.org
Wed May 22 06:43:03 UTC 2024


On Tue, 21 May 2024 08:47:04 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:

>> Alexander Zuev has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   - Remove unused import;
>
> src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/OutlineAccessibility.m line 70:
> 
>> 68: - (nullable  NSArray<id<NSAccessibilityRow>> *)accessibilityChildren
>> 69: {
>> 70:     if (![self isCacheValid]) {
> 
> Why can't we use `rowCacheValid` value to check like it is done for `accessibilitySelectedChildren` method?

Again - to cover the situation where expand/collapse events were delivered to the parent node. Or to the parent's parent.

> src/java.desktop/macosx/native/libawt_lwawt/awt/a11y/OutlineAccessibility.m line 98:
> 
>> 96: - (BOOL)isCacheValid
>> 97: {
>> 98:     if (rowCacheValid && [[self parent] respondsToSelector:NSSelectorFromString(@"isCacheValid")]) {
> 
> When `isCacheValid` is invoked for the first time then `rowCacheValid` is _FALSE_ and we return _FALSE_ value from this method and then the `accessibilityChildren` method from super class is invoked to get all children and store them in an array(`rowCache`). Subsequently `rowCacheValid` will be set to _TRUE_.
> 
> As per my understanding `[[self parent] respondsToSelector:NSSelectorFromString(@"isCacheValid")]` condition will be checked only if `rowCacheValid` is true and once we have a valid array of children then what is the point of checking `isCacheValid` method in parent ?

In multilevel trees when someone in the parent's path is collapsed the treeCollapsed event will be delivered to that node. We can either invalidate all leaf nodes caches (which is costly) or mark that exact node's cache as invalid and when the expand will happen when a11y cursor will try to position inside one of the childrens it will check that parent was invalidated and will regenerate its own cache.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19255#discussion_r1609373028
PR Review Comment: https://git.openjdk.org/jdk/pull/19255#discussion_r1609372117


More information about the client-libs-dev mailing list