Skip to content
Permalink
Browse files
8267066: New NSAccessibility peers should return they roles and subro…
…les directly

Reviewed-by: pbansal
  • Loading branch information
Alexander Zuev committed May 25, 2021
1 parent 31d0f0d commit d86f91642d7dcf829b8093ebed336d4386bff67a
Show file tree
Hide file tree
Showing 25 changed files with 78 additions and 36 deletions.
@@ -31,6 +31,7 @@
@interface ButtonAccessibility : CommonComponentAccessibility <NSAccessibilityButton> {

};
- (nullable NSString *)accessibilityLabel;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSString * _Nullable)accessibilityLabel;
- (BOOL)accessibilityPerformPress;
@end
@@ -29,7 +29,12 @@
* Implementation of the accessibility peer for the pushbutton role
*/
@implementation ButtonAccessibility
- (nullable NSString *)accessibilityLabel
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityButtonRole;
}

- (NSString * _Nullable)accessibilityLabel
{
return [self accessibilityTitleAttribute];
}
@@ -28,5 +28,6 @@
@interface CheckboxAccessibility : ButtonAccessibility <NSAccessibilityCheckBox> {

};
- (id)accessibilityValue;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (id _Nonnull)accessibilityValue;
@end
@@ -31,8 +31,12 @@
* Implementation of the accessibility peer for the checkbox role
*/
@implementation CheckboxAccessibility
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityCheckBoxRole;
}

- (id) accessibilityValue
- (id _Nonnull) accessibilityValue
{
AWT_ASSERT_APPKIT_THREAD;
return [self accessibilityValueAttribute];
@@ -41,7 +41,7 @@
+ (void) initializeRolesMap;
+ (JavaComponentAccessibility * _Nullable) getComponentAccessibility:(NSString * _Nonnull)role;
- (NSRect)accessibilityFrame;
- (nullable id)accessibilityParent;
- (id _Nullable)accessibilityParent;
- (BOOL)performAccessibleAction:(int)index;
- (BOOL)isAccessibilityElement;
@end
@@ -164,7 +164,7 @@ - (NSRect)accessibilityFrame
return NSMakeRect(point.x, point.y, size.width, size.height);
}

- (nullable id)accessibilityParent
- (id _Nullable)accessibilityParent
{
return [self accessibilityParentAttribute];
}
@@ -34,9 +34,9 @@
@interface CommonTextAccessibility : CommonComponentAccessibility {

}
- (nullable NSString *)accessibilityValueAttribute;
- (NSString * _Nullable)accessibilityValueAttribute;
- (NSRange)accessibilityVisibleCharacterRangeAttribute;
- (nullable NSString *)accessibilityStringForRangeAttribute:(NSRange)parameter;
- (NSString * _Nullable)accessibilityStringForRangeAttribute:(NSRange)parameter;
@end

#endif
@@ -31,6 +31,6 @@
@interface GroupAccessibility : CommonComponentAccessibility <NSAccessibilityGroup> {

};

- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSArray * _Nullable)accessibilityChildren;
@end
@@ -32,6 +32,10 @@
* classes reflecting the logic of the class.
*/
@implementation GroupAccessibility
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityGroupRole;
}

/*
* Return all non-ignored children.
@@ -31,5 +31,6 @@
@interface ImageAccessibility : CommonComponentAccessibility <NSAccessibilityImage> {

};
- (nullable NSString *)accessibilityLabel;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSString * _Nullable)accessibilityLabel;
@end
@@ -29,7 +29,12 @@
* Implementation of the accessibility peer for the icon role
*/
@implementation ImageAccessibility
- (nullable NSString *)accessibilityLabel
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityImageRole;
}

- (NSString * _Nullable)accessibilityLabel
{
return [self accessibilityTitleAttribute];
}
@@ -28,5 +28,6 @@
@interface RadiobuttonAccessibility : ButtonAccessibility <NSAccessibilityRadioButton> {

};
- (id)accessibilityValue;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (id _Nonnull)accessibilityValue;
@end
@@ -31,8 +31,12 @@
* Implementation of the accessibility peer for the radiobutton role
*/
@implementation RadiobuttonAccessibility
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityRadioButtonRole;
}

- (id) accessibilityValue
- (id _Nonnull) accessibilityValue
{
AWT_ASSERT_APPKIT_THREAD;
return [self accessibilityValueAttribute];
@@ -31,7 +31,7 @@
@interface ScrollAreaAccessibility : CommonComponentAccessibility {

};
- (NSString * _Nonnull)accessibilityRole;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSArray * _Nullable)accessibilityContents;
- (id _Nullable)accessibilityHorizontalScrollBar;
- (id _Nullable)accessibilityVerticalScrollBar;
@@ -83,9 +83,9 @@ - (id _Nullable)getScrollBarwithOrientation:(enum NSAccessibilityOrientation)ori
return nil;
}

- (NSString * _Nonnull)accessibilityRole
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return [self accessibilityRoleAttribute];
return NSAccessibilityScrollAreaRole;
}

- (NSArray * _Nullable)accessibilityContents
@@ -31,6 +31,6 @@
@interface ScrollBarAccessibility : CommonComponentAccessibility {

};
- (NSString * _Nonnull)accessibilityRole;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSAccessibilityOrientation) accessibilityOrientation;
@end
@@ -32,9 +32,9 @@
*/
@implementation ScrollBarAccessibility

- (NSString * _Nonnull)accessibilityRole
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return [self accessibilityRoleAttribute];
return NSAccessibilityScrollBarRole;
}

- (NSAccessibilityOrientation) accessibilityOrientation
@@ -31,9 +31,9 @@
@interface SliderAccessibility : CommonComponentAccessibility <NSAccessibilitySlider> {

};

- (nullable NSString *)accessibilityLabel;
- (nullable id)accessibilityValue;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSString * _Nullable)accessibilityLabel;
- (id _Nullable)accessibilityValue;
- (BOOL)accessibilityPerformDecrement;
- (BOOL)accessibilityPerformIncrement;
@end
@@ -32,12 +32,17 @@
* Implementation of the accessibility peer for the slider role
*/
@implementation SliderAccessibility
- (nullable NSString *)accessibilityLabel
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilitySliderRole;
}

- (NSString * _Nullable)accessibilityLabel
{
return [self accessibilityTitleAttribute];
}

- (nullable id)accessibilityValue
- (id _Nullable)accessibilityValue
{
return [self accessibilityValueAttribute];
}
@@ -31,9 +31,9 @@
@interface SpinboxAccessibility : CommonComponentAccessibility <NSAccessibilityStepper> {

};

- (nullable NSString *)accessibilityLabel;
- (nullable id)accessibilityValue;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSString * _Nullable)accessibilityLabel;
- (id _Nullable)accessibilityValue;
- (BOOL)accessibilityPerformDecrement;
- (BOOL)accessibilityPerformIncrement;
@end
@@ -32,12 +32,17 @@
* Implementation of the accessibility peer for the spinner role
*/
@implementation SpinboxAccessibility
- (nullable NSString *)accessibilityLabel
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityIncrementorRole;
}

- (NSString * _Nullable)accessibilityLabel
{
return [self accessibilityTitleAttribute];
}

- (nullable id)accessibilityValue
- (id _Nullable)accessibilityValue
{
return [self accessibilityValueAttribute];
}
@@ -34,8 +34,9 @@
@interface StaticTextAccessibility : CommonTextAccessibility<NSAccessibilityStaticText> {

};
- (nullable NSString *)accessibilityAttributedStringForRange:(NSRange)range;
- (nullable NSString *)accessibilityValue;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSString * _Nullable)accessibilityAttributedStringForRange:(NSRange)range;
- (NSString * _Nullable)accessibilityValue;
- (NSRange)accessibilityVisibleCharacterRange;
@end
#endif
@@ -27,12 +27,17 @@

@implementation StaticTextAccessibility

- (nullable NSString *)accessibilityAttributedStringForRange:(NSRange)range
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityStaticTextRole;
}

- (NSString * _Nullable)accessibilityAttributedStringForRange:(NSRange)range
{
return [self accessibilityStringForRangeAttribute:range];
}

- (nullable NSString *)accessibilityValue
- (NSString * _Nullable)accessibilityValue
{
return [self accessibilityValueAttribute];
}
@@ -31,5 +31,5 @@
@interface ToolbarAccessibility : CommonComponentAccessibility {

};
- (NSString * _Nonnull)accessibilityRole;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
@end
@@ -30,8 +30,8 @@
*/
@implementation ToolbarAccessibility

- (NSString * _Nonnull)accessibilityRole
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return [self accessibilityRoleAttribute];
return NSAccessibilityToolbarRole;
}
@end

1 comment on commit d86f916

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on d86f916 May 25, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.