| 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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 if (!parent) | 752 if (!parent) |
| 753 return false; | 753 return false; |
| 754 | 754 |
| 755 BrowserAccessibility* grandparent = parent->GetParent(); | 755 BrowserAccessibility* grandparent = parent->GetParent(); |
| 756 if (!grandparent) | 756 if (!grandparent) |
| 757 return false; | 757 return false; |
| 758 | 758 |
| 759 return grandparent->GetRole() == ui::AX_ROLE_IFRAME_PRESENTATIONAL; | 759 return grandparent->GetRole() == ui::AX_ROLE_IFRAME_PRESENTATIONAL; |
| 760 } | 760 } |
| 761 | 761 |
| 762 bool BrowserAccessibility::IsControl() const { |
| 763 switch (GetRole()) { |
| 764 case ui::AX_ROLE_BUTTON: |
| 765 case ui::AX_ROLE_BUTTON_DROP_DOWN: |
| 766 case ui::AX_ROLE_CHECK_BOX: |
| 767 case ui::AX_ROLE_COLOR_WELL: |
| 768 case ui::AX_ROLE_COMBO_BOX: |
| 769 case ui::AX_ROLE_DISCLOSURE_TRIANGLE: |
| 770 case ui::AX_ROLE_LIST_BOX: |
| 771 case ui::AX_ROLE_MENU_BAR: |
| 772 case ui::AX_ROLE_MENU_BUTTON: |
| 773 case ui::AX_ROLE_MENU_ITEM: |
| 774 case ui::AX_ROLE_MENU_ITEM_CHECK_BOX: |
| 775 case ui::AX_ROLE_MENU_ITEM_RADIO: |
| 776 case ui::AX_ROLE_MENU: |
| 777 case ui::AX_ROLE_POP_UP_BUTTON: |
| 778 case ui::AX_ROLE_RADIO_BUTTON: |
| 779 case ui::AX_ROLE_SCROLL_BAR: |
| 780 case ui::AX_ROLE_SEARCH_BOX: |
| 781 case ui::AX_ROLE_SLIDER: |
| 782 case ui::AX_ROLE_SPIN_BUTTON: |
| 783 case ui::AX_ROLE_SWITCH: |
| 784 case ui::AX_ROLE_TAB: |
| 785 case ui::AX_ROLE_TEXT_FIELD: |
| 786 case ui::AX_ROLE_TOGGLE_BUTTON: |
| 787 case ui::AX_ROLE_TREE: |
| 788 return true; |
| 789 default: |
| 790 return false; |
| 791 } |
| 792 } |
| 793 |
| 762 int BrowserAccessibility::GetStaticTextLenRecursive() const { | 794 int BrowserAccessibility::GetStaticTextLenRecursive() const { |
| 763 if (GetRole() == ui::AX_ROLE_STATIC_TEXT || | 795 if (GetRole() == ui::AX_ROLE_STATIC_TEXT || |
| 764 GetRole() == ui::AX_ROLE_LINE_BREAK) { | 796 GetRole() == ui::AX_ROLE_LINE_BREAK) { |
| 765 return static_cast<int>(GetStringAttribute(ui::AX_ATTR_VALUE).size()); | 797 return static_cast<int>(GetStringAttribute(ui::AX_ATTR_VALUE).size()); |
| 766 } | 798 } |
| 767 | 799 |
| 768 int len = 0; | 800 int len = 0; |
| 769 for (size_t i = 0; i < InternalChildCount(); ++i) | 801 for (size_t i = 0; i < InternalChildCount(); ++i) |
| 770 len += InternalGetChild(i)->GetStaticTextLenRecursive(); | 802 len += InternalGetChild(i)->GetStaticTextLenRecursive(); |
| 771 return len; | 803 return len; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 } | 851 } |
| 820 need_to_offset_web_area = true; | 852 need_to_offset_web_area = true; |
| 821 } | 853 } |
| 822 parent = parent->GetParentForBoundsCalculation(); | 854 parent = parent->GetParentForBoundsCalculation(); |
| 823 } | 855 } |
| 824 | 856 |
| 825 return bounds; | 857 return bounds; |
| 826 } | 858 } |
| 827 | 859 |
| 828 } // namespace content | 860 } // namespace content |
| OLD | NEW |