8278612: [macos] test/jdk/java/awt/dnd/RemoveDropTargetCrashTest crashes with VoiceOver on macOS
Reviewed-by: serb, kizune
This commit is contained in:
parent
5cd9515333
commit
590fa9d8d7
src/java.desktop/macosx/native/libawt_lwawt/awt/a11y
@ -83,6 +83,7 @@
|
||||
- (NSView* _Nonnull)view;
|
||||
- (NSWindow* _Nonnull)window;
|
||||
- (id _Nonnull)parent;
|
||||
- (CommonComponentAccessibility* _Nullable)typeSafeParent;
|
||||
- (NSString* _Nonnull)javaRole;
|
||||
|
||||
- (BOOL)isMenu;
|
||||
|
@ -95,7 +95,11 @@ static jobject sAccessibilityClass = NULL;
|
||||
return NO;
|
||||
}
|
||||
|
||||
return isChildSelected(env, ((CommonComponentAccessibility *)[self parent])->fAccessible, fIndex, fComponent);
|
||||
CommonComponentAccessibility* parent = [self typeSafeParent];
|
||||
if (parent != nil) {
|
||||
return isChildSelected(env, parent->fAccessible, fIndex, fComponent);
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)isSelectable:(JNIEnv *)env
|
||||
@ -708,6 +712,15 @@ static jobject sAccessibilityClass = NULL;
|
||||
return fParent;
|
||||
}
|
||||
|
||||
- (CommonComponentAccessibility *)typeSafeParent
|
||||
{
|
||||
id parent = [self parent];
|
||||
if ([parent isKindOfClass:[CommonComponentAccessibility class]]) {
|
||||
return (CommonComponentAccessibility*)parent;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *)javaRole
|
||||
{
|
||||
if(fJavaRole == nil) {
|
||||
@ -824,11 +837,13 @@ static jobject sAccessibilityClass = NULL;
|
||||
if (fNSRole == nil) {
|
||||
NSString *javaRole = [self javaRole];
|
||||
fNSRole = [sRoles objectForKey:javaRole];
|
||||
CommonComponentAccessibility* parent = [self typeSafeParent];
|
||||
// The sRoles NSMutableDictionary maps popupmenu to Mac's popup button.
|
||||
// JComboBox behavior currently relies on this. However this is not the
|
||||
// proper mapping for a JPopupMenu so fix that.
|
||||
if ( [javaRole isEqualToString:@"popupmenu"] &&
|
||||
![[[self parent] javaRole] isEqualToString:@"combobox"] ) {
|
||||
parent != nil &&
|
||||
![[parent javaRole] isEqualToString:@"combobox"] ) {
|
||||
fNSRole = NSAccessibilityMenuRole;
|
||||
}
|
||||
if (fNSRole == nil) {
|
||||
@ -1025,8 +1040,9 @@ static jobject sAccessibilityClass = NULL;
|
||||
// This may change when later fixing issues which currently
|
||||
// exist for combo boxes, but for now the following is only
|
||||
// for JPopupMenus, not for combobox menus.
|
||||
id parent = [self parent];
|
||||
id parent = [self typeSafeParent];
|
||||
if ( [[self javaRole] isEqualToString:@"popupmenu"] &&
|
||||
parent != nil &&
|
||||
![[parent javaRole] isEqualToString:@"combobox"] ) {
|
||||
NSArray *children =
|
||||
[CommonComponentAccessibility childrenOfParent:self
|
||||
|
@ -59,11 +59,14 @@
|
||||
- (jobject)tabGroup
|
||||
{
|
||||
if (fTabGroupAxContext == NULL) {
|
||||
JNIEnv* env = [ThreadUtilities getJNIEnv];
|
||||
jobject tabGroupAxContext = [(CommonComponentAccessibility *)[self parent] axContextWithEnv:env];
|
||||
fTabGroupAxContext = (*env)->NewWeakGlobalRef(env, tabGroupAxContext);
|
||||
CHECK_EXCEPTION();
|
||||
(*env)->DeleteLocalRef(env, tabGroupAxContext);
|
||||
CommonComponentAccessibility* parent = [self typeSafeParent];
|
||||
if (parent != nil) {
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
jobject tabGroupAxContext = [parent axContextWithEnv:env];
|
||||
fTabGroupAxContext = (*env)->NewWeakGlobalRef(env, tabGroupAxContext);
|
||||
CHECK_EXCEPTION();
|
||||
(*env)->DeleteLocalRef(env, tabGroupAxContext);
|
||||
}
|
||||
}
|
||||
return fTabGroupAxContext;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user