Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ public void propertyChange(final PropertyChangeEvent evt) {
if (newValue instanceof Accessible) {
AccessibleContext nvAC = ((Accessible) newValue).getAccessibleContext();
AccessibleRole nvRole = nvAC.getAccessibleRole();
if (!ignoredRoles.contains(roleKey(nvRole))) {
String roleStr = nvRole == null ? null :
AWTAccessor.getAccessibleBundleAccessor().getKey(nvRole);
if (!ignoredRoles.contains(roleStr)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks fine, but I’m wondering if we need the same null check here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need it, but I added one just now since you asked about it.

Previously this invocation (at line 119) did not include a null check, and the other invocation (at line 1037) did.

focusChanged();
}
}
Expand Down Expand Up @@ -1034,8 +1036,10 @@ private static void _addChildren(Accessible a, int whichChildren, boolean allowI
// "ignored", and we should skip it and its descendants
if (isShowing(context)) {
final AccessibleRole role = context.getAccessibleRole();
if (role != null && ignoredRoles != null &&
ignoredRoles.contains(roleKey(role))) {
String roleStr = role == null ? null :
AWTAccessor.getAccessibleBundleAccessor().getKey(role);
if (roleStr != null && ignoredRoles != null &&
ignoredRoles.contains(roleStr)) {
// Get the child's unignored children.
_addChildren(child, whichChildren, false,
childrenAndRoles, ChildrenOperations.COMMON);
Expand Down Expand Up @@ -1096,8 +1100,6 @@ private static boolean isShowing(final AccessibleContext context) {
return isShowing(parentContext);
}

private static native String roleKey(AccessibleRole aRole);

public static Object[] getChildren(final Accessible a, final Component c) {
if (a == null) return null;
return invokeAndWait(new Callable<Object[]>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,20 +325,6 @@ static BOOL JavaAccessibilityIsSupportedAttribute(id element, NSString *attribut
return [[element accessibilityAttributeNames] indexOfObject:attribute] != NSNotFound;
}

/*
* Class: sun_lwawt_macosx_CAccessibility
* Method: roleKey
* Signature: (Ljavax/accessibility/AccessibleRole;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_sun_lwawt_macosx_CAccessibility_roleKey
(JNIEnv *env, jclass clz, jobject axRole)
{
DECLARE_CLASS_RETURN(sjc_AccessibleRole, "javax/accessibility/AccessibleRole", NULL);
DECLARE_FIELD_RETURN(sjf_key, sjc_AccessibleRole, "key", "Ljava/lang/String;", NULL);
return (*env)->GetObjectField(env, axRole, sjf_key);
}


// errors from NSAccessibilityErrors
void JavaAccessibilityRaiseSetAttributeToIllegalTypeException(const char *functionName, id element, NSString *attribute, id value)
{
Expand Down