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

Unified Diff: ui/accessibility/ax_tree_update.h

Issue 90853002: Make tree serialization more robust and add more unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ui/accessibility/ax_tree_update.h
diff --git a/ui/accessibility/ax_tree_update.h b/ui/accessibility/ax_tree_update.h
index 0599821afc9acd17832db57aec67bebc0b7a990b..0280efe64490e1118c1f80d0f2c82c4bebf619dc 100644
--- a/ui/accessibility/ax_tree_update.h
+++ b/ui/accessibility/ax_tree_update.h
@@ -15,13 +15,18 @@ namespace ui {
// to an AXTree. The sender and receiver must be in sync; the update
// is only meant to bring the tree from a specific previous state into
// its next state. Trying to apply it to the wrong tree should immediately
-// die with a fatal assertion. An AXTreeUpdate is just an ordered vector
-// of AXNodeData structures to be applied to the tree in order.
+// die with a fatal assertion.
+//
+// An AXTreeUpdate consists of an optional node id to clear (meaning
+// that all of that node's children and their descendants are deleted),
+// followed by an ordered vector of AXNodeData structures to be applied
+// to the tree in order.
//
// Suppose that the next AXNodeData to be applied is |node|. The following
// invariants must hold:
-// 1. Either |node.id| is already in the tree, or else |node| is the new
-// root of the tree and |node.role| == WebAXRoleRootWebArea.
+// 1. Either |node.id| is already in the tree, or else the tree is empty,
+// |node| is the new root of the tree, and
+// |node.role| == WebAXRoleRootWebArea.
// 2. Every child id in |node.child_ids| must either be already a child
// of this node, or a new id not previously in the tree. It is not
// allowed to "reparent" a child to this node without first removing
@@ -35,6 +40,14 @@ struct AX_EXPORT AXTreeUpdate {
AXTreeUpdate();
~AXTreeUpdate();
+ // The id of a node to clear, before applying any updates,
+ // or 0 if no nodes should be cleared. Clearing a node means deleting
+ // all of its children and their descendants, but leaving that node in
+ // the tree. It's an error to clear a node but not subsequently update it
+ // as part of the tree update.
+ int node_id_to_clear;
+
+ // A vector of nodes to update, according to the rules above.
std::vector<AXNodeData> nodes;
// TODO(dmazzoni): location changes

Powered by Google App Engine
This is Rietveld 408576698