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

Side by Side Diff: ui/accessibility/ax_tree_serializer.h

Issue 260463003: No need to delete ax subtree when new node is added. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« 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 #ifndef UI_ACCESSIBILITY_AX_TREE_SERIALIZER_H_ 5 #ifndef UI_ACCESSIBILITY_AX_TREE_SERIALIZER_H_
6 #define UI_ACCESSIBILITY_AX_TREE_SERIALIZER_H_ 6 #define UI_ACCESSIBILITY_AX_TREE_SERIALIZER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 template<typename AXSourceNode> 287 template<typename AXSourceNode>
288 void AXTreeSerializer<AXSourceNode>::SerializeChanges( 288 void AXTreeSerializer<AXSourceNode>::SerializeChanges(
289 AXSourceNode node, 289 AXSourceNode node,
290 AXTreeUpdate* out_update) { 290 AXTreeUpdate* out_update) {
291 // If the node isn't in the client tree, we need to serialize starting 291 // If the node isn't in the client tree, we need to serialize starting
292 // with the LCA. 292 // with the LCA.
293 AXSourceNode lca = LeastCommonAncestor(node); 293 AXSourceNode lca = LeastCommonAncestor(node);
294 294
295 if (client_root_) { 295 if (client_root_) {
296 // If the LCA is anything other than the node itself, tell the 296 bool need_delete = false;
297 // client to first delete the subtree rooted at the LCA.
298 bool need_delete = !tree_->IsEqual(lca, node);
299 if (tree_->IsValid(lca)) { 297 if (tree_->IsValid(lca)) {
300 // Check for any reparenting within this subtree - if there is 298 // Check for any reparenting within this subtree - if there is
301 // any, we need to delete and reserialize the whole subtree 299 // any, we need to delete and reserialize the whole subtree
302 // that contains the old and new parents of the reparented node. 300 // that contains the old and new parents of the reparented node.
303 if (AnyDescendantWasReparented(lca, &lca)) 301 if (AnyDescendantWasReparented(lca, &lca))
304 need_delete = true; 302 need_delete = true;
305 } 303 }
306 304
307 if (!tree_->IsValid(lca)) { 305 if (!tree_->IsValid(lca)) {
308 // If there's no LCA, just tell the client to destroy the whole 306 // If there's no LCA, just tell the client to destroy the whole
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 } 451 }
454 452
455 // Serialize all of the new children, recursively. 453 // Serialize all of the new children, recursively.
456 for (size_t i = 0; i < children_to_serialize.size(); ++i) 454 for (size_t i = 0; i < children_to_serialize.size(); ++i)
457 SerializeChangedNodes(children_to_serialize[i], out_update); 455 SerializeChangedNodes(children_to_serialize[i], out_update);
458 } 456 }
459 457
460 } // namespace ui 458 } // namespace ui
461 459
462 #endif // UI_ACCESSIBILITY_AX_TREE_SERIALIZER_H_ 460 #endif // UI_ACCESSIBILITY_AX_TREE_SERIALIZER_H_
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