| Index: ui/accessibility/ax_tree_update.h
|
| diff --git a/ui/accessibility/ax_tree_update.h b/ui/accessibility/ax_tree_update.h
|
| index 7fd94ec498ee9077ffbfdc181518cec51540c23b..c7d272fe10f2495f1df41ee89fad3bd32014929f 100644
|
| --- a/ui/accessibility/ax_tree_update.h
|
| +++ b/ui/accessibility/ax_tree_update.h
|
| @@ -10,6 +10,7 @@
|
|
|
| #include "base/strings/string_number_conversions.h"
|
| #include "ui/accessibility/ax_node_data.h"
|
| +#include "ui/accessibility/ax_tree_data.h"
|
|
|
| namespace ui {
|
|
|
| @@ -21,8 +22,9 @@ namespace ui {
|
| //
|
| // 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.
|
| +// followed by an ordered vector of zero or more AXNodeData structures to
|
| +// be applied to the tree in order. An update may also include an optional
|
| +// update to the AXTreeData structure that applies to the tree as a whole.
|
| //
|
| // Suppose that the next AXNodeData to be applied is |node|. The following
|
| // invariants must hold:
|
| @@ -38,9 +40,14 @@ namespace ui {
|
| // placeholder must be updated within the same AXTreeUpdate, otherwise
|
| // it's a fatal error. This guarantees the tree is always complete
|
| // before or after an AXTreeUpdate.
|
| -template<typename AXNodeData> struct AXTreeUpdate {
|
| - AXTreeUpdate();
|
| - ~AXTreeUpdate();
|
| +template<typename AXNodeData, typename AXTreeData> struct AXTreeUpdateBase {
|
| + AXTreeUpdateBase();
|
| + ~AXTreeUpdateBase();
|
| +
|
| + // If |has_tree_data| is true, the value of |tree_data| should be used
|
| + // to update the tree data, otherwise it should be ignored.
|
| + bool has_tree_data;
|
| + AXTreeData tree_data;
|
|
|
| // The id of a node to clear, before applying any updates,
|
| // or 0 if no nodes should be cleared. Clearing a node means deleting
|
| @@ -58,17 +65,26 @@ template<typename AXNodeData> struct AXTreeUpdate {
|
| // TODO(dmazzoni): location changes
|
| };
|
|
|
| -template<typename AXNodeData>
|
| -AXTreeUpdate<AXNodeData>::AXTreeUpdate() : node_id_to_clear(0) {
|
| +typedef AXTreeUpdateBase<AXNodeData, AXTreeData> AXTreeUpdate;
|
| +
|
| +template<typename AXNodeData, typename AXTreeData>
|
| +AXTreeUpdateBase<AXNodeData, AXTreeData>::AXTreeUpdateBase()
|
| + : has_tree_data(false),
|
| + node_id_to_clear(0) {
|
| }
|
|
|
| -template<typename AXNodeData>
|
| -AXTreeUpdate<AXNodeData>::~AXTreeUpdate() {
|
| +template<typename AXNodeData, typename AXTreeData>
|
| +AXTreeUpdateBase<AXNodeData, AXTreeData>::~AXTreeUpdateBase() {
|
| }
|
|
|
| -template<typename AXNodeData>
|
| -std::string AXTreeUpdate<AXNodeData>::ToString() const {
|
| +template<typename AXNodeData, typename AXTreeData>
|
| +std::string AXTreeUpdateBase<AXNodeData, AXTreeData>::ToString() const {
|
| std::string result;
|
| +
|
| + if (has_tree_data) {
|
| + result += "AXTreeUpdate tree data:" + tree_data.ToString();
|
| + }
|
| +
|
| if (node_id_to_clear != 0) {
|
| result += "AXTreeUpdate: clear node " +
|
| base::IntToString(node_id_to_clear) + "\n";
|
|
|