| 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 void AXNodeData::AddStringAttribute( | 362 void AXNodeData::AddStringAttribute( |
| 363 AXStringAttribute attribute, const std::string& value) { | 363 AXStringAttribute attribute, const std::string& value) { |
| 364 string_attributes.push_back(std::make_pair(attribute, value)); | 364 string_attributes.push_back(std::make_pair(attribute, value)); |
| 365 } | 365 } |
| 366 | 366 |
| 367 void AXNodeData::AddIntAttribute( | 367 void AXNodeData::AddIntAttribute( |
| 368 AXIntAttribute attribute, int value) { | 368 AXIntAttribute attribute, int value) { |
| 369 int_attributes.push_back(std::make_pair(attribute, value)); | 369 int_attributes.push_back(std::make_pair(attribute, value)); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void AXNodeData::AddValidatedIntAttribute(AXValidatedIntAttribute attribute, |
| 373 int value) { |
| 374 switch (attribute) { |
| 375 case ui::AX_ATTR_INDEX_IN_SET: |
| 376 if (value < 0) { |
| 377 NOTREACHED(); |
| 378 return; |
| 379 } |
| 380 AddIntAttribute(ui::AX_ATTR_POS_IN_SET, value + 1); |
| 381 break; |
| 382 default: |
| 383 NOTREACHED(); |
| 384 } |
| 385 } |
| 386 |
| 372 void AXNodeData::AddFloatAttribute( | 387 void AXNodeData::AddFloatAttribute( |
| 373 AXFloatAttribute attribute, float value) { | 388 AXFloatAttribute attribute, float value) { |
| 374 float_attributes.push_back(std::make_pair(attribute, value)); | 389 float_attributes.push_back(std::make_pair(attribute, value)); |
| 375 } | 390 } |
| 376 | 391 |
| 377 void AXNodeData::AddBoolAttribute( | 392 void AXNodeData::AddBoolAttribute( |
| 378 AXBoolAttribute attribute, bool value) { | 393 AXBoolAttribute attribute, bool value) { |
| 379 bool_attributes.push_back(std::make_pair(attribute, value)); | 394 bool_attributes.push_back(std::make_pair(attribute, value)); |
| 380 } | 395 } |
| 381 | 396 |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 } | 936 } |
| 922 } | 937 } |
| 923 | 938 |
| 924 if (!child_ids.empty()) | 939 if (!child_ids.empty()) |
| 925 result += " child_ids=" + IntVectorToString(child_ids); | 940 result += " child_ids=" + IntVectorToString(child_ids); |
| 926 | 941 |
| 927 return result; | 942 return result; |
| 928 } | 943 } |
| 929 | 944 |
| 930 } // namespace ui | 945 } // namespace ui |
| OLD | NEW |