OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_ACCESSIBILITY_AX_TREE_UPDATE_H_ |
| 6 #define UI_ACCESSIBILITY_AX_TREE_UPDATE_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "ui/accessibility/ax_node_data.h" |
| 11 |
| 12 namespace ui { |
| 13 |
| 14 // An AXTreeUpdate is a serialized representation of an atomic change |
| 15 // to an AXTree. The sender and receiver must be in sync; the update |
| 16 // is only meant to bring the tree from a specific previous state into |
| 17 // its next state. Trying to apply it to the wrong tree should immediately |
| 18 // die with a fatal assertion. An AXTreeUpdate is just an ordered vector |
| 19 // of AXNodeData structures to be applied to the tree in order. |
| 20 // |
| 21 // Suppose that the next AXNodeData to be applied is |node|. The following |
| 22 // invariants must hold: |
| 23 // 1. Either |node.id| is already in the tree, or else |node| is the new |
| 24 // root of the tree and |node.role| == WebAXRoleRootWebArea. |
| 25 // 2. Every child id in |node.child_ids| must either be already a child |
| 26 // of this node, or a new id not previously in the tree. It is not |
| 27 // allowed to "reparent" a child to this node without first removing |
| 28 // that child from its previous parent. |
| 29 // 3. When a new id appears in |node.child_ids|, the tree should create a |
| 30 // new uninitialized placeholder node for it immediately. That |
| 31 // placeholder must be updated within the same AXTreeUpdate, otherwise |
| 32 // it's a fatal error. This guarantees the tree is always complete |
| 33 // before or after an AXTreeUpdate. |
| 34 struct AX_EXPORT AXTreeUpdate { |
| 35 AXTreeUpdate(); |
| 36 ~AXTreeUpdate(); |
| 37 |
| 38 std::vector<AXNodeData> nodes; |
| 39 |
| 40 // TODO(dmazzoni): location changes |
| 41 }; |
| 42 |
| 43 } // namespace ui |
| 44 |
| 45 #endif // UI_ACCESSIBILITY_AX_TREE_UPDATE_H_ |
OLD | NEW |