22std::map<AXNode::AXID, TestAXNodeHelper*> g_node_id_to_helper_map;
26class TestAXTreeObserver :
public AXTreeObserver {
28 void OnNodeDeleted(AXTree* tree, int32_t node_id)
override {
29 const auto iter = g_node_id_to_helper_map.find(node_id);
30 if (iter != g_node_id_to_helper_map.end()) {
31 TestAXNodeHelper* helper = iter->second;
33 g_node_id_to_helper_map.erase(node_id);
38TestAXTreeObserver g_ax_tree_observer;
49 auto iter = g_node_id_to_helper_map.find(node->
id());
50 if (iter != g_node_id_to_helper_map.end())
53 g_node_id_to_helper_map[node->
id()] = helper;
57TestAXNodeHelper::TestAXNodeHelper(
AXTree* tree,
AXNode* node)
58 : tree_(tree), node_(node) {}
66 switch (coordinate_system) {
77 if (offscreen_result) {
78 *offscreen_result = DetermineOffscreenResult(
bounds);
91 const int start_offset,
96 switch (coordinate_system) {
107 bounds = GetInlineTextRect(start_offset, end_offset);
109 InternalChildCount() > 0) {
111 if (child !=
nullptr &&
113 bounds = child->GetInlineTextRect(start_offset, end_offset);
120 if (offscreen_result) {
121 *offscreen_result = DetermineOffscreenResult(
bounds);
133const AXNodeData& TestAXNodeHelper::GetData()
const {
134 return node_->
data();
137gfx::RectF TestAXNodeHelper::GetLocation()
const {
141int TestAXNodeHelper::InternalChildCount()
const {
145TestAXNodeHelper* TestAXNodeHelper::InternalGetChild(
int index)
const {
152gfx::RectF TestAXNodeHelper::GetInlineTextRect(
const int start_offset,
153 const int end_offset)
const {
154 BASE_DCHECK(start_offset >= 0 && end_offset >= 0 &&
155 start_offset <= end_offset);
166 int start_pixel_offset =
167 start_offset > 0 ? character_offsets[start_offset - 1] : location.
x();
168 int end_pixel_offset =
169 end_offset > 0 ? character_offsets[end_offset - 1] : location.
x();
172 end_pixel_offset - start_pixel_offset, location.
height());
183 if (!tree_ || !tree_->
root())
186 const AXNodeData& root_web_area_node_data = tree_->
root()->
data();
188 root_web_area_node_data.relative_bounds.bounds;
197 if (!root_web_area_bounds.
IsEmpty()) {
198 bounds.Intersect(root_web_area_bounds);
constexpr float y() const
constexpr float height() const
constexpr float x() const
size_t GetUnignoredChildCount() const
AXNode * GetUnignoredChildAtIndex(size_t index) const
const AXNodeData & data() const
void AddObserver(AXTreeObserver *observer)
bool HasObserver(AXTreeObserver *observer)
gfx::Rect GetBoundsRect(const AXCoordinateSystem coordinate_system, const AXClippingBehavior clipping_behavior, AXOffscreenResult *offscreen_result) const
gfx::Rect GetInnerTextRangeBoundsRect(const int start_offset, const int end_offset, const AXCoordinateSystem coordinate_system, const AXClippingBehavior clipping_behavior, AXOffscreenResult *offscreen_result) const
static TestAXNodeHelper * GetOrCreate(AXTree *tree, AXNode *node)
Optional< SkRect > bounds
Rect ToEnclosingRect(const RectF &r)
AXRelativeBounds relative_bounds
const std::vector< int32_t > & GetIntListAttribute(ax::mojom::IntListAttribute attribute) const
#define BASE_DCHECK(condition)
#define BASE_UNREACHABLE()
#define BASE_CHECK(condition)