7124301: [macosx] When in a tab group if you arrow between tabs there are noVoiceOver announcements.
authorkaddepalli
Mon, 03 Dec 2018 06:59:19 +0530
changeset 52842 d3f785c4969c
parent 52841 326ffb4b630f
child 52843 2ff843783d95
7124301: [macosx] When in a tab group if you arrow between tabs there are noVoiceOver announcements. 7124298: [macosx] Nothing heard from VoiceOver when tabbing between a nestedtab group and a parent tab group. Reviewed-by: serb, sveerabhadra
src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java
src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.h
src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m
--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java	Sat Dec 01 09:37:19 2018 +0530
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java	Mon Dec 03 06:59:19 2018 +0530
@@ -32,6 +32,7 @@
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleContext;
 import javax.swing.JProgressBar;
+import javax.swing.JTabbedPane;
 import javax.swing.JSlider;
 import javax.swing.JCheckBox;
 import javax.swing.event.ChangeEvent;
@@ -42,6 +43,8 @@
 import static javax.accessibility.AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY;
 import static javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY;
 import static javax.accessibility.AccessibleContext.ACCESSIBLE_TEXT_PROPERTY;
+import static javax.accessibility.AccessibleContext.ACCESSIBLE_NAME_PROPERTY;
+
 import javax.accessibility.AccessibleRole;
 import javax.accessibility.AccessibleState;
 import sun.awt.AWTAccessor;
@@ -67,6 +70,7 @@
     private static native void valueChanged(long ptr);
     private static native void selectedTextChanged(long ptr);
     private static native void selectionChanged(long ptr);
+    private static native void titleChanged(long ptr);
     private static native void menuOpened(long ptr);
     private static native void menuClosed(long ptr);
     private static native void menuItemSelected(long ptr);
@@ -121,9 +125,9 @@
                 Object oldValue = e.getOldValue();
                 if (name.compareTo(ACCESSIBLE_CARET_PROPERTY) == 0) {
                     selectedTextChanged(ptr);
-                } else if (name.compareTo(ACCESSIBLE_TEXT_PROPERTY) == 0 ) {
+                } else if (name.compareTo(ACCESSIBLE_TEXT_PROPERTY) == 0) {
                     valueChanged(ptr);
-                } else if (name.compareTo(ACCESSIBLE_SELECTION_PROPERTY) == 0 ) {
+                } else if (name.compareTo(ACCESSIBLE_SELECTION_PROPERTY) == 0) {
                     selectionChanged(ptr);
                 } else if (name.compareTo(ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY) == 0 ) {
                     if (newValue instanceof AccessibleContext) {
@@ -162,6 +166,11 @@
                     if (thisRole == AccessibleRole.CHECK_BOX) {
                         valueChanged(ptr);
                     }
+                } else if (name.compareTo(ACCESSIBLE_NAME_PROPERTY) == 0) {
+                    //for now trigger only for JTabbedPane.
+                    if (e.getSource() instanceof JTabbedPane) {
+                        titleChanged(ptr);
+                    }
                 }
             }
         }
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.h	Sat Dec 01 09:37:19 2018 +0530
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.h	Mon Dec 03 06:59:19 2018 +0530
@@ -52,6 +52,7 @@
 - (void)postValueChanged;
 - (void)postSelectedTextChanged;
 - (void)postSelectionChanged;
+- (void)postTitleChanged;
 - (BOOL)isEqual:(id)anObject;
 - (BOOL)isAccessibleWithEnv:(JNIEnv *)env forAccessible:(jobject)accessible;
 
--- a/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m	Sat Dec 01 09:37:19 2018 +0530
+++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m	Mon Dec 03 06:59:19 2018 +0530
@@ -221,6 +221,12 @@
     NSAccessibilityPostNotification(self, NSAccessibilitySelectedChildrenChangedNotification);
 }
 
+-(void)postTitleChanged
+{
+    AWT_ASSERT_APPKIT_THREAD;
+    NSAccessibilityPostNotification(self, NSAccessibilityTitleChangedNotification);
+}
+
 - (void)postMenuOpened
 {
     AWT_ASSERT_APPKIT_THREAD;
@@ -497,7 +503,8 @@
     if (attributeStatesArray[6]) {
         [attributeNames addObject:NSAccessibilityChildrenAttribute];
         if ([javaRole isEqualToString:@"list"]
-                || [javaRole isEqualToString:@"table"]) {
+                || [javaRole isEqualToString:@"table"]
+                || [javaRole isEqualToString:@"pagetablist"]) {
             [attributeNames addObject:NSAccessibilitySelectedChildrenAttribute];
             [attributeNames addObject:NSAccessibilityVisibleChildrenAttribute];
         }
@@ -1443,6 +1450,19 @@
 
 /*
  * Class:     sun_lwawt_macosx_CAccessible
+ * Method:    titleChanged
+ * Signature: (I)V
+ */
+ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CAccessible_titleChanged
+ (JNIEnv *env, jclass jklass, jlong element)
+ {
+JNF_COCOA_ENTER(env);
+    [ThreadUtilities performOnMainThread:@selector(postTitleChanged) on:(JavaComponentAccessibility*)jlong_to_ptr(element) withObject:nil waitUntilDone:NO];
+JNF_COCOA_EXIT(env);
+ }
+
+/*
+ * Class:     sun_lwawt_macosx_CAccessible
  * Method:    menuOpened
  * Signature: (I)V
  */