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

Side by Side Diff: ui/accessibility/ax_tree.cc

Issue 2917363002: Automatically fire AX events on Mac based on tree changes (Closed)
Patch Set: Fix accidental shadowing of BrowserAccessibilityManager::OnAtomicUpdateFinished, caught by browser … Created 3 years, 6 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
« no previous file with comments | « ui/accessibility/ax_tree.h ('k') | ui/accessibility/ax_tree_fuzzer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/accessibility/ax_tree.h" 5 #include "ui/accessibility/ax_tree.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 void AXTree::SetDelegate(AXTreeDelegate* delegate) { 148 void AXTree::SetDelegate(AXTreeDelegate* delegate) {
149 delegate_ = delegate; 149 delegate_ = delegate;
150 } 150 }
151 151
152 AXNode* AXTree::GetFromId(int32_t id) const { 152 AXNode* AXTree::GetFromId(int32_t id) const {
153 base::hash_map<int32_t, AXNode*>::const_iterator iter = id_map_.find(id); 153 base::hash_map<int32_t, AXNode*>::const_iterator iter = id_map_.find(id);
154 return iter != id_map_.end() ? iter->second : NULL; 154 return iter != id_map_.end() ? iter->second : NULL;
155 } 155 }
156 156
157 void AXTree::UpdateData(const AXTreeData& data) { 157 void AXTree::UpdateData(const AXTreeData& new_data) {
158 data_ = data; 158 if (data_ == new_data)
159 return;
160
161 AXTreeData old_data = data_;
162 data_ = new_data;
159 if (delegate_) 163 if (delegate_)
160 delegate_->OnTreeDataChanged(this); 164 delegate_->OnTreeDataChanged(this, old_data, new_data);
161 } 165 }
162 166
163 bool AXTree::Unserialize(const AXTreeUpdate& update) { 167 bool AXTree::Unserialize(const AXTreeUpdate& update) {
164 AXTreeUpdateState update_state; 168 AXTreeUpdateState update_state;
165 int32_t old_root_id = root_ ? root_->id() : 0; 169 int32_t old_root_id = root_ ? root_->id() : 0;
166 170
167 // First, make a note of any nodes we will touch as part of this update. 171 // First, make a note of any nodes we will touch as part of this update.
168 for (size_t i = 0; i < update.nodes.size(); ++i) 172 for (size_t i = 0; i < update.nodes.size(); ++i)
169 update_state.changed_node_ids.insert(update.nodes[i].id); 173 update_state.changed_node_ids.insert(update.nodes[i].id);
170 174
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 update_state->pending_nodes.insert(child); 497 update_state->pending_nodes.insert(child);
494 update_state->new_nodes.insert(child); 498 update_state->new_nodes.insert(child);
495 } 499 }
496 new_children->push_back(child); 500 new_children->push_back(child);
497 } 501 }
498 502
499 return success; 503 return success;
500 } 504 }
501 505
502 } // namespace ui 506 } // namespace ui
OLDNEW
« no previous file with comments | « ui/accessibility/ax_tree.h ('k') | ui/accessibility/ax_tree_fuzzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698