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 bool BrowserAccessibility::IsTextControl() const { |
| 721 // Time fields, color wells and spinner buttons might also use text fields as |
| 722 // constituent parts, but they are not considered text fields as a whole. |
| 723 switch (GetRole()) { |
| 724 case ui::AX_ROLE_COMBO_BOX: |
| 725 case ui::AX_ROLE_SEARCH_BOX: |
| 726 case ui::AX_ROLE_TEXT_FIELD: |
| 727 return true; |
| 728 default: |
| 729 return false; |
| 730 } |
| 731 } |
| 732 |
720 int BrowserAccessibility::GetStaticTextLenRecursive() const { | 733 int BrowserAccessibility::GetStaticTextLenRecursive() const { |
721 if (GetRole() == ui::AX_ROLE_STATIC_TEXT || | 734 if (GetRole() == ui::AX_ROLE_STATIC_TEXT || |
722 GetRole() == ui::AX_ROLE_LINE_BREAK) { | 735 GetRole() == ui::AX_ROLE_LINE_BREAK) { |
723 return static_cast<int>(GetStringAttribute(ui::AX_ATTR_VALUE).size()); | 736 return static_cast<int>(GetStringAttribute(ui::AX_ATTR_VALUE).size()); |
724 } | 737 } |
725 | 738 |
726 int len = 0; | 739 int len = 0; |
727 for (size_t i = 0; i < InternalChildCount(); ++i) | 740 for (size_t i = 0; i < InternalChildCount(); ++i) |
728 len += InternalGetChild(i)->GetStaticTextLenRecursive(); | 741 len += InternalGetChild(i)->GetStaticTextLenRecursive(); |
729 return len; | 742 return len; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 } | 802 } |
790 need_to_offset_web_area = true; | 803 need_to_offset_web_area = true; |
791 } | 804 } |
792 parent = parent->GetParent(); | 805 parent = parent->GetParent(); |
793 } | 806 } |
794 | 807 |
795 return bounds; | 808 return bounds; |
796 } | 809 } |
797 | 810 |
798 } // namespace content | 811 } // namespace content |
OLD | NEW |