| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // TODO(patricialor): Add more events. | 214 // TODO(patricialor): Add more events. |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 EventMap event_map; | 217 EventMap event_map; |
| 218 for (size_t i = 0; i < arraysize(events); ++i) | 218 for (size_t i = 0; i < arraysize(events); ++i) |
| 219 event_map[events[i].value] = events[i].nativeValue; | 219 event_map[events[i].value] = events[i].nativeValue; |
| 220 return event_map; | 220 return event_map; |
| 221 } | 221 } |
| 222 | 222 |
| 223 void NotifyMacEvent(AXPlatformNodeCocoa* target, ui::AXEvent event_type) { | 223 void NotifyMacEvent(AXPlatformNodeCocoa* target, ui::AXEvent event_type) { |
| 224 NSAccessibilityPostNotification( | 224 if (event_type == ui::AX_EVENT_VALUE_CHANGED) { |
| 225 target, [AXPlatformNodeCocoa nativeNotificationFromAXEvent:event_type]); | 225 // VoiceOver stopped responding correctly to |
| 226 // NSAccessibilityValueChangedNotification for text fields in 10.11. But |
| 227 // notifying the element as destroyed and subsequently focused elicits good |
| 228 // behavior from VoiceOver for simple text fields. |
| 229 NSAccessibilityPostNotification( |
| 230 target, NSAccessibilityUIElementDestroyedNotification); |
| 231 NSAccessibilityPostNotification( |
| 232 target, NSAccessibilityFocusedUIElementChangedNotification); |
| 233 } else { |
| 234 NSAccessibilityPostNotification( |
| 235 target, [AXPlatformNodeCocoa nativeNotificationFromAXEvent:event_type]); |
| 236 } |
| 226 } | 237 } |
| 227 | 238 |
| 228 } // namespace | 239 } // namespace |
| 229 | 240 |
| 230 @interface AXPlatformNodeCocoa () | 241 @interface AXPlatformNodeCocoa () |
| 231 // Helper function for string attributes that don't require extra processing. | 242 // Helper function for string attributes that don't require extra processing. |
| 232 - (NSString*)getStringAttribute:(ui::AXStringAttribute)attribute; | 243 - (NSString*)getStringAttribute:(ui::AXStringAttribute)attribute; |
| 233 // Returns AXValue, or nil if AXValue isn't an NSString. | 244 // Returns AXValue, or nil if AXValue isn't an NSString. |
| 234 - (NSString*)getAXValueAsString; | 245 - (NSString*)getAXValueAsString; |
| 235 @end | 246 @end |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 } | 698 } |
| 688 NotifyMacEvent(native_node_, event_type); | 699 NotifyMacEvent(native_node_, event_type); |
| 689 } | 700 } |
| 690 | 701 |
| 691 int AXPlatformNodeMac::GetIndexInParent() { | 702 int AXPlatformNodeMac::GetIndexInParent() { |
| 692 // TODO(dmazzoni): implement this. http://crbug.com/396137 | 703 // TODO(dmazzoni): implement this. http://crbug.com/396137 |
| 693 return -1; | 704 return -1; |
| 694 } | 705 } |
| 695 | 706 |
| 696 } // namespace ui | 707 } // namespace ui |
| OLD | NEW |