-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8329667: [macos] Issue with JTree related fix for JDK-8317771 #19255
Conversation
Caching children and selected children of the thee on the native level; Caching all children of a specific parent in CAccessibility to enhance recursive children selection algorythm; Removing fix for JDK-8317771 as no longer needed;
👋 Welcome back kizune! A progress list of the required criteria for merging this PR into |
@azuev-java This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 181 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
@azuev-java The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
@savoptik @kumarabhi006 @prsadhuk please review |
NSMutableArray<id<NSAccessibilityRow>> *rowCache; | ||
BOOL rowCacheValid; | ||
NSMutableArray<id<NSAccessibilityRow>> *selectedRowCache; | ||
BOOL selectedRowCacheValid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And can we use a single array for the cache in the same way as we do in Table Accessibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They have different meanings and different content - plus selection being requested by OS much more frequently. And we do not want to invalidate the whole rows cache when selection changes - otherwise it will be pretty costly.
@@ -349,6 +349,9 @@ - (void)postSelectedTextChanged | |||
- (void)postSelectionChanged | |||
{ | |||
AWT_ASSERT_APPKIT_THREAD; | |||
if ([self respondsToSelector:NSSelectorFromString(@"invalidateSelectionCache")]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can override this method for the tree. to avoid checking the selector support... This is a time-consuming procedure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
- Rolled back changes to the CommonComponentAccessibility and added relevant post* methods overrides to the OutlineAccessibility.
@@ -39,7 +39,9 @@ | |||
import java.lang.reflect.Constructor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove unused import import javax.swing.tree.TreePath;
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
[super postTreeNodeExpanded]; | ||
} | ||
|
||
- (void)postSelectedCellsChanged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does OutlineRowAccessibility use CellAccessibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not - i am just covering all methods that can be potentially called on the table-like controls. It does no harm to override method that will never be called. But it will cause some discrepancies in the behavior if some custom control will call this notification and we fail to update the selection cache accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
It seems to me that it would be a good idea to do the same for lists.
|
||
- (BOOL)isCacheValid | ||
{ | ||
if (rowCacheValid && [[self parent] respondsToSelector:NSSelectorFromString(@"isCacheValid")]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
Is it possible to add a test to verify this behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test would be manual and it is hard to even describe what is the result of the test should look or sound like since we do not provide any string messages, VoiceOver does it and we can not tell ahead how it will be put. And for multilivel trees i am just running the SwingSet2 JTree demo and see that VoiceOver correctly handles full/partial collapse and expand - that after that there are no anomalies like VO output does not correspond to where cursor actually positioned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I was thinking of something like when nodes are collapsed or expanded then can we log some output like Children are valid or invalid.
Otherwise I have tested the fix with swingset2 demo and the test mentioned in JDK-8320664 which behaves fine with the fix.
|
||
- (nullable NSArray<id<NSAccessibilityRow>> *)accessibilityChildren | ||
{ | ||
if (![self isCacheValid]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we use rowCacheValid
value to check like it is done for accessibilitySelectedChildren
method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again - to cover the situation where expand/collapse events were delivered to the parent node. Or to the parent's parent.
…no effect but it is more uiform and according to the ObjectibeC convention where objects are referred as nil and references to the primitives as NULL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
[self invalidateSelectionCache]; | ||
[super postSelectedCellsChanged]; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that it is also worth defining a destructor that will destroy the cache before destroying the instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that on Java side we are notified when the accessibility is being enabled but we have no notification of when it is no longer used so we do not deliberately release native peers and in my testing even when i add dealloc function to the class it is never being called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope you have ran the whole gamut of jtreg tests, if not, please do it before integrating and SwingSet2 too..
Of course i did all the tests - just to be on the safe side i rerun all of available tests on the latest changeset and got 100% pass rate. |
/integrate |
Going to push as commit 05f13e7.
Your commit was automatically rebased without conflicts. |
@azuev-java Pushed as commit 05f13e7. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Caching children and selected children of the thee on the native level;
Caching all children of a specific parent in CAccessibility to enhance recursive children selection algorithm;
Removing fix for JDK-8317771 as no longer needed;
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19255/head:pull/19255
$ git checkout pull/19255
Update a local copy of the PR:
$ git checkout pull/19255
$ git pull https://git.openjdk.org/jdk.git pull/19255/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19255
View PR using the GUI difftool:
$ git pr show -t 19255
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19255.diff
Webrev
Link to Webrev Comment