| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 NOTREACHED(); | 195 NOTREACHED(); |
| 196 return false; | 196 return false; |
| 197 } | 197 } |
| 198 | 198 |
| 199 AXNodeData::AXNodeData() | 199 AXNodeData::AXNodeData() |
| 200 : id(-1), | 200 : id(-1), |
| 201 role(AX_ROLE_UNKNOWN), | 201 role(AX_ROLE_UNKNOWN), |
| 202 state(AX_STATE_NONE), | 202 state(AX_STATE_NONE), |
| 203 actions(AX_ACTION_NONE), | 203 actions(AX_ACTION_NONE), |
| 204 offset_container_id(-1) {} | 204 offset_container_id(-1), |
| 205 is_fixed_positioned(false) {} |
| 205 | 206 |
| 206 AXNodeData::~AXNodeData() { | 207 AXNodeData::~AXNodeData() { |
| 207 } | 208 } |
| 208 | 209 |
| 209 AXNodeData::AXNodeData(const AXNodeData& other) { | 210 AXNodeData::AXNodeData(const AXNodeData& other) { |
| 210 id = other.id; | 211 id = other.id; |
| 211 role = other.role; | 212 role = other.role; |
| 212 state = other.state; | 213 state = other.state; |
| 213 actions = other.actions; | 214 actions = other.actions; |
| 214 string_attributes = other.string_attributes; | 215 string_attributes = other.string_attributes; |
| 215 int_attributes = other.int_attributes; | 216 int_attributes = other.int_attributes; |
| 216 float_attributes = other.float_attributes; | 217 float_attributes = other.float_attributes; |
| 217 bool_attributes = other.bool_attributes; | 218 bool_attributes = other.bool_attributes; |
| 218 intlist_attributes = other.intlist_attributes; | 219 intlist_attributes = other.intlist_attributes; |
| 219 stringlist_attributes = other.stringlist_attributes; | 220 stringlist_attributes = other.stringlist_attributes; |
| 220 html_attributes = other.html_attributes; | 221 html_attributes = other.html_attributes; |
| 221 child_ids = other.child_ids; | 222 child_ids = other.child_ids; |
| 222 location = other.location; | 223 location = other.location; |
| 223 offset_container_id = other.offset_container_id; | 224 offset_container_id = other.offset_container_id; |
| 224 if (other.transform) | 225 if (other.transform) |
| 225 transform.reset(new gfx::Transform(*other.transform)); | 226 transform.reset(new gfx::Transform(*other.transform)); |
| 227 is_fixed_positioned = other.is_fixed_positioned; |
| 226 } | 228 } |
| 227 | 229 |
| 228 AXNodeData& AXNodeData::operator=(AXNodeData other) { | 230 AXNodeData& AXNodeData::operator=(AXNodeData other) { |
| 229 id = other.id; | 231 id = other.id; |
| 230 role = other.role; | 232 role = other.role; |
| 231 state = other.state; | 233 state = other.state; |
| 232 actions = other.actions; | 234 actions = other.actions; |
| 233 string_attributes = other.string_attributes; | 235 string_attributes = other.string_attributes; |
| 234 int_attributes = other.int_attributes; | 236 int_attributes = other.int_attributes; |
| 235 float_attributes = other.float_attributes; | 237 float_attributes = other.float_attributes; |
| 236 bool_attributes = other.bool_attributes; | 238 bool_attributes = other.bool_attributes; |
| 237 intlist_attributes = other.intlist_attributes; | 239 intlist_attributes = other.intlist_attributes; |
| 238 stringlist_attributes = other.stringlist_attributes; | 240 stringlist_attributes = other.stringlist_attributes; |
| 239 html_attributes = other.html_attributes; | 241 html_attributes = other.html_attributes; |
| 240 child_ids = other.child_ids; | 242 child_ids = other.child_ids; |
| 241 location = other.location; | 243 location = other.location; |
| 242 offset_container_id = other.offset_container_id; | 244 offset_container_id = other.offset_container_id; |
| 243 if (other.transform) | 245 if (other.transform) |
| 244 transform.reset(new gfx::Transform(*other.transform)); | 246 transform.reset(new gfx::Transform(*other.transform)); |
| 245 else | 247 else |
| 246 transform.reset(nullptr); | 248 transform.reset(nullptr); |
| 249 is_fixed_positioned = other.is_fixed_positioned; |
| 247 return *this; | 250 return *this; |
| 248 } | 251 } |
| 249 | 252 |
| 250 bool AXNodeData::HasBoolAttribute(AXBoolAttribute attribute) const { | 253 bool AXNodeData::HasBoolAttribute(AXBoolAttribute attribute) const { |
| 251 auto iter = FindInVectorOfPairs(attribute, bool_attributes); | 254 auto iter = FindInVectorOfPairs(attribute, bool_attributes); |
| 252 return iter != bool_attributes.end(); | 255 return iter != bool_attributes.end(); |
| 253 } | 256 } |
| 254 | 257 |
| 255 bool AXNodeData::GetBoolAttribute(AXBoolAttribute attribute) const { | 258 bool AXNodeData::GetBoolAttribute(AXBoolAttribute attribute) const { |
| 256 bool result; | 259 bool result; |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 IntToString(location.y()) + ")-(" + | 554 IntToString(location.y()) + ")-(" + |
| 552 IntToString(location.width()) + ", " + | 555 IntToString(location.width()) + ", " + |
| 553 IntToString(location.height()) + ")"; | 556 IntToString(location.height()) + ")"; |
| 554 | 557 |
| 555 if (offset_container_id != -1) | 558 if (offset_container_id != -1) |
| 556 result += " offset_container_id=" + IntToString(offset_container_id); | 559 result += " offset_container_id=" + IntToString(offset_container_id); |
| 557 | 560 |
| 558 if (transform && !transform->IsIdentity()) | 561 if (transform && !transform->IsIdentity()) |
| 559 result += " transform=" + transform->ToString(); | 562 result += " transform=" + transform->ToString(); |
| 560 | 563 |
| 564 if (is_fixed_positioned) |
| 565 result += " is_fixed_positioned"; |
| 566 |
| 561 for (size_t i = 0; i < int_attributes.size(); ++i) { | 567 for (size_t i = 0; i < int_attributes.size(); ++i) { |
| 562 std::string value = IntToString(int_attributes[i].second); | 568 std::string value = IntToString(int_attributes[i].second); |
| 563 switch (int_attributes[i].first) { | 569 switch (int_attributes[i].first) { |
| 564 case AX_ATTR_DEFAULT_ACTION_VERB: | 570 case AX_ATTR_DEFAULT_ACTION_VERB: |
| 565 result += | 571 result += |
| 566 " action=" + | 572 " action=" + |
| 567 base::UTF16ToUTF8(ActionVerbToUnlocalizedString( | 573 base::UTF16ToUTF8(ActionVerbToUnlocalizedString( |
| 568 static_cast<AXDefaultActionVerb>(int_attributes[i].second))); | 574 static_cast<AXDefaultActionVerb>(int_attributes[i].second))); |
| 569 break; | 575 break; |
| 570 case AX_ATTR_SCROLL_X: | 576 case AX_ATTR_SCROLL_X: |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 | 1030 |
| 1025 result += " actions=" + ActionsBitfieldToString(actions); | 1031 result += " actions=" + ActionsBitfieldToString(actions); |
| 1026 | 1032 |
| 1027 if (!child_ids.empty()) | 1033 if (!child_ids.empty()) |
| 1028 result += " child_ids=" + IntVectorToString(child_ids); | 1034 result += " child_ids=" + IntVectorToString(child_ids); |
| 1029 | 1035 |
| 1030 return result; | 1036 return result; |
| 1031 } | 1037 } |
| 1032 | 1038 |
| 1033 } // namespace ui | 1039 } // namespace ui |
| OLD | NEW |