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 88ab503003939c38fe2445d8d7efe90d2dd0a465..b7323f1249421de6ab0b2112f1fbbbb451df9f67 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" |
|
tapted
2016/09/28 01:03:20
nit: remove?
Patti Lor
2016/10/04 05:45:14
Done, thanks for pointing them all out ><
|
| #include "base/macros.h" |
| #include "base/strings/sys_string_conversions.h" |
| #include "ui/accessibility/ax_node_data.h" |
| @@ -199,6 +200,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, |
| @@ -212,7 +214,7 @@ EventMap BuildEventMap() { |
| return event_map; |
| } |
| -void NotifyMacEvent(NSView* target, ui::AXEvent event_type) { |
| +void NotifyMacEvent(AXPlatformNodeCocoa* target, ui::AXEvent event_type) { |
| NSAccessibilityPostNotification( |
| target, [AXPlatformNodeCocoa nativeNotificationFromAXEvent:event_type]); |
| } |
| @@ -255,6 +257,10 @@ void NotifyMacEvent(NSView* target, ui::AXEvent event_type) { |
| } |
| - (void)detach { |
| + if (!node_) |
| + return; |
| + NSAccessibilityPostNotification( |
| + self, NSAccessibilityUIElementDestroyedNotification); |
| node_ = nil; |
| } |
| @@ -285,6 +291,10 @@ void NotifyMacEvent(NSView* target, ui::AXEvent event_type) { |
| return NSAccessibilityUnignoredAncestor(self); |
| } |
| +- (BOOL)accessibilityNotifiesWhenDestroyed { |
| + return YES; |
| +} |
| + |
| - (NSArray*)accessibilityActionNames { |
| return nil; |
| } |
| @@ -553,22 +563,21 @@ gfx::NativeViewAccessible AXPlatformNodeMac::GetNativeViewAccessible() { |
| } |
| void AXPlatformNodeMac::NotifyAccessibilityEvent(ui::AXEvent event_type) { |
| - NSView* target = GetDelegate()->GetTargetForNativeAccessibilityEvent(); |
| - |
| + 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() { |