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

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: 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 | « no previous file | no next file » | 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 213 }
214 return false; 214 return false;
215 } 215 }
216 216
217 if (delegate_) { 217 if (delegate_) {
218 std::set<AXNode*>& new_nodes = update_state.new_nodes; 218 std::set<AXNode*>& new_nodes = update_state.new_nodes;
219 std::vector<AXTreeDelegate::Change> changes; 219 std::vector<AXTreeDelegate::Change> changes;
220 changes.reserve(update.nodes.size()); 220 changes.reserve(update.nodes.size());
221 for (size_t i = 0; i < update.nodes.size(); ++i) { 221 for (size_t i = 0; i < update.nodes.size(); ++i) {
222 AXNode* node = GetFromId(update.nodes[i].id); 222 AXNode* node = GetFromId(update.nodes[i].id);
223 if (!node)
David Tseng 2017/06/07 23:24:24 At this point, I would have expected there to be p
dmazzoni 2017/06/19 17:12:24 Imagine that B's parent is A, but B is invisible s
224 continue;
225
223 bool is_new_node = new_nodes.find(node) != new_nodes.end(); 226 bool is_new_node = new_nodes.find(node) != new_nodes.end();
224 bool is_reparented_node = 227 bool is_reparented_node =
225 is_new_node && update_state.HasRemovedNode(node); 228 is_new_node && update_state.HasRemovedNode(node);
226 229
227 AXTreeDelegate::ChangeType change = AXTreeDelegate::NODE_CHANGED; 230 AXTreeDelegate::ChangeType change = AXTreeDelegate::NODE_CHANGED;
228 if (is_new_node) { 231 if (is_new_node) {
229 if (is_reparented_node) { 232 if (is_reparented_node) {
230 // A reparented subtree is any new node whose parent either doesn't 233 // A reparented subtree is any new node whose parent either doesn't
231 // exist, or is not new. 234 // exist, or is not new.
232 bool is_subtree = !node->parent() || 235 bool is_subtree = !node->parent() ||
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 update_state->pending_nodes.insert(child); 496 update_state->pending_nodes.insert(child);
494 update_state->new_nodes.insert(child); 497 update_state->new_nodes.insert(child);
495 } 498 }
496 new_children->push_back(child); 499 new_children->push_back(child);
497 } 500 }
498 501
499 return success; 502 return success;
500 } 503 }
501 504
502 } // namespace ui 505 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698