Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Unified Diff: ui/views/accessibility/ax_window_obj_wrapper.cc

Issue 2803823002: Fix Chrome OS virtual keyboard accessibility (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/accessibility/ax_window_obj_wrapper.cc
diff --git a/ui/views/accessibility/ax_window_obj_wrapper.cc b/ui/views/accessibility/ax_window_obj_wrapper.cc
index 4352db0109aaa9b011135308023987aed1fe1b2f..0eff06ff7cc12fe1a2be6f9d742b0fea16769a03 100644
--- a/ui/views/accessibility/ax_window_obj_wrapper.cc
+++ b/ui/views/accessibility/ax_window_obj_wrapper.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include "base/strings/utf_string_conversions.h"
+#include "ui/accessibility/ax_action_data.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/accessibility/platform/aura_window_properties.h"
#include "ui/aura/window.h"
@@ -54,7 +55,7 @@ void AXWindowObjWrapper::Serialize(ui::AXNodeData* out_node_data) {
out_node_data->AddStringAttribute(ui::AX_ATTR_NAME,
base::UTF16ToUTF8(window_->GetTitle()));
out_node_data->state = 0;
- out_node_data->location = gfx::RectF(window_->bounds());
+ out_node_data->location = gfx::RectF(window_->GetBoundsInScreen());
ui::AXTreeIDRegistry::AXTreeID child_ax_tree_id =
window_->GetProperty(ui::kChildAXTreeID);
@@ -66,6 +67,27 @@ int32_t AXWindowObjWrapper::GetID() {
return AXAuraObjCache::GetInstance()->GetID(window_);
}
+bool AXWindowObjWrapper::HandleAccessibleAction(
+ const ui::AXActionData& action) {
+ if (action.action == ui::AX_ACTION_HIT_TEST) {
+ // For a hit test event, try to delegate to a widget, and if that
+ // fails fire the event directly.
+ views::Widget* widget = views::Widget::GetWidgetForNativeView(window_);
+ if (widget) {
+ AXAuraObjWrapper* widget_wrapper =
+ AXAuraObjCache::GetInstance()->GetOrCreate(widget);
+ if (widget_wrapper)
+ return widget_wrapper->HandleAccessibleAction(action);
+ }
+
+ AXAuraObjCache::GetInstance()->FireEvent(this,
+ action.hit_test_event_to_fire);
+ return true;
+ }
+
+ return false;
+}
+
void AXWindowObjWrapper::OnWindowDestroyed(aura::Window* window) {
AXAuraObjCache::GetInstance()->Remove(window, nullptr);
}
@@ -85,6 +107,8 @@ void AXWindowObjWrapper::OnWindowHierarchyChanged(
void AXWindowObjWrapper::OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
+ AXAuraObjCache::GetInstance()->FireEvent(this, ui::AX_EVENT_LOCATION_CHANGED);
+
Widget* widget = Widget::GetWidgetForNativeView(window);
if (widget) {
widget->GetRootView()->NotifyAccessibilityEvent(

Powered by Google App Engine
This is Rietveld 408576698