Chromium Code Reviews| Index: content/browser/accessibility/browser_accessibility_manager_mac.mm |
| diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm |
| index 1361164af50e99f5959471dad1462b147ec576d6..c8e94cbae9f8a9c6c6f6a22495bc5603dff2c4aa 100644 |
| --- a/content/browser/accessibility/browser_accessibility_manager_mac.mm |
| +++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm |
| @@ -44,8 +44,14 @@ ui::AXTreeUpdate BrowserAccessibilityManagerMac::GetEmptyDocument() { |
| BrowserAccessibility* BrowserAccessibilityManagerMac::GetFocus( |
| BrowserAccessibility* root) { |
| - BrowserAccessibility* node = GetActiveDescendantFocus(root); |
| - return node; |
| + // On Mac, list boxes should always get focus on the whole list, otherwise |
| + // information about the number of selected items will never be reported. |
| + BrowserAccessibility* node = BrowserAccessibilityManager::GetFocus(root); |
| + if (node && node->GetRole() == ui::AX_ROLE_LIST_BOX) |
| + return node; |
| + |
| + // For other roles, follow the active descendant. |
| + return GetActiveDescendantFocus(root); |
| } |
| void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent( |
| @@ -54,6 +60,14 @@ void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent( |
| if (!node->IsNative()) |
| return; |
| + if (event_type == ui::AX_EVENT_FOCUS && |
| + node->GetRole() == ui::AX_ROLE_LIST_BOX_OPTION && |
| + node->GetParent() && |
| + node->GetParent()->GetRole() == ui::AX_ROLE_LIST_BOX) { |
|
je_julie(Not used)
2015/04/06 10:31:48
For this condition, how about extending IsListBoxO
|
| + node = node->GetParent(); |
| + SetFocus(node, false); |
| + } |
| + |
| // Refer to AXObjectCache.mm (webkit). |
| NSString* event_id = @""; |
| switch (event_type) { |
| @@ -139,6 +153,7 @@ void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent( |
| LOG(WARNING) << "Unknown accessibility event: " << event_type; |
| return; |
| } |
| + |
| BrowserAccessibilityCocoa* native_node = node->ToBrowserAccessibilityCocoa(); |
| DCHECK(native_node); |
| NSAccessibilityPostNotification(native_node, event_id); |