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

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

Issue 2377443002: Fix another bug in AXTree caught by libfuzzer (Closed)
Patch Set: Created 4 years, 2 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 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 delegate_->OnNodeChanged(this, node); 241 delegate_->OnNodeChanged(this, node);
242 242
243 // First, delete nodes that used to be children of this node but aren't 243 // First, delete nodes that used to be children of this node but aren't
244 // anymore. 244 // anymore.
245 if (!DeleteOldChildren(node, src.child_ids, update_state)) { 245 if (!DeleteOldChildren(node, src.child_ids, update_state)) {
246 if (update_state->new_root) { 246 if (update_state->new_root) {
247 AXNode* old_root = root_; 247 AXNode* old_root = root_;
248 root_ = nullptr; 248 root_ = nullptr;
249 249
250 DestroySubtree(old_root, update_state); 250 DestroySubtree(old_root, update_state);
251 if (node != old_root && 251 if (update_state->removed_node_ids.find(src.id) ==
aboxhall 2016/09/26 20:24:44 Why is this no longer necessary?
dmazzoni 2016/09/27 20:19:26 See next comment
aboxhall 2016/09/26 20:24:44 Can you describe what this is doing in more detail
dmazzoni 2016/09/27 20:19:26 Updated change description and added comments to c
252 update_state->removed_node_ids.end() &&
252 update_state->new_nodes.find(node) != update_state->new_nodes.end()) { 253 update_state->new_nodes.find(node) != update_state->new_nodes.end()) {
253 DestroySubtree(node, update_state); 254 DestroySubtree(node, update_state);
254 } 255 }
255 } 256 }
256 return false; 257 return false;
257 } 258 }
258 259
259 // Now build a new children vector, reusing nodes when possible, 260 // Now build a new children vector, reusing nodes when possible,
260 // and swap it in. 261 // and swap it in.
261 std::vector<AXNode*> new_children; 262 std::vector<AXNode*> new_children;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 update_state->pending_nodes.insert(child); 361 update_state->pending_nodes.insert(child);
361 update_state->new_nodes.insert(child); 362 update_state->new_nodes.insert(child);
362 } 363 }
363 new_children->push_back(child); 364 new_children->push_back(child);
364 } 365 }
365 366
366 return success; 367 return success;
367 } 368 }
368 369
369 } // namespace ui 370 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/accessibility/ax_tree_unittest.cc » ('j') | ui/accessibility/ax_tree_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698