Index: chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc |
diff --git a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc |
index 4bc5f681e16cd6d90e1f33291c6f2ffbe1cf7cee..264a40009ff0d4868a5604d257bc3bf30d8a0c25 100644 |
--- a/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc |
+++ b/chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc |
@@ -125,43 +125,14 @@ void SelectToSpeakEventHandler::OnMouseEvent(ui::MouseEvent* event) { |
CancelEvent(event); |
- // Find the View to post the accessibility event on. |
aura::Window* event_target = static_cast<aura::Window*>(event->target()); |
- aura::Window* hit_window = event_target; |
- if (!hit_window) |
- return; |
- |
- views::Widget* hit_widget = views::Widget::GetWidgetForNativeView(hit_window); |
- while (!hit_widget) { |
- hit_window = hit_window->parent(); |
- if (!hit_window) |
- break; |
- |
- hit_widget = views::Widget::GetWidgetForNativeView(hit_window); |
- } |
- |
- if (!hit_window || !hit_widget) |
- return; |
- |
- gfx::Point window_location = event->location(); |
- aura::Window::ConvertPointToTarget(event_target, hit_window, |
- &window_location); |
- |
- views::View* root_view = hit_widget->GetRootView(); |
- views::View* hit_view = root_view->GetEventHandlerForPoint(window_location); |
- |
- if (hit_view) { |
- // Send the accessibility event, then save the view so we can post the |
- // cancel event on the same view if possible. |
- hit_view->NotifyAccessibilityEvent(ax_event, true); |
- if (!last_view_storage_id_) { |
- last_view_storage_id_ = |
- views::ViewStorage::GetInstance()->CreateStorageID(); |
- } |
- views::ViewStorage::GetInstance()->RemoveView(last_view_storage_id_); |
- views::ViewStorage::GetInstance()->StoreView(last_view_storage_id_, |
- hit_view); |
- } |
+ views::AXAuraObjCache* cache = views::AXAuraObjCache::GetInstance(); |
+ views::AXAuraObjWrapper* ax_obj = cache->GetOrCreate(event_target); |
+ ui::AXActionData action; |
+ action.action = ui::AX_ACTION_HIT_TEST; |
+ action.target_point = event->location(); |
+ action.hit_test_event_to_fire = ax_event; |
+ ax_obj->HandleAccessibleAction(action); |
David Tseng
2017/04/05 23:43:43
I think this should happen inside of the extension
dmazzoni
2017/04/07 23:34:08
I spend all day trying to make this work. It's sli
|
} |
void SelectToSpeakEventHandler::CancelEvent(ui::Event* event) { |
@@ -174,19 +145,9 @@ void SelectToSpeakEventHandler::CancelEvent(ui::Event* event) { |
void SelectToSpeakEventHandler::SendCancelAXEvent() { |
// If the user releases Search while the button is still down, cancel |
- // the Select-to-speak gesture. Try to post it on the same View that |
- // was last targeted, but if that's impossible, post it on the desktop. |
- views::View* last_view = |
- last_view_storage_id_ |
- ? views::ViewStorage::GetInstance()->RetrieveView( |
- last_view_storage_id_) |
- : nullptr; |
- if (last_view) { |
- last_view->NotifyAccessibilityEvent(ui::AX_EVENT_MOUSE_CANCELED, true); |
- } else { |
- AutomationManagerAura::GetInstance()->HandleEvent( |
- nullptr, nullptr, ui::AX_EVENT_MOUSE_CANCELED); |
- } |
+ // the Select-to-speak gesture. |
+ AutomationManagerAura::GetInstance()->HandleEvent( |
+ nullptr, nullptr, ui::AX_EVENT_MOUSE_CANCELED); |
David Tseng
2017/04/06 16:45:43
Btw, it seems like a hack to do this via ax events
|
} |
} // namespace chromeos |