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

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: Address feedback from aboxhall 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
« no previous file with comments | « ui/accessibility/ax_node_data.h ('k') | ui/accessibility/ax_relative_bounds.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
102 else
103 transform.reset(nullptr);
99 return *this; 104 return *this;
100 } 105 }
101 106
102 bool AXNodeData::HasBoolAttribute(AXBoolAttribute attribute) const { 107 bool AXNodeData::HasBoolAttribute(AXBoolAttribute attribute) const {
103 auto iter = FindInVectorOfPairs(attribute, bool_attributes); 108 auto iter = FindInVectorOfPairs(attribute, bool_attributes);
104 return iter != bool_attributes.end(); 109 return iter != bool_attributes.end();
105 } 110 }
106 111
107 bool AXNodeData::GetBoolAttribute(AXBoolAttribute attribute) const { 112 bool AXNodeData::GetBoolAttribute(AXBoolAttribute attribute) const {
108 bool result; 113 bool result;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 if (state & (1 << AX_STATE_VERTICAL)) 341 if (state & (1 << AX_STATE_VERTICAL))
337 result += " VERTICAL"; 342 result += " VERTICAL";
338 if (state & (1 << AX_STATE_VISITED)) 343 if (state & (1 << AX_STATE_VISITED))
339 result += " VISITED"; 344 result += " VISITED";
340 345
341 result += " (" + IntToString(location.x()) + ", " + 346 result += " (" + IntToString(location.x()) + ", " +
342 IntToString(location.y()) + ")-(" + 347 IntToString(location.y()) + ")-(" +
343 IntToString(location.width()) + ", " + 348 IntToString(location.width()) + ", " +
344 IntToString(location.height()) + ")"; 349 IntToString(location.height()) + ")";
345 350
351 if (offset_container_id != -1)
352 result += " offset_container_id=" + IntToString(offset_container_id);
353
346 if (transform && !transform->IsIdentity()) 354 if (transform && !transform->IsIdentity())
347 result += " transform=" + transform->ToString(); 355 result += " transform=" + transform->ToString();
348 356
349 for (size_t i = 0; i < int_attributes.size(); ++i) { 357 for (size_t i = 0; i < int_attributes.size(); ++i) {
350 std::string value = IntToString(int_attributes[i].second); 358 std::string value = IntToString(int_attributes[i].second);
351 switch (int_attributes[i].first) { 359 switch (int_attributes[i].first) {
352 case AX_ATTR_SCROLL_X: 360 case AX_ATTR_SCROLL_X:
353 result += " scroll_x=" + value; 361 result += " scroll_x=" + value;
354 break; 362 break;
355 case AX_ATTR_SCROLL_X_MIN: 363 case AX_ATTR_SCROLL_X_MIN:
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 } 746 }
739 } 747 }
740 748
741 if (!child_ids.empty()) 749 if (!child_ids.empty())
742 result += " child_ids=" + IntVectorToString(child_ids); 750 result += " child_ids=" + IntVectorToString(child_ids);
743 751
744 return result; 752 return result;
745 } 753 }
746 754
747 } // namespace ui 755 } // namespace ui
OLDNEW
« no previous file with comments | « ui/accessibility/ax_node_data.h ('k') | ui/accessibility/ax_relative_bounds.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698