Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
ax_tree_data.h
Go to the documentation of this file.
1// Copyright 2015 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_DATA_H_
6#define UI_ACCESSIBILITY_AX_TREE_DATA_H_
7
8#include <cstdint>
9#include <map>
10#include <string>
11#include <vector>
12
13#include "ax_enums.h"
14#include "ax_export.h"
15#include "ax_node.h"
16#include "ax_tree_id_registry.h"
17
18namespace ui {
19
20// The data associated with an accessibility tree that's global to the
21// tree and not associated with any particular node in the tree.
23 AXTreeData();
24 AXTreeData(const AXTreeData& other);
25 virtual ~AXTreeData();
26
27 // Return a string representation of this data, for debugging.
28 virtual std::string ToString() const;
29
30 // This is a simple serializable struct. All member variables should be
31 // public and copyable.
32
33 // The globally unique ID of this accessibility tree.
35
36 // The ID of the accessibility tree that this tree is contained in, if any.
38
39 // The ID of the accessibility tree that has focus. This is typically set
40 // on the root frame in a frame tree.
42
43 // Attributes specific to trees that are web frames.
44 std::string doctype;
45 bool loaded = false;
46 float loading_progress = 0.0f;
47 std::string mimetype;
48 std::string title;
49 std::string url;
50
51 // The node with keyboard focus within this tree, if any, or
52 // AXNode::kInvalidAXID if no node in this tree has focus.
53 AXNode::AXID focus_id = AXNode::kInvalidAXID;
54
55 // The current text selection within this tree, if any, expressed as the
56 // node ID and character offset of the anchor (selection start) and focus
57 // (selection end). If the offset could correspond to a position on two
58 // different lines, sel_upstream_affinity means the cursor is on the first
59 // line, otherwise it's on the second line.
60 // Most use cases will want to use ui::OwnerTree::GetUnignoredSelection.
61 bool sel_is_backward = false;
62 AXNode::AXID sel_anchor_object_id = AXNode::kInvalidAXID;
63 int32_t sel_anchor_offset = -1;
65 AXNode::AXID sel_focus_object_id = AXNode::kInvalidAXID;
66 int32_t sel_focus_offset = -1;
68
69 // The node that's used as the root scroller. On some platforms
70 // like Android we need to ignore accessibility scroll offsets for
71 // that node and get them from the viewport instead.
72 AXNode::AXID root_scroller_id = AXNode::kInvalidAXID;
73};
74
75AX_EXPORT bool operator==(const AXTreeData& lhs, const AXTreeData& rhs);
76AX_EXPORT bool operator!=(const AXTreeData& lhs, const AXTreeData& rhs);
77
78} // namespace ui
79
80#endif // UI_ACCESSIBILITY_AX_TREE_DATA_H_
#define AX_EXPORT
Definition ax_export.h:29
int32_t AXID
Definition ax_node.h:36
bool operator==(const AXEventIntent &a, const AXEventIntent &b)
const char * ToString(ax::mojom::Event event)
bool operator!=(const AXEventIntent &a, const AXEventIntent &b)
std::string url
AXTreeID focused_tree_id
ax::mojom::TextAffinity sel_focus_affinity
std::string mimetype
std::string doctype
ax::mojom::TextAffinity sel_anchor_affinity
AXTreeID parent_tree_id
AXTreeData(const AXTreeData &other)
std::string title
AXTreeID tree_id
virtual ~AXTreeData()