| OLD | NEW |
| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 NOTREACHED(); | 184 NOTREACHED(); |
| 185 return false; | 185 return false; |
| 186 } | 186 } |
| 187 | 187 |
| 188 AXNodeData::AXNodeData() | 188 AXNodeData::AXNodeData() |
| 189 : id(-1), | 189 : id(-1), |
| 190 role(AX_ROLE_UNKNOWN), | 190 role(AX_ROLE_UNKNOWN), |
| 191 state(AX_STATE_NONE), | 191 state(AX_STATE_NONE), |
| 192 actions(AX_ACTION_NONE), | 192 actions(AX_ACTION_NONE), |
| 193 offset_container_id(-1) {} | 193 offset_container_id(-1), |
| 194 is_fixed_positioned(false) {} |
| 194 | 195 |
| 195 AXNodeData::~AXNodeData() { | 196 AXNodeData::~AXNodeData() { |
| 196 } | 197 } |
| 197 | 198 |
| 198 AXNodeData::AXNodeData(const AXNodeData& other) { | 199 AXNodeData::AXNodeData(const AXNodeData& other) { |
| 199 id = other.id; | 200 id = other.id; |
| 200 role = other.role; | 201 role = other.role; |
| 201 state = other.state; | 202 state = other.state; |
| 202 actions = other.actions; | 203 actions = other.actions; |
| 203 string_attributes = other.string_attributes; | 204 string_attributes = other.string_attributes; |
| 204 int_attributes = other.int_attributes; | 205 int_attributes = other.int_attributes; |
| 205 float_attributes = other.float_attributes; | 206 float_attributes = other.float_attributes; |
| 206 bool_attributes = other.bool_attributes; | 207 bool_attributes = other.bool_attributes; |
| 207 intlist_attributes = other.intlist_attributes; | 208 intlist_attributes = other.intlist_attributes; |
| 208 html_attributes = other.html_attributes; | 209 html_attributes = other.html_attributes; |
| 209 child_ids = other.child_ids; | 210 child_ids = other.child_ids; |
| 210 location = other.location; | 211 location = other.location; |
| 211 offset_container_id = other.offset_container_id; | 212 offset_container_id = other.offset_container_id; |
| 212 if (other.transform) | 213 if (other.transform) |
| 213 transform.reset(new gfx::Transform(*other.transform)); | 214 transform.reset(new gfx::Transform(*other.transform)); |
| 215 is_fixed_positioned = other.is_fixed_positioned; |
| 214 } | 216 } |
| 215 | 217 |
| 216 AXNodeData& AXNodeData::operator=(AXNodeData other) { | 218 AXNodeData& AXNodeData::operator=(AXNodeData other) { |
| 217 id = other.id; | 219 id = other.id; |
| 218 role = other.role; | 220 role = other.role; |
| 219 state = other.state; | 221 state = other.state; |
| 220 actions = other.actions; | 222 actions = other.actions; |
| 221 string_attributes = other.string_attributes; | 223 string_attributes = other.string_attributes; |
| 222 int_attributes = other.int_attributes; | 224 int_attributes = other.int_attributes; |
| 223 float_attributes = other.float_attributes; | 225 float_attributes = other.float_attributes; |
| 224 bool_attributes = other.bool_attributes; | 226 bool_attributes = other.bool_attributes; |
| 225 intlist_attributes = other.intlist_attributes; | 227 intlist_attributes = other.intlist_attributes; |
| 226 html_attributes = other.html_attributes; | 228 html_attributes = other.html_attributes; |
| 227 child_ids = other.child_ids; | 229 child_ids = other.child_ids; |
| 228 location = other.location; | 230 location = other.location; |
| 229 offset_container_id = other.offset_container_id; | 231 offset_container_id = other.offset_container_id; |
| 230 if (other.transform) | 232 if (other.transform) |
| 231 transform.reset(new gfx::Transform(*other.transform)); | 233 transform.reset(new gfx::Transform(*other.transform)); |
| 232 else | 234 else |
| 233 transform.reset(nullptr); | 235 transform.reset(nullptr); |
| 236 is_fixed_positioned = other.is_fixed_positioned; |
| 234 return *this; | 237 return *this; |
| 235 } | 238 } |
| 236 | 239 |
| 237 bool AXNodeData::HasBoolAttribute(AXBoolAttribute attribute) const { | 240 bool AXNodeData::HasBoolAttribute(AXBoolAttribute attribute) const { |
| 238 auto iter = FindInVectorOfPairs(attribute, bool_attributes); | 241 auto iter = FindInVectorOfPairs(attribute, bool_attributes); |
| 239 return iter != bool_attributes.end(); | 242 return iter != bool_attributes.end(); |
| 240 } | 243 } |
| 241 | 244 |
| 242 bool AXNodeData::GetBoolAttribute(AXBoolAttribute attribute) const { | 245 bool AXNodeData::GetBoolAttribute(AXBoolAttribute attribute) const { |
| 243 bool result; | 246 bool result; |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 IntToString(location.y()) + ")-(" + | 510 IntToString(location.y()) + ")-(" + |
| 508 IntToString(location.width()) + ", " + | 511 IntToString(location.width()) + ", " + |
| 509 IntToString(location.height()) + ")"; | 512 IntToString(location.height()) + ")"; |
| 510 | 513 |
| 511 if (offset_container_id != -1) | 514 if (offset_container_id != -1) |
| 512 result += " offset_container_id=" + IntToString(offset_container_id); | 515 result += " offset_container_id=" + IntToString(offset_container_id); |
| 513 | 516 |
| 514 if (transform && !transform->IsIdentity()) | 517 if (transform && !transform->IsIdentity()) |
| 515 result += " transform=" + transform->ToString(); | 518 result += " transform=" + transform->ToString(); |
| 516 | 519 |
| 520 if (is_fixed_positioned) |
| 521 result += " is_fixed_positioned"; |
| 522 |
| 517 for (size_t i = 0; i < int_attributes.size(); ++i) { | 523 for (size_t i = 0; i < int_attributes.size(); ++i) { |
| 518 std::string value = IntToString(int_attributes[i].second); | 524 std::string value = IntToString(int_attributes[i].second); |
| 519 switch (int_attributes[i].first) { | 525 switch (int_attributes[i].first) { |
| 520 case AX_ATTR_DEFAULT_ACTION_VERB: | 526 case AX_ATTR_DEFAULT_ACTION_VERB: |
| 521 result += | 527 result += |
| 522 " action=" + | 528 " action=" + |
| 523 base::UTF16ToUTF8(ActionVerbToUnlocalizedString( | 529 base::UTF16ToUTF8(ActionVerbToUnlocalizedString( |
| 524 static_cast<AXDefaultActionVerb>(int_attributes[i].second))); | 530 static_cast<AXDefaultActionVerb>(int_attributes[i].second))); |
| 525 break; | 531 break; |
| 526 case AX_ATTR_SCROLL_X: | 532 case AX_ATTR_SCROLL_X: |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 | 971 |
| 966 result += " actions=" + ActionsBitfieldToString(actions); | 972 result += " actions=" + ActionsBitfieldToString(actions); |
| 967 | 973 |
| 968 if (!child_ids.empty()) | 974 if (!child_ids.empty()) |
| 969 result += " child_ids=" + IntVectorToString(child_ids); | 975 result += " child_ids=" + IntVectorToString(child_ids); |
| 970 | 976 |
| 971 return result; | 977 return result; |
| 972 } | 978 } |
| 973 | 979 |
| 974 } // namespace ui | 980 } // namespace ui |
| OLD | NEW |