Chromium Code Reviews| 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 79fa94904ba8d2fbd2fcb4f57b97db3fa7f8ca29..df018cc47e10bf47b349dfecfc37a91cff75cd40 100644 |
| --- a/ui/accessibility/platform/ax_platform_node_mac.mm |
| +++ b/ui/accessibility/platform/ax_platform_node_mac.mm |
| @@ -349,10 +349,49 @@ void NotifyMacEvent(NSView* target, ui::AXEvent event_type) { |
| return axAttributes.autorelease(); |
| } |
| -- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute { |
| +- (BOOL)accessibilityIsAttributeSettable:(NSString*)attributeName { |
| + // Allow certain attributes to be written via an accessibility client. A |
| + // writable attribute will only appear as such if the accessibility element |
| + // has a value set for that attribute. |
| + if ([attributeName isEqualToString:NSAccessibilitySelectedAttribute] || |
| + [attributeName |
| + isEqualToString:NSAccessibilitySelectedChildrenAttribute] || |
| + [attributeName |
| + isEqualToString:NSAccessibilitySelectedTextRangeAttribute] || |
| + [attributeName |
| + isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute]) { |
| + if (!ui::AXViewState::IsFlagSet(node_->GetData().state, |
| + ui::AX_STATE_READ_ONLY)) |
| + // TODO(patricialor): Move READ_ONLY check to callbacks. |
| + return YES; |
|
tapted
2016/08/12 03:50:52
There might be some specific semantics of ui::AX_S
Patti Lor
2016/08/12 05:16:54
Thanks, didn't know that! Acking this and the next
|
| + } |
| + |
| + if ([attributeName isEqualToString:NSAccessibilityValueAttribute] || |
| + [attributeName isEqualToString:NSAccessibilitySelectedTextAttribute]) { |
| + if (node_->GetDelegate()->CanSetStringValue()) |
|
tapted
2016/08/12 03:50:52
perhaps just `return node_->GetDelegate()->CanSetS
Patti Lor
2016/08/12 05:16:54
Acknowledged.
|
| + return YES; |
| + } |
| + |
| + if ([attributeName isEqualToString:NSAccessibilityFocusedAttribute]) { |
| + if (ui::AXViewState::IsFlagSet(node_->GetData().state, |
|
tapted
2016/08/12 03:50:52
same here - just return the function result
Patti Lor
2016/08/12 05:16:54
Acknowledged.
|
| + ui::AX_STATE_FOCUSABLE)) |
| + return YES; |
| + } |
| + |
| + // TODO(patricialor): Add callbacks for updating the above attributes except |
| + // NSAccessibilityValueAttribute. |
| return NO; |
| } |
| +- (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { |
| + if ([attribute isEqualToString:NSAccessibilityValueAttribute] && |
| + [value isKindOfClass:[NSString class]]) |
| + node_->GetDelegate()->SetStringValue(base::SysNSStringToUTF16(value)); |
| + |
| + // TODO(patricialor): Plumb through all the other writable attributes as |
|
tapted
2016/08/12 03:50:52
It might be wrong to already return `YES` for the
Patti Lor
2016/08/12 05:16:54
Done.
|
| + // specified in accessibilityIsAttributeSettable. |
| +} |
| + |
| - (id)accessibilityAttributeValue:(NSString*)attribute { |
| SEL selector = NSSelectorFromString(attribute); |
| if ([self respondsToSelector:selector]) |