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..3986200c487ac2c07c518bf4fe8fd1ae122c1012 100644 |
| --- a/ui/accessibility/platform/ax_platform_node_mac.mm |
| +++ b/ui/accessibility/platform/ax_platform_node_mac.mm |
| @@ -7,6 +7,7 @@ |
| #import <Cocoa/Cocoa.h> |
| #include <stddef.h> |
| +#import "base/mac/sdk_forward_declarations.h" |
| #include "base/macros.h" |
| #include "base/strings/sys_string_conversions.h" |
| #include "ui/accessibility/ax_node_data.h" |
| @@ -197,6 +198,7 @@ RoleMap BuildSubroleMap() { |
| EventMap BuildEventMap() { |
| const EventMapEntry events[] = { |
| + {ui::AX_EVENT_FOCUS, NSAccessibilityFocusedUIElementChangedNotification}, |
| {ui::AX_EVENT_TEXT_CHANGED, NSAccessibilityTitleChangedNotification}, |
| {ui::AX_EVENT_VALUE_CHANGED, NSAccessibilityValueChangedNotification}, |
| {ui::AX_EVENT_TEXT_SELECTION_CHANGED, |
| @@ -210,7 +212,7 @@ EventMap BuildEventMap() { |
| return event_map; |
| } |
| -void NotifyMacEvent(NSView* target, ui::AXEvent event_type) { |
| +void NotifyMacEvent(id target, ui::AXEvent event_type) { |
|
tapted
2016/09/26 05:19:17
can this instead change from NSView* -> AXPlatform
Patti Lor
2016/09/28 00:29:14
Done.
|
| NSAccessibilityPostNotification( |
| target, [AXPlatformNodeCocoa nativeNotificationFromAXEvent:event_type]); |
| } |
| @@ -253,6 +255,11 @@ void NotifyMacEvent(NSView* target, ui::AXEvent event_type) { |
| } |
| - (void)detach { |
| + if (!node_) |
| + return; |
| + NSAccessibilityPostNotification( |
| + self, NSAccessibilityUIElementDestroyedNotification); |
| + NSAccessibilityUnregisterUniqueIdForUIElement(self); |
| node_ = nil; |
| } |
| @@ -283,6 +290,14 @@ void NotifyMacEvent(NSView* target, ui::AXEvent event_type) { |
| return NSAccessibilityUnignoredAncestor(self); |
| } |
| +- (BOOL)accessibilityNotifiesWhenDestroyed { |
| + return YES; |
| +} |
| + |
| +- (BOOL)accessibilityShouldUseUniqueId { |
|
tapted
2016/09/26 05:19:17
This needs a note that it was never part of the in
Patti Lor
2016/09/28 00:29:14
See above comment - deleted this method entirely.
|
| + return YES; |
| +} |
| + |
| - (NSArray*)accessibilityActionNames { |
| return nil; |
| } |
| @@ -515,22 +530,22 @@ gfx::NativeViewAccessible AXPlatformNodeMac::GetNativeViewAccessible() { |
| } |
| void AXPlatformNodeMac::NotifyAccessibilityEvent(ui::AXEvent event_type) { |
| - NSView* target = GetDelegate()->GetTargetForNativeAccessibilityEvent(); |
| - |
| + if (!native_node_) |
|
tapted
2016/09/26 05:19:17
nit: This extra check isn't needed - I'd go for ju
Patti Lor
2016/09/28 00:29:14
Done.
|
| + GetNativeViewAccessible(); |
| // Add mappings between ui::AXEvent and NSAccessibility notifications using |
| // the EventMap above. This switch contains exceptions to those mappings. |
| switch (event_type) { |
| case ui::AX_EVENT_TEXT_CHANGED: |
| // If the view is a user-editable textfield, this should change the value. |
| if (GetData().role == ui::AX_ROLE_TEXT_FIELD) { |
| - NotifyMacEvent(target, ui::AX_EVENT_VALUE_CHANGED); |
| + NotifyMacEvent(native_node_, ui::AX_EVENT_VALUE_CHANGED); |
| return; |
| } |
| break; |
| default: |
| break; |
| } |
| - NotifyMacEvent(target, event_type); |
| + NotifyMacEvent(native_node_, event_type); |
| } |
| int AXPlatformNodeMac::GetIndexInParent() { |