OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/accessibility/browser_accessibility.h" | 5 #include "content/browser/accessibility/browser_accessibility.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 case ui::AX_ROLE_TAB: | 710 case ui::AX_ROLE_TAB: |
711 case ui::AX_ROLE_TEXT_FIELD: | 711 case ui::AX_ROLE_TEXT_FIELD: |
712 case ui::AX_ROLE_TOGGLE_BUTTON: | 712 case ui::AX_ROLE_TOGGLE_BUTTON: |
713 case ui::AX_ROLE_TREE: | 713 case ui::AX_ROLE_TREE: |
714 return true; | 714 return true; |
715 default: | 715 default: |
716 return false; | 716 return false; |
717 } | 717 } |
718 } | 718 } |
719 | 719 |
| 720 // Some controls (native or ARIA-based) expose a visible value which is |
| 721 // separate from their name or label. |
| 722 // Examples include combo boxes and text fields, but don't include buttons. |
| 723 bool BrowserAccessibility::IsControlWithVisibleValue() const { |
| 724 switch (GetRole()) { |
| 725 case ui::AX_ROLE_COLOR_WELL: |
| 726 case ui::AX_ROLE_COMBO_BOX: |
| 727 case ui::AX_ROLE_DATE: |
| 728 case ui::AX_ROLE_DATE_TIME: |
| 729 case ui::AX_ROLE_INPUT_TIME: |
| 730 case ui::AX_ROLE_LIST_BOX: |
| 731 case ui::AX_ROLE_SCROLL_BAR: |
| 732 case ui::AX_ROLE_SEARCH_BOX: |
| 733 case ui::AX_ROLE_SLIDER: |
| 734 case ui::AX_ROLE_SPIN_BUTTON: |
| 735 case ui::AX_ROLE_TEXT_FIELD: |
| 736 return true; |
| 737 default: |
| 738 return false; |
| 739 } |
| 740 } |
| 741 |
720 int BrowserAccessibility::GetStaticTextLenRecursive() const { | 742 int BrowserAccessibility::GetStaticTextLenRecursive() const { |
721 if (GetRole() == ui::AX_ROLE_STATIC_TEXT || | 743 if (GetRole() == ui::AX_ROLE_STATIC_TEXT || |
722 GetRole() == ui::AX_ROLE_LINE_BREAK) { | 744 GetRole() == ui::AX_ROLE_LINE_BREAK) { |
723 return static_cast<int>(GetStringAttribute(ui::AX_ATTR_VALUE).size()); | 745 return static_cast<int>(GetStringAttribute(ui::AX_ATTR_VALUE).size()); |
724 } | 746 } |
725 | 747 |
726 int len = 0; | 748 int len = 0; |
727 for (size_t i = 0; i < InternalChildCount(); ++i) | 749 for (size_t i = 0; i < InternalChildCount(); ++i) |
728 len += InternalGetChild(i)->GetStaticTextLenRecursive(); | 750 len += InternalGetChild(i)->GetStaticTextLenRecursive(); |
729 return len; | 751 return len; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 } | 811 } |
790 need_to_offset_web_area = true; | 812 need_to_offset_web_area = true; |
791 } | 813 } |
792 parent = parent->GetParent(); | 814 parent = parent->GetParent(); |
793 } | 815 } |
794 | 816 |
795 return bounds; | 817 return bounds; |
796 } | 818 } |
797 | 819 |
798 } // namespace content | 820 } // namespace content |
OLD | NEW |