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

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

Issue 1156503007: Merge to M44: An accessibility tree update with two roots should be rejected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2403
Patch Set: Created 5 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 | ui/accessibility/ax_tree.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 #ifndef UI_ACCESSIBILITY_AX_TREE_H_ 5 #ifndef UI_ACCESSIBILITY_AX_TREE_H_
6 #define UI_ACCESSIBILITY_AX_TREE_H_ 6 #define UI_ACCESSIBILITY_AX_TREE_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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 private: 113 private:
114 AXNode* CreateNode(AXNode* parent, int32 id, int32 index_in_parent); 114 AXNode* CreateNode(AXNode* parent, int32 id, int32 index_in_parent);
115 115
116 // This is called from within Unserialize(), it returns true on success. 116 // This is called from within Unserialize(), it returns true on success.
117 bool UpdateNode(const AXNodeData& src, AXTreeUpdateState* update_state); 117 bool UpdateNode(const AXNodeData& src, AXTreeUpdateState* update_state);
118 118
119 void OnRootChanged(); 119 void OnRootChanged();
120 120
121 // Notify the delegate that the subtree rooted at |node| will be destroyed, 121 // Notify the delegate that the subtree rooted at |node| will be destroyed,
122 // then call DestroyNodeAndSubtree on it. 122 // then call DestroyNodeAndSubtree on it.
123 void DestroySubtree(AXNode* node); 123 void DestroySubtree(AXNode* node, AXTreeUpdateState* update_state);
124 124
125 // Call Destroy() on |node|, and delete it from the id map, and then 125 // Call Destroy() on |node|, and delete it from the id map, and then
126 // call recursively on all nodes in its subtree. 126 // call recursively on all nodes in its subtree.
127 void DestroyNodeAndSubtree(AXNode* node); 127 void DestroyNodeAndSubtree(AXNode* node, AXTreeUpdateState* update_state);
128 128
129 // Iterate over the children of |node| and for each child, destroy the 129 // Iterate over the children of |node| and for each child, destroy the
130 // child and its subtree if its id is not in |new_child_ids|. Returns 130 // child and its subtree if its id is not in |new_child_ids|. Returns
131 // true on success, false on fatal error. 131 // true on success, false on fatal error.
132 bool DeleteOldChildren(AXNode* node, 132 bool DeleteOldChildren(AXNode* node,
133 const std::vector<int32>& new_child_ids); 133 const std::vector<int32>& new_child_ids,
134 AXTreeUpdateState* update_state);
134 135
135 // Iterate over |new_child_ids| and populate |new_children| with 136 // Iterate over |new_child_ids| and populate |new_children| with
136 // pointers to child nodes, reusing existing nodes already in the tree 137 // pointers to child nodes, reusing existing nodes already in the tree
137 // if they exist, and creating otherwise. Reparenting is disallowed, so 138 // if they exist, and creating otherwise. Reparenting is disallowed, so
138 // if the id already exists as the child of another node, that's an 139 // if the id already exists as the child of another node, that's an
139 // error. Returns true on success, false on fatal error. 140 // error. Returns true on success, false on fatal error.
140 bool CreateNewChildVector(AXNode* node, 141 bool CreateNewChildVector(AXNode* node,
141 const std::vector<int32>& new_child_ids, 142 const std::vector<int32>& new_child_ids,
142 std::vector<AXNode*>* new_children, 143 std::vector<AXNode*>* new_children,
143 AXTreeUpdateState* update_state); 144 AXTreeUpdateState* update_state);
144 145
145 AXTreeDelegate* delegate_; 146 AXTreeDelegate* delegate_;
146 AXNode* root_; 147 AXNode* root_;
147 base::hash_map<int32, AXNode*> id_map_; 148 base::hash_map<int32, AXNode*> id_map_;
148 std::string error_; 149 std::string error_;
149 }; 150 };
150 151
151 } // namespace ui 152 } // namespace ui
152 153
153 #endif // UI_ACCESSIBILITY_AX_TREE_H_ 154 #endif // UI_ACCESSIBILITY_AX_TREE_H_
OLDNEW
« no previous file with comments | « no previous file | ui/accessibility/ax_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698