| 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> |
| 11 | 11 |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "ui/accessibility/ax_text_utils.h" |
| 16 #include "ui/gfx/transform.h" | 17 #include "ui/gfx/transform.h" |
| 17 | 18 |
| 18 using base::DoubleToString; | 19 using base::DoubleToString; |
| 19 using base::IntToString; | 20 using base::IntToString; |
| 20 | 21 |
| 21 namespace ui { | 22 namespace ui { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 std::string IntVectorToString(const std::vector<int>& items) { | 26 std::string IntVectorToString(const std::vector<int>& items) { |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 388 |
| 388 if (offset_container_id != -1) | 389 if (offset_container_id != -1) |
| 389 result += " offset_container_id=" + IntToString(offset_container_id); | 390 result += " offset_container_id=" + IntToString(offset_container_id); |
| 390 | 391 |
| 391 if (transform && !transform->IsIdentity()) | 392 if (transform && !transform->IsIdentity()) |
| 392 result += " transform=" + transform->ToString(); | 393 result += " transform=" + transform->ToString(); |
| 393 | 394 |
| 394 for (size_t i = 0; i < int_attributes.size(); ++i) { | 395 for (size_t i = 0; i < int_attributes.size(); ++i) { |
| 395 std::string value = IntToString(int_attributes[i].second); | 396 std::string value = IntToString(int_attributes[i].second); |
| 396 switch (int_attributes[i].first) { | 397 switch (int_attributes[i].first) { |
| 398 case AX_ATTR_ACTION: |
| 399 result += |
| 400 " action=" + |
| 401 base::UTF16ToUTF8(ActionToUnlocalizedString( |
| 402 static_cast<AXSupportedAction>(int_attributes[i].second))); |
| 403 break; |
| 397 case AX_ATTR_SCROLL_X: | 404 case AX_ATTR_SCROLL_X: |
| 398 result += " scroll_x=" + value; | 405 result += " scroll_x=" + value; |
| 399 break; | 406 break; |
| 400 case AX_ATTR_SCROLL_X_MIN: | 407 case AX_ATTR_SCROLL_X_MIN: |
| 401 result += " scroll_x_min=" + value; | 408 result += " scroll_x_min=" + value; |
| 402 break; | 409 break; |
| 403 case AX_ATTR_SCROLL_X_MAX: | 410 case AX_ATTR_SCROLL_X_MAX: |
| 404 result += " scroll_x_max=" + value; | 411 result += " scroll_x_max=" + value; |
| 405 break; | 412 break; |
| 406 case AX_ATTR_SCROLL_Y: | 413 case AX_ATTR_SCROLL_Y: |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 break; | 471 break; |
| 465 case AX_SORT_DIRECTION_DESCENDING: | 472 case AX_SORT_DIRECTION_DESCENDING: |
| 466 result += " sort_direction=descending"; | 473 result += " sort_direction=descending"; |
| 467 break; | 474 break; |
| 468 case AX_SORT_DIRECTION_OTHER: | 475 case AX_SORT_DIRECTION_OTHER: |
| 469 result += " sort_direction=other"; | 476 result += " sort_direction=other"; |
| 470 break; | 477 break; |
| 471 } | 478 } |
| 472 break; | 479 break; |
| 473 case AX_ATTR_NAME_FROM: | 480 case AX_ATTR_NAME_FROM: |
| 474 result += " name_from=" + ui::ToString( | 481 result += |
| 475 static_cast<ui::AXNameFrom>(int_attributes[i].second)); | 482 " name_from=" + |
| 483 ui::ToString(static_cast<AXNameFrom>(int_attributes[i].second)); |
| 476 break; | 484 break; |
| 477 case AX_ATTR_DESCRIPTION_FROM: | 485 case AX_ATTR_DESCRIPTION_FROM: |
| 478 result += " description_from=" + ui::ToString( | 486 result += " description_from=" + |
| 479 static_cast<ui::AXDescriptionFrom>(int_attributes[i].second)); | 487 ui::ToString( |
| 488 static_cast<AXDescriptionFrom>(int_attributes[i].second)); |
| 480 break; | 489 break; |
| 481 case AX_ATTR_ACTIVEDESCENDANT_ID: | 490 case AX_ATTR_ACTIVEDESCENDANT_ID: |
| 482 result += " activedescendant=" + value; | 491 result += " activedescendant=" + value; |
| 483 break; | 492 break; |
| 484 case AX_ATTR_MEMBER_OF_ID: | 493 case AX_ATTR_MEMBER_OF_ID: |
| 485 result += " member_of_id=" + value; | 494 result += " member_of_id=" + value; |
| 486 break; | 495 break; |
| 487 case AX_ATTR_NEXT_ON_LINE_ID: | 496 case AX_ATTR_NEXT_ON_LINE_ID: |
| 488 result += " next_on_line_id=" + value; | 497 result += " next_on_line_id=" + value; |
| 489 break; | 498 break; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 break; | 599 break; |
| 591 } | 600 } |
| 592 } | 601 } |
| 593 | 602 |
| 594 for (size_t i = 0; i < string_attributes.size(); ++i) { | 603 for (size_t i = 0; i < string_attributes.size(); ++i) { |
| 595 std::string value = string_attributes[i].second; | 604 std::string value = string_attributes[i].second; |
| 596 switch (string_attributes[i].first) { | 605 switch (string_attributes[i].first) { |
| 597 case AX_ATTR_ACCESS_KEY: | 606 case AX_ATTR_ACCESS_KEY: |
| 598 result += " access_key=" + value; | 607 result += " access_key=" + value; |
| 599 break; | 608 break; |
| 600 case AX_ATTR_ACTION: | |
| 601 result += " action=" + value; | |
| 602 break; | |
| 603 case AX_ATTR_ARIA_INVALID_VALUE: | 609 case AX_ATTR_ARIA_INVALID_VALUE: |
| 604 result += " aria_invalid_value=" + value; | 610 result += " aria_invalid_value=" + value; |
| 605 break; | 611 break; |
| 606 case AX_ATTR_AUTO_COMPLETE: | 612 case AX_ATTR_AUTO_COMPLETE: |
| 607 result += " autocomplete=" + value; | 613 result += " autocomplete=" + value; |
| 608 break; | 614 break; |
| 609 case AX_ATTR_DESCRIPTION: | 615 case AX_ATTR_DESCRIPTION: |
| 610 result += " description=" + value; | 616 result += " description=" + value; |
| 611 break; | 617 break; |
| 612 case AX_ATTR_DISPLAY: | 618 case AX_ATTR_DISPLAY: |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 } | 796 } |
| 791 } | 797 } |
| 792 | 798 |
| 793 if (!child_ids.empty()) | 799 if (!child_ids.empty()) |
| 794 result += " child_ids=" + IntVectorToString(child_ids); | 800 result += " child_ids=" + IntVectorToString(child_ids); |
| 795 | 801 |
| 796 return result; | 802 return result; |
| 797 } | 803 } |
| 798 | 804 |
| 799 } // namespace ui | 805 } // namespace ui |
| OLD | NEW |