| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" | 5 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #import "base/mac/mac_util.h" | 9 #import "base/mac/mac_util.h" |
| 10 #import "base/mac/sdk_forward_declarations.h" | 10 #import "base/mac/sdk_forward_declarations.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 case ui::AX_EVENT_SELECTED_CHILDREN_CHANGED: | 176 case ui::AX_EVENT_SELECTED_CHILDREN_CHANGED: |
| 177 if (node->GetRole() == ui::AX_ROLE_GRID || | 177 if (node->GetRole() == ui::AX_ROLE_GRID || |
| 178 node->GetRole() == ui::AX_ROLE_TABLE) { | 178 node->GetRole() == ui::AX_ROLE_TABLE) { |
| 179 mac_notification = NSAccessibilitySelectedRowsChangedNotification; | 179 mac_notification = NSAccessibilitySelectedRowsChangedNotification; |
| 180 } else { | 180 } else { |
| 181 mac_notification = NSAccessibilitySelectedChildrenChangedNotification; | 181 mac_notification = NSAccessibilitySelectedChildrenChangedNotification; |
| 182 } | 182 } |
| 183 break; | 183 break; |
| 184 case ui::AX_EVENT_DOCUMENT_SELECTION_CHANGED: { | 184 case ui::AX_EVENT_DOCUMENT_SELECTION_CHANGED: { |
| 185 mac_notification = NSAccessibilitySelectedTextChangedNotification; | 185 mac_notification = NSAccessibilitySelectedTextChangedNotification; |
| 186 // WebKit fires a notification both on the focused object and the root. |
| 187 BrowserAccessibility* focus = GetFocus(); |
| 188 if (!focus) |
| 189 break; |
| 190 NSAccessibilityPostNotification(focus->ToBrowserAccessibilityCocoa(), |
| 191 mac_notification); |
| 192 |
| 186 if (base::mac::IsOSElCapitanOrLater()) { | 193 if (base::mac::IsOSElCapitanOrLater()) { |
| 187 // |NSAccessibilityPostNotificationWithUserInfo| should be used on OS X | 194 // |NSAccessibilityPostNotificationWithUserInfo| should be used on OS X |
| 188 // 10.11 or later to notify Voiceover about text selection changes. This | 195 // 10.11 or later to notify Voiceover about text selection changes. This |
| 189 // API has been present on versions of OS X since 10.7 but doesn't | 196 // API has been present on versions of OS X since 10.7 but doesn't |
| 190 // appear to be needed by Voiceover before version 10.11. | 197 // appear to be needed by Voiceover before version 10.11. |
| 191 // WebKit fires a notification both on the focused object and the root. | |
| 192 NSDictionary* user_info = | 198 NSDictionary* user_info = |
| 193 GetUserInfoForSelectedTextChangedNotification(); | 199 GetUserInfoForSelectedTextChangedNotification(); |
| 194 | 200 |
| 195 BrowserAccessibility* focus = GetFocus(); | |
| 196 if (!focus) | |
| 197 return; | |
| 198 NSAccessibilityPostNotificationWithUserInfo( | |
| 199 focus->ToBrowserAccessibilityCocoa(), mac_notification, user_info); | |
| 200 | |
| 201 BrowserAccessibility* root = GetRoot(); | 201 BrowserAccessibility* root = GetRoot(); |
| 202 if (!root) | 202 if (!root) |
| 203 return; | 203 return; |
| 204 |
| 205 NSAccessibilityPostNotificationWithUserInfo( |
| 206 focus->ToBrowserAccessibilityCocoa(), mac_notification, user_info); |
| 204 NSAccessibilityPostNotificationWithUserInfo( | 207 NSAccessibilityPostNotificationWithUserInfo( |
| 205 root->ToBrowserAccessibilityCocoa(), mac_notification, user_info); | 208 root->ToBrowserAccessibilityCocoa(), mac_notification, user_info); |
| 206 return; | 209 return; |
| 207 } | 210 } |
| 208 break; | 211 break; |
| 209 } | 212 } |
| 210 case ui::AX_EVENT_CHECKED_STATE_CHANGED: | 213 case ui::AX_EVENT_CHECKED_STATE_CHANGED: |
| 211 case ui::AX_EVENT_VALUE_CHANGED: | 214 case ui::AX_EVENT_VALUE_CHANGED: |
| 212 mac_notification = NSAccessibilityValueChangedNotification; | 215 mac_notification = NSAccessibilityValueChangedNotification; |
| 213 break; | 216 break; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 forKey:NSAccessibilitySelectedTextMarkerRangeAttribute]; | 324 forKey:NSAccessibilitySelectedTextMarkerRangeAttribute]; |
| 322 [user_info setObject:native_focus_object | 325 [user_info setObject:native_focus_object |
| 323 forKey:NSAccessibilityTextChangeElement]; | 326 forKey:NSAccessibilityTextChangeElement]; |
| 324 } | 327 } |
| 325 } | 328 } |
| 326 | 329 |
| 327 return user_info; | 330 return user_info; |
| 328 } | 331 } |
| 329 | 332 |
| 330 } // namespace content | 333 } // namespace content |
| OLD | NEW |