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

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

Issue 2929673002: Add null check when reporting changed nodes to an AX tree. (Closed)
Patch Set: Simplest fix Created 3 years, 5 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 | « no previous file | ui/views/accessibility/ax_window_obj_wrapper.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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 272 }
273 return false; 273 return false;
274 } 274 }
275 275
276 if (delegate_) { 276 if (delegate_) {
277 std::set<AXNode*>& new_nodes = update_state.new_nodes; 277 std::set<AXNode*>& new_nodes = update_state.new_nodes;
278 std::vector<AXTreeDelegate::Change> changes; 278 std::vector<AXTreeDelegate::Change> changes;
279 changes.reserve(update.nodes.size()); 279 changes.reserve(update.nodes.size());
280 for (size_t i = 0; i < update.nodes.size(); ++i) { 280 for (size_t i = 0; i < update.nodes.size(); ++i) {
281 AXNode* node = GetFromId(update.nodes[i].id); 281 AXNode* node = GetFromId(update.nodes[i].id);
282 if (!node)
283 continue;
284
282 bool is_new_node = new_nodes.find(node) != new_nodes.end(); 285 bool is_new_node = new_nodes.find(node) != new_nodes.end();
283 bool is_reparented_node = 286 bool is_reparented_node =
284 is_new_node && update_state.HasRemovedNode(node); 287 is_new_node && update_state.HasRemovedNode(node);
285 288
286 AXTreeDelegate::ChangeType change = AXTreeDelegate::NODE_CHANGED; 289 AXTreeDelegate::ChangeType change = AXTreeDelegate::NODE_CHANGED;
287 if (is_new_node) { 290 if (is_new_node) {
288 if (is_reparented_node) { 291 if (is_reparented_node) {
289 // A reparented subtree is any new node whose parent either doesn't 292 // A reparented subtree is any new node whose parent either doesn't
290 // exist, or is not new. 293 // exist, or is not new.
291 bool is_subtree = !node->parent() || 294 bool is_subtree = !node->parent() ||
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 update_state->pending_nodes.insert(child); 555 update_state->pending_nodes.insert(child);
553 update_state->new_nodes.insert(child); 556 update_state->new_nodes.insert(child);
554 } 557 }
555 new_children->push_back(child); 558 new_children->push_back(child);
556 } 559 }
557 560
558 return success; 561 return success;
559 } 562 }
560 563
561 } // namespace ui 564 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/views/accessibility/ax_window_obj_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698