Chromium Code Reviews| Index: content/browser/accessibility/browser_accessibility_manager_win.cc |
| diff --git a/content/browser/accessibility/browser_accessibility_manager_win.cc b/content/browser/accessibility/browser_accessibility_manager_win.cc |
| index b3e6613ed10a610f7380ed1c5ff237948b6c536c..f6e5f54b1be3202036260639c399f42153bfca23 100644 |
| --- a/content/browser/accessibility/browser_accessibility_manager_win.cc |
| +++ b/content/browser/accessibility/browser_accessibility_manager_win.cc |
| @@ -136,9 +136,27 @@ void BrowserAccessibilityManagerWin::UserIsReloading() { |
| MaybeCallNotifyWinEvent(IA2_EVENT_DOCUMENT_RELOAD, GetRoot()); |
| } |
| +BrowserAccessibility* BrowserAccessibilityManagerWin::GetFocus() { |
| + BrowserAccessibility* node = BrowserAccessibilityManager::GetFocus(); |
| + |
| + // Combo boxes have an invisible list inside them which tracks the active list |
|
dmazzoni
2016/04/29 20:55:54
Isn't the combo box itself supposed to have active
|
| + // item. |
| + if (node && node->GetRole() == ui::AX_ROLE_COMBO_BOX) { |
|
dmazzoni
2016/04/29 20:55:54
Same here, only if combo box is editable?
|
| + BrowserAccessibility* child = node->InternalGetChild(0); |
| + if (child && child->GetRole() == ui::AX_ROLE_LIST) { |
| + BrowserAccessibility* active_list_item = GetActiveDescendantFocus(child); |
| + if (active_list_item != child) |
| + return active_list_item; |
| + } |
| + } |
| + |
| + return GetActiveDescendantFocus(node); |
| +} |
| + |
| void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( |
| ui::AXEvent event_type, |
| BrowserAccessibility* node) { |
| + DCHECK(node); |
| BrowserAccessibilityDelegate* root_delegate = GetDelegateFromRootManager(); |
| if (!root_delegate || !root_delegate->AccessibilityGetAcceleratedWidget()) { |
| DLOG(WARNING) << "Not firing AX event because of no root_delegate or hwnd"; |
| @@ -157,9 +175,10 @@ void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( |
| LONG event_id = EVENT_MIN; |
| switch (event_type) { |
| - case ui::AX_EVENT_ACTIVEDESCENDANTCHANGED: |
| + case ui::AX_EVENT_ACTIVEDESCENDANTCHANGED: { |
| event_id = IA2_EVENT_ACTIVE_DESCENDANT_CHANGED; |
| break; |
| + } |
| case ui::AX_EVENT_ALERT: |
| event_id = EVENT_SYSTEM_ALERT; |
| break; |
| @@ -209,9 +228,6 @@ void BrowserAccessibilityManagerWin::NotifyAccessibilityEvent( |
| break; |
| } |
| - if (!node) |
| - return; |
| - |
| if (event_id != EVENT_MIN) |
| MaybeCallNotifyWinEvent(event_id, node); |
| @@ -238,6 +254,7 @@ bool BrowserAccessibilityManagerWin::CanFireEvents() { |
| void BrowserAccessibilityManagerWin::FireFocusEvent( |
| BrowserAccessibility* node) { |
| + DCHECK(node); |
| // On Windows, we always fire a FOCUS event on the root of a frame before |
| // firing a focus event within that frame. |
| if (node->manager() != last_focused_manager_ && |