Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "ui/accessibility/platform/ax_platform_node_mac.h" | 5 #import "ui/accessibility/platform/ax_platform_node_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 - (NSString*)getStringAttribute:(ui::AXStringAttribute)attribute { | 272 - (NSString*)getStringAttribute:(ui::AXStringAttribute)attribute { |
| 273 std::string attributeValue; | 273 std::string attributeValue; |
| 274 if (node_->GetStringAttribute(attribute, &attributeValue)) | 274 if (node_->GetStringAttribute(attribute, &attributeValue)) |
| 275 return base::SysUTF8ToNSString(attributeValue); | 275 return base::SysUTF8ToNSString(attributeValue); |
| 276 return nil; | 276 return nil; |
| 277 } | 277 } |
| 278 | 278 |
| 279 // NSAccessibility informal protocol implementation. | 279 // NSAccessibility informal protocol implementation. |
| 280 | 280 |
| 281 - (BOOL)accessibilityIsIgnored { | 281 - (BOOL)accessibilityIsIgnored { |
| 282 return [[self AXRole] isEqualToString:NSAccessibilityUnknownRole]; | 282 return [[self AXRole] isEqualToString:NSAccessibilityUnknownRole] || |
| 283 node_->GetData().HasStateFlag(ui::AX_STATE_INVISIBLE); | |
| 283 } | 284 } |
| 284 | 285 |
| 285 - (id)accessibilityHitTest:(NSPoint)point { | 286 - (id)accessibilityHitTest:(NSPoint)point { |
| 286 for (AXPlatformNodeCocoa* child in [self AXChildren]) { | 287 for (AXPlatformNodeCocoa* child in [self AXChildren]) { |
| 287 if (NSPointInRect(point, child.boundsInScreen)) | 288 if (NSPointInRect(point, child.boundsInScreen)) |
| 288 return [child accessibilityHitTest:point]; | 289 return [child accessibilityHitTest:point]; |
| 289 } | 290 } |
| 290 return NSAccessibilityUnignoredAncestor(self); | 291 return NSAccessibilityUnignoredAncestor(self); |
| 291 } | 292 } |
| 292 | 293 |
| 293 - (BOOL)accessibilityNotifiesWhenDestroyed { | 294 - (BOOL)accessibilityNotifiesWhenDestroyed { |
| 294 return YES; | 295 return YES; |
| 295 } | 296 } |
| 296 | 297 |
| 297 - (id)accessibilityFocusedUIElement { | 298 - (id)accessibilityFocusedUIElement { |
| 298 return node_->GetDelegate()->GetFocus(); | 299 return node_->GetDelegate()->GetFocus(); |
| 299 } | 300 } |
| 300 | 301 |
| 301 - (NSArray*)accessibilityActionNames { | 302 - (NSArray*)accessibilityActionNames { |
| 302 return nil; | 303 return nil; |
| 303 } | 304 } |
| 304 | 305 |
| 305 - (NSArray*)accessibilityAttributeNames { | 306 - (NSArray*)accessibilityAttributeNames { |
| 306 // These attributes are required on all accessibility objects. | 307 // These attributes are required on all accessibility objects. |
| 307 NSArray* const kAllRoleAttributes = @[ | 308 NSArray* const kAllRoleAttributes = @[ |
| 308 NSAccessibilityChildrenAttribute, | 309 NSAccessibilityChildrenAttribute, |
|
tapted
2016/12/13 05:57:51
There's also NSAccessibilityVisibleChildrenAttribu
Patti Lor
2016/12/13 06:13:19
Yeah, not sure either - thanks for looking into it
dmazzoni
2016/12/13 17:37:01
Yeah, I believe AXVisibleChildren is only used for
Patti Lor
2016/12/13 23:40:04
Ack - thanks for the info, will keep that in mind
| |
| 309 NSAccessibilityParentAttribute, | 310 NSAccessibilityParentAttribute, |
| 310 NSAccessibilityPositionAttribute, | 311 NSAccessibilityPositionAttribute, |
| 311 NSAccessibilityRoleAttribute, | 312 NSAccessibilityRoleAttribute, |
| 312 NSAccessibilitySizeAttribute, | 313 NSAccessibilitySizeAttribute, |
| 313 NSAccessibilitySubroleAttribute, | 314 NSAccessibilitySubroleAttribute, |
| 314 | 315 |
| 315 // Title is required for most elements. Cocoa asks for the value even if it | 316 // Title is required for most elements. Cocoa asks for the value even if it |
| 316 // is omitted here, but won't present it to accessibility APIs without this. | 317 // is omitted here, but won't present it to accessibility APIs without this. |
| 317 NSAccessibilityTitleAttribute, | 318 NSAccessibilityTitleAttribute, |
| 318 | 319 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 595 } | 596 } |
| 596 NotifyMacEvent(native_node_, event_type); | 597 NotifyMacEvent(native_node_, event_type); |
| 597 } | 598 } |
| 598 | 599 |
| 599 int AXPlatformNodeMac::GetIndexInParent() { | 600 int AXPlatformNodeMac::GetIndexInParent() { |
| 600 // TODO(dmazzoni): implement this. http://crbug.com/396137 | 601 // TODO(dmazzoni): implement this. http://crbug.com/396137 |
| 601 return -1; | 602 return -1; |
| 602 } | 603 } |
| 603 | 604 |
| 604 } // namespace ui | 605 } // namespace ui |
| OLD | NEW |