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

Side by Side Diff: ui/views/accessibility/ax_window_obj_wrapper.cc

Issue 2860883003: A11y: Add/refactor methods for manipulating bitfields on AXNodeData. (Closed)
Patch Set: Delete AXNodeData::Init() and clear bitfields in AXNodeData() instead. Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/accessibility/ax_window_obj_wrapper.h" 5 #include "ui/views/accessibility/ax_window_obj_wrapper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "ui/accessibility/ax_node_data.h" 10 #include "ui/accessibility/ax_node_data.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 Widget* widget = Widget::GetWidgetForNativeView(window_); 46 Widget* widget = Widget::GetWidgetForNativeView(window_);
47 if (widget && widget->IsVisible()) 47 if (widget && widget->IsVisible())
48 out_children->push_back(AXAuraObjCache::GetInstance()->GetOrCreate(widget)); 48 out_children->push_back(AXAuraObjCache::GetInstance()->GetOrCreate(widget));
49 } 49 }
50 50
51 void AXWindowObjWrapper::Serialize(ui::AXNodeData* out_node_data) { 51 void AXWindowObjWrapper::Serialize(ui::AXNodeData* out_node_data) {
52 out_node_data->id = GetID(); 52 out_node_data->id = GetID();
53 out_node_data->role = is_alert_ ? ui::AX_ROLE_ALERT : ui::AX_ROLE_WINDOW; 53 out_node_data->role = is_alert_ ? ui::AX_ROLE_ALERT : ui::AX_ROLE_WINDOW;
54 out_node_data->AddStringAttribute(ui::AX_ATTR_NAME, 54 out_node_data->AddStringAttribute(ui::AX_ATTR_NAME,
55 base::UTF16ToUTF8(window_->GetTitle())); 55 base::UTF16ToUTF8(window_->GetTitle()));
56 out_node_data->state = 0;
57 out_node_data->location = gfx::RectF(window_->GetBoundsInScreen()); 56 out_node_data->location = gfx::RectF(window_->GetBoundsInScreen());
58 57
59 ui::AXTreeIDRegistry::AXTreeID child_ax_tree_id = 58 ui::AXTreeIDRegistry::AXTreeID child_ax_tree_id =
60 window_->GetProperty(ui::kChildAXTreeID); 59 window_->GetProperty(ui::kChildAXTreeID);
61 if (child_ax_tree_id != ui::AXTreeIDRegistry::kNoAXTreeID) { 60 if (child_ax_tree_id != ui::AXTreeIDRegistry::kNoAXTreeID) {
62 // Most often, child AX trees are parented to Views. We need to handle 61 // Most often, child AX trees are parented to Views. We need to handle
63 // the case where they're not here, but we don't want the same AX tree 62 // the case where they're not here, but we don't want the same AX tree
64 // to be a child of two different parents. 63 // to be a child of two different parents.
65 // 64 //
66 // To avoid this double-parenting, only add the child tree ID of this 65 // To avoid this double-parenting, only add the child tree ID of this
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 void AXWindowObjWrapper::OnWindowPropertyChanged(aura::Window* window, 111 void AXWindowObjWrapper::OnWindowPropertyChanged(aura::Window* window,
113 const void* key, 112 const void* key,
114 intptr_t old) { 113 intptr_t old) {
115 if (window == window_ && key == ui::kChildAXTreeID) { 114 if (window == window_ && key == ui::kChildAXTreeID) {
116 AXAuraObjCache::GetInstance()->FireEvent(this, 115 AXAuraObjCache::GetInstance()->FireEvent(this,
117 ui::AX_EVENT_CHILDREN_CHANGED); 116 ui::AX_EVENT_CHILDREN_CHANGED);
118 } 117 }
119 } 118 }
120 119
121 } // namespace views 120 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698