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

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

Issue 2803823002: Fix Chrome OS virtual keyboard accessibility (Closed)
Patch Set: Rebase 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
« no previous file with comments | « ui/views/accessibility/ax_window_obj_wrapper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1bed99acaaf6200ee356c5cfb7312ea6d382fcba 100644
--- a/ui/views/accessibility/ax_window_obj_wrapper.cc
+++ b/ui/views/accessibility/ax_window_obj_wrapper.cc
@@ -54,12 +54,24 @@ 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);
- if (child_ax_tree_id != ui::AXTreeIDRegistry::kNoAXTreeID)
+ if (child_ax_tree_id != ui::AXTreeIDRegistry::kNoAXTreeID) {
+ // Most often, child AX trees are parented to Views. We need to handle
+ // the case where they're not here, but we don't want the same AX tree
+ // to be a child of two different parents.
+ //
+ // To avoid this double-parenting, only add the child tree ID of this
+ // window if the top-level window doesn't have an associated Widget.
+ if (!window_->GetToplevelWindow() ||
David Tseng 2017/04/27 23:03:12 What about this first case? Do we want to add the
dmazzoni 2017/04/27 23:20:15 I don't think that should ever happen for a legit
+ Widget::GetWidgetForNativeView(window_->GetToplevelWindow())) {
+ return;
+ }
+
out_node_data->AddIntAttribute(ui::AX_ATTR_CHILD_TREE_ID, child_ax_tree_id);
+ }
}
int32_t AXWindowObjWrapper::GetID() {
@@ -85,6 +97,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(
@@ -92,4 +106,13 @@ void AXWindowObjWrapper::OnWindowBoundsChanged(aura::Window* window,
}
}
+void AXWindowObjWrapper::OnWindowPropertyChanged(aura::Window* window,
+ const void* key,
+ intptr_t old) {
+ if (key == ui::kChildAXTreeID) {
+ AXAuraObjCache::GetInstance()->FireEvent(this,
David Tseng 2017/04/27 23:03:12 Is |this| always the wrapper for |window|?
dmazzoni 2017/04/27 23:20:15 Good catch, added check for window_ == window
+ ui::AX_EVENT_CHILDREN_CHANGED);
+ }
+}
+
} // namespace views
« no previous file with comments | « ui/views/accessibility/ax_window_obj_wrapper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698