Index: chrome/browser/ui/views/accessibility/accessibility_event_router_views.cc |
diff --git a/chrome/browser/ui/views/accessibility/accessibility_event_router_views.cc b/chrome/browser/ui/views/accessibility/accessibility_event_router_views.cc |
index 4afc4e3268e07a1232859e3bbe6b5c78b49b381e..a6b32593d42ccf2003e6b23cb2cb2f5493ac3ca6 100644 |
--- a/chrome/browser/ui/views/accessibility/accessibility_event_router_views.cc |
+++ b/chrome/browser/ui/views/accessibility/accessibility_event_router_views.cc |
@@ -26,7 +26,9 @@ |
using views::FocusManager; |
AccessibilityEventRouterViews::AccessibilityEventRouterViews() |
- : most_recent_profile_(NULL) { |
+ : most_recent_profile_(NULL), |
+ most_recent_view_id_( |
+ views::ViewStorage::GetInstance()->CreateStorageID()) { |
// Register for notification when profile is destroyed to ensure that all |
// observers are detatched at that time. |
registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
@@ -163,6 +165,24 @@ void AccessibilityEventRouterViews::DispatchAccessibilityEvent( |
return; |
} |
+ // If this view is not focusable for accessibility, find the closest |
+ // ancestor that is, so that the correct accessible name is being read. |
+ views::View* temp_view = view; |
+ while (temp_view->parent() && !view->IsAccessibilityFocusable()) { |
+ temp_view = temp_view->parent(); |
+ if (temp_view->IsAccessibilityFocusable()) |
+ view = temp_view; |
sky
2014/07/14 15:57:19
Don't you want to break here?
evy
2014/07/14 16:03:47
Well, I have to check it in the while condition in
dmazzoni
2014/07/14 17:46:00
It may not be an actual problem in this case since
sky
2014/07/14 21:11:14
Are you saying you want:
while (temp_view && !tem
evy
2014/07/14 22:19:16
Yeah, sorry this function is way more complicated
|
+ } |
+ |
+ // Since multiple items could share a highest focusable view, these items |
+ // could all dispatch the same accessibility hover events, which isn't |
+ // necessary. |
+ if (type == ui::AX_EVENT_HOVER && |
+ views::ViewStorage::GetInstance()->RetrieveView(most_recent_view_id_) == |
dmazzoni
2014/07/14 17:46:00
Optional: add "using views::ViewStorage;" at the t
evy
2014/07/14 22:19:16
Done.
|
+ view) |
+ return; |
dmazzoni
2014/07/14 17:46:00
Nit: { } around return because conditional is mult
Daniel Erat
2014/07/14 18:04:14
i don't feel strongly about this one way or anothe
evy
2014/07/14 22:19:16
I've been taught that it's nice to have curly brac
|
+ views::ViewStorage::GetInstance()->StoreView(most_recent_view_id_, view); |
+ |
ui::AXViewState state; |
view->GetAccessibleState(&state); |