-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
8256109: Create implementation for NSAccessibilityButton protocol #1549
Conversation
Merge changes from master
Initial implementation. In future the accessibilityLabel function might be moved to a common component accessibility level if during implementation i will not find any corner cases when this function should behave radically different.
👋 Welcome back kizune! A progress list of the required criteria for merging this PR into |
@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
|
Maybe it is better to change the used file hierarchy? So all new native a11y could be placed in a separate folder and each peer in a separate file? It will be hard to understand the code if will have old and new implementation just in one file for all peers, actually, even now it is hard to view this file containing all old code. |
/* | ||
* Implementation of the NSAccessibilityButton protocol | ||
*/ | ||
@implementation ButtonAccessibility |
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.
Do not we need to remove the old perform()
?
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.
Not yet - as i said i'm not going to delete the old code yet si it can be easily reverted for testing and comparison reasons.
AWT_ASSERT_APPKIT_THREAD; | ||
|
||
JNIEnv* env = [ThreadUtilities getJNIEnv]; | ||
JNFCallStaticVoidMethod(env, jm_doAccessibleAction, [self axContextWithEnv:(env)], 0, fComponent); |
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.
Are you sure that the jm_doAccessibleAction
is always initialized here?
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.
Yes.
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 guess it is became broken when the perform() will be removed. Can this method use its own variable?
Changed the iitialization procedure to a class function with dictionary of role to class name relation. This pr is still intermittent since it uses the old style JNF java call syntacsis. Once fix for JDK-8257853 is integrated the calls needs to be converted to the new style but that is a minor change.
That probably a good idea. Uploading a new fix version. |
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.
All looks fine to me, although it will hit the changes to remove JNF for JNI calls in a head-on conflict.
@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 54 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 |
- (nullable id)accessibilityParent; | ||
@end | ||
|
||
#endif |
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 see a warning for missing newline at end of this file.
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.
For some reason all .h files are marked with this warning. Not sure why - there are no new line after the last statements in other .h files in the project.
* or visit www.oracle.com if you need additional information or have any | ||
* questions. | ||
*/ | ||
|
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.
There are no header guard here. Is it left intentionally?
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.
Yes, since the CommonComponentAccessibility being imported from the base class sometimes it causes compilation glitches - guess ObjC is not a big fan of forward-declaration. Adding header guard helps. And since i'm not planning to include sub-component header files in the base classes the ifdef guard is not required.
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 headers in the obj-c usually do not have guards because they are included via "#import"
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 know. But in this case that was not enough - that still caused weird compilation glitches like full compilation works but incremental calculation gives compilation error about usage of non-initialized variables. Guards helped.
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 missed where the guards have helped, there are no guards in this file.
Same question about why did you add guards to the "CommonComponentAccessibility.h"?
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 added guards into CommonComponentAccessibility.h because without them importing them into JavaComponentAccessibility from which CommonComponentAccessibility is inherited creates intermittent build failures. I used ifdef guards and the problem was gone so i kept them. I do not include any of the implementing classes headers down the inheritance three so i decided not to add guards there.
@azuev-java I think you need to rebase this PR as you started working on this some time back. If I use "git fetch #1549" to get the PR, I need to Reconfigure, though there is no makefile changes done. Also, it is resulting in failure if configure. There are few merge commits in this PR, may be that is the issue. |
* questions. | ||
*/ | ||
|
||
#include "ButtonAccessibility.h" |
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 guess we should be consistent in the usage of import vs include.
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 are not wrong. Fixed.
#include "ButtonAccessibility.h" | ||
#import "ThreadUtilities.h" | ||
|
||
static JNF_STATIC_MEMBER_CACHE(jm_doAccessibleAction, sjc_CAccessibility,"doAccessibleAction","(Ljavax/accessibility/AccessibleAction;ILjava/awt/Component;)V"); |
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 move this to the method itself, it is unlikely will be used outside of it, same as in the perform()
|
+ (JavaComponentAccessibility *) getComponentAccessibility:(NSString *)role | ||
{ | ||
if (rolesMap == nil) { | ||
[self initializeRolesMap]; |
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.
Is it possible that this will be called on the different threads? Or it is always appkit(probably AWT_ASSERT_APPKIT_THREAD could be useful)?
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.
Well, this method is being called from AppKit thread only but giving that it is static and public adding an assertion would be indeed wise. Fixed.
/integrate |
@azuev-java Since your change was applied there have been 54 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit ae9187d. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Creating a native peer for pushbutton accessibility role on Max OS X.
The process of choosing of what peer to initialize is clunky so
might be addressed in the future.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/1549/head:pull/1549
$ git checkout pull/1549