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

Side by Side Diff: ui/accessibility/ax_node_data.cc

Issue 2217363002: Use relative bounding boxes throughout Chrome accessibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/accessibility/ax_node_data.h" 5 #include "ui/accessibility/ax_node_data.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 return std::find_if(vector.begin(), 53 return std::find_if(vector.begin(),
54 vector.end(), 54 vector.end(),
55 FirstIs<FirstType, SecondType>(first)); 55 FirstIs<FirstType, SecondType>(first));
56 } 56 }
57 57
58 } // namespace 58 } // namespace
59 59
60 AXNodeData::AXNodeData() 60 AXNodeData::AXNodeData()
61 : id(-1), 61 : id(-1),
62 role(AX_ROLE_UNKNOWN), 62 role(AX_ROLE_UNKNOWN),
63 state(0xFFFFFFFF) { 63 state(0xFFFFFFFF),
64 offset_container_id(-1) {
64 } 65 }
65 66
66 AXNodeData::~AXNodeData() { 67 AXNodeData::~AXNodeData() {
67 } 68 }
68 69
69 AXNodeData::AXNodeData(const AXNodeData& other) { 70 AXNodeData::AXNodeData(const AXNodeData& other) {
70 id = other.id; 71 id = other.id;
71 role = other.role; 72 role = other.role;
72 state = other.state; 73 state = other.state;
73 string_attributes = other.string_attributes; 74 string_attributes = other.string_attributes;
74 int_attributes = other.int_attributes; 75 int_attributes = other.int_attributes;
75 float_attributes = other.float_attributes; 76 float_attributes = other.float_attributes;
76 bool_attributes = other.bool_attributes; 77 bool_attributes = other.bool_attributes;
77 intlist_attributes = other.intlist_attributes; 78 intlist_attributes = other.intlist_attributes;
78 html_attributes = other.html_attributes; 79 html_attributes = other.html_attributes;
79 child_ids = other.child_ids; 80 child_ids = other.child_ids;
80 location = other.location; 81 location = other.location;
82 offset_container_id = other.offset_container_id;
81 if (other.transform) 83 if (other.transform)
82 transform.reset(new gfx::Transform(*other.transform)); 84 transform.reset(new gfx::Transform(*other.transform));
83 } 85 }
84 86
85 AXNodeData& AXNodeData::operator=(AXNodeData other) { 87 AXNodeData& AXNodeData::operator=(AXNodeData other) {
86 id = other.id; 88 id = other.id;
87 role = other.role; 89 role = other.role;
88 state = other.state; 90 state = other.state;
89 string_attributes = other.string_attributes; 91 string_attributes = other.string_attributes;
90 int_attributes = other.int_attributes; 92 int_attributes = other.int_attributes;
91 float_attributes = other.float_attributes; 93 float_attributes = other.float_attributes;
92 bool_attributes = other.bool_attributes; 94 bool_attributes = other.bool_attributes;
93 intlist_attributes = other.intlist_attributes; 95 intlist_attributes = other.intlist_attributes;
94 html_attributes = other.html_attributes; 96 html_attributes = other.html_attributes;
95 child_ids = other.child_ids; 97 child_ids = other.child_ids;
96 location = other.location; 98 location = other.location;
99 offset_container_id = other.offset_container_id;
97 if (other.transform) 100 if (other.transform)
98 transform.reset(new gfx::Transform(*other.transform)); 101 transform.reset(new gfx::Transform(*other.transform));
99 return *this; 102 return *this;
100 } 103 }
101 104
102 bool AXNodeData::HasBoolAttribute(AXBoolAttribute attribute) const { 105 bool AXNodeData::HasBoolAttribute(AXBoolAttribute attribute) const {
103 auto iter = FindInVectorOfPairs(attribute, bool_attributes); 106 auto iter = FindInVectorOfPairs(attribute, bool_attributes);
104 return iter != bool_attributes.end(); 107 return iter != bool_attributes.end();
105 } 108 }
106 109
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 if (state & (1 << AX_STATE_VERTICAL)) 339 if (state & (1 << AX_STATE_VERTICAL))
337 result += " VERTICAL"; 340 result += " VERTICAL";
338 if (state & (1 << AX_STATE_VISITED)) 341 if (state & (1 << AX_STATE_VISITED))
339 result += " VISITED"; 342 result += " VISITED";
340 343
341 result += " (" + IntToString(location.x()) + ", " + 344 result += " (" + IntToString(location.x()) + ", " +
342 IntToString(location.y()) + ")-(" + 345 IntToString(location.y()) + ")-(" +
343 IntToString(location.width()) + ", " + 346 IntToString(location.width()) + ", " +
344 IntToString(location.height()) + ")"; 347 IntToString(location.height()) + ")";
345 348
349 if (offset_container_id != -1)
350 result += " offset_container_id=" + IntToString(offset_container_id);
351
346 if (transform && !transform->IsIdentity()) 352 if (transform && !transform->IsIdentity())
347 result += " transform=" + transform->ToString(); 353 result += " transform=" + transform->ToString();
348 354
349 for (size_t i = 0; i < int_attributes.size(); ++i) { 355 for (size_t i = 0; i < int_attributes.size(); ++i) {
350 std::string value = IntToString(int_attributes[i].second); 356 std::string value = IntToString(int_attributes[i].second);
351 switch (int_attributes[i].first) { 357 switch (int_attributes[i].first) {
352 case AX_ATTR_SCROLL_X: 358 case AX_ATTR_SCROLL_X:
353 result += " scroll_x=" + value; 359 result += " scroll_x=" + value;
354 break; 360 break;
355 case AX_ATTR_SCROLL_X_MIN: 361 case AX_ATTR_SCROLL_X_MIN:
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 } 744 }
739 } 745 }
740 746
741 if (!child_ids.empty()) 747 if (!child_ids.empty())
742 result += " child_ids=" + IntVectorToString(child_ids); 748 result += " child_ids=" + IntVectorToString(child_ids);
743 749
744 return result; 750 return result;
745 } 751 }
746 752
747 } // namespace ui 753 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698