| Index: ui/accessibility/platform/ax_platform_node_mac.mm
|
| diff --git a/ui/accessibility/platform/ax_platform_node_mac.mm b/ui/accessibility/platform/ax_platform_node_mac.mm
|
| index 7e4e1718440c51b86d59f01f22e4dbef4dc5d277..0cabd69678cb513b4f93c77eec82e855a98f0fdb 100644
|
| --- a/ui/accessibility/platform/ax_platform_node_mac.mm
|
| +++ b/ui/accessibility/platform/ax_platform_node_mac.mm
|
| @@ -427,27 +427,8 @@ void NotifyMacEvent(AXPlatformNodeCocoa* target, ui::AXEvent event_type) {
|
| return nil;
|
| }
|
|
|
| -// NSAccessibility attributes.
|
| -
|
| -- (NSArray*)AXChildren {
|
| - if (!node_)
|
| - return nil;
|
| - int count = node_->GetChildCount();
|
| - NSMutableArray* children = [NSMutableArray arrayWithCapacity:count];
|
| - for (int i = 0; i < count; ++i)
|
| - [children addObject:node_->ChildAtIndex(i)];
|
| - return NSAccessibilityUnignoredChildren(children);
|
| -}
|
| -
|
| -- (id)AXParent {
|
| - if (!node_)
|
| - return nil;
|
| - return NSAccessibilityUnignoredAncestor(node_->GetParent());
|
| -}
|
| -
|
| -- (NSValue*)AXPosition {
|
| - return [NSValue valueWithPoint:self.boundsInScreen.origin];
|
| -}
|
| +// NSAccessibility attributes. Order them according to
|
| +// NSAccessibilityConstants.h, or see https://crbug.com/678898.
|
|
|
| - (NSString*)AXRole {
|
| if (!node_)
|
| @@ -455,6 +436,10 @@ void NotifyMacEvent(AXPlatformNodeCocoa* target, ui::AXEvent event_type) {
|
| return [[self class] nativeRoleFromAXRole:node_->GetData().role];
|
| }
|
|
|
| +- (NSString*)AXRoleDescription {
|
| + return NSAccessibilityRoleDescription([self AXRole], [self AXSubrole]);
|
| +}
|
| +
|
| - (NSString*)AXSubrole {
|
| ui::AXRole role = node_->GetData().role;
|
| switch (role) {
|
| @@ -469,29 +454,21 @@ void NotifyMacEvent(AXPlatformNodeCocoa* target, ui::AXEvent event_type) {
|
| return [AXPlatformNodeCocoa nativeSubroleFromAXRole:role];
|
| }
|
|
|
| -- (NSString*)AXRoleDescription {
|
| - return NSAccessibilityRoleDescription([self AXRole], [self AXSubrole]);
|
| -}
|
| -
|
| -- (NSValue*)AXSize {
|
| - return [NSValue valueWithSize:self.boundsInScreen.size];
|
| -}
|
| -
|
| -- (NSString*)AXTitle {
|
| - return [self getStringAttribute:ui::AX_ATTR_NAME];
|
| +- (NSString*)AXHelp {
|
| + return [self getStringAttribute:ui::AX_ATTR_DESCRIPTION];
|
| }
|
|
|
| - (NSString*)AXValue {
|
| return [self getStringAttribute:ui::AX_ATTR_VALUE];
|
| }
|
|
|
| -- (NSValue*)AXEnabled {
|
| +- (NSNumber*)AXEnabled {
|
| return [NSNumber
|
| numberWithBool:!ui::AXNodeData::IsFlagSet(node_->GetData().state,
|
| ui::AX_STATE_DISABLED)];
|
| }
|
|
|
| -- (NSValue*)AXFocused {
|
| +- (NSNumber*)AXFocused {
|
| if (ui::AXNodeData::IsFlagSet(node_->GetData().state,
|
| ui::AX_STATE_FOCUSABLE))
|
| return [NSNumber numberWithBool:(node_->GetDelegate()->GetFocus() ==
|
| @@ -499,33 +476,50 @@ void NotifyMacEvent(AXPlatformNodeCocoa* target, ui::AXEvent event_type) {
|
| return [NSNumber numberWithBool:NO];
|
| }
|
|
|
| -- (NSString*)AXHelp {
|
| - return [self getStringAttribute:ui::AX_ATTR_DESCRIPTION];
|
| +- (id)AXParent {
|
| + if (!node_)
|
| + return nil;
|
| + return NSAccessibilityUnignoredAncestor(node_->GetParent());
|
| }
|
|
|
| -- (NSWindow*)AXTopLevelUIElement {
|
| - return [self AXWindow];
|
| +- (NSArray*)AXChildren {
|
| + if (!node_)
|
| + return nil;
|
| + int count = node_->GetChildCount();
|
| + NSMutableArray* children = [NSMutableArray arrayWithCapacity:count];
|
| + for (int i = 0; i < count; ++i)
|
| + [children addObject:node_->ChildAtIndex(i)];
|
| + return NSAccessibilityUnignoredChildren(children);
|
| }
|
|
|
| -- (NSWindow*)AXWindow {
|
| +- (id)AXWindow {
|
| return node_->GetDelegate()->GetTopLevelWidget();
|
| }
|
|
|
| -// Textfield-specific NSAccessibility attributes.
|
| +- (id)AXTopLevelUIElement {
|
| + return [self AXWindow];
|
| +}
|
|
|
| -- (NSNumber*)AXInsertionPointLineNumber {
|
| - // Multiline is not supported on views.
|
| - return [NSNumber numberWithInteger:0];
|
| +- (NSValue*)AXPosition {
|
| + return [NSValue valueWithPoint:self.boundsInScreen.origin];
|
| }
|
|
|
| -- (NSNumber*)AXNumberOfCharacters {
|
| - return [NSNumber numberWithInteger:[[self AXValue] length]];
|
| +- (NSValue*)AXSize {
|
| + return [NSValue valueWithSize:self.boundsInScreen.size];
|
| +}
|
| +
|
| +- (NSString*)AXTitle {
|
| + return [self getStringAttribute:ui::AX_ATTR_NAME];
|
| }
|
|
|
| +// Misc attributes.
|
| +
|
| - (NSString*)AXPlaceholderValue {
|
| return [self getStringAttribute:ui::AX_ATTR_PLACEHOLDER];
|
| }
|
|
|
| +// Text-specific attributes.
|
| +
|
| - (NSString*)AXSelectedText {
|
| NSRange selectedTextRange;
|
| [[self AXSelectedTextRange] getValue:&selectedTextRange];
|
| @@ -547,11 +541,20 @@ void NotifyMacEvent(AXPlatformNodeCocoa* target, ui::AXEvent event_type) {
|
| valueWithRange:NSMakeRange(beginSelectionIndex, abs(end - start))];
|
| }
|
|
|
| +- (NSNumber*)AXNumberOfCharacters {
|
| + return [NSNumber numberWithInteger:[[self AXValue] length]];
|
| +}
|
| +
|
| - (NSValue*)AXVisibleCharacterRange {
|
| return [NSValue
|
| valueWithRange:NSMakeRange(0, [[self AXNumberOfCharacters] intValue])];
|
| }
|
|
|
| +- (NSNumber*)AXInsertionPointLineNumber {
|
| + // Multiline is not supported on views.
|
| + return [NSNumber numberWithInteger:0];
|
| +}
|
| +
|
| @end
|
|
|
| namespace ui {
|
|
|