Chromium Code Reviews| 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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 678 if (!parent) | 678 if (!parent) |
| 679 return false; | 679 return false; |
| 680 | 680 |
| 681 BrowserAccessibility* grandparent = parent->GetParent(); | 681 BrowserAccessibility* grandparent = parent->GetParent(); |
| 682 if (!grandparent) | 682 if (!grandparent) |
| 683 return false; | 683 return false; |
| 684 | 684 |
| 685 return grandparent->GetRole() == ui::AX_ROLE_IFRAME_PRESENTATIONAL; | 685 return grandparent->GetRole() == ui::AX_ROLE_IFRAME_PRESENTATIONAL; |
| 686 } | 686 } |
| 687 | 687 |
| 688 bool BrowserAccessibility::IsControl() const { | 688 // Some controls (native or ARIA-based) expose a visible value which is |
|
aboxhall
2015/10/29 17:58:49
So this method was never called previously?
|
aboxhall
2015/10/29 17:58:49
Put this comment in the header file instead.
|
| 689 // separate from their name or label. | |
| 690 // Examples include combo boxes and text fields, but don't include buttons. | |
| 691 bool BrowserAccessibility::IsControlWithValue() const { | |
| 689 switch (GetRole()) { | 692 switch (GetRole()) { |
| 690 case ui::AX_ROLE_BUTTON: | |
| 691 case ui::AX_ROLE_BUTTON_DROP_DOWN: | |
| 692 case ui::AX_ROLE_CHECK_BOX: | |
| 693 case ui::AX_ROLE_COLOR_WELL: | 693 case ui::AX_ROLE_COLOR_WELL: |
| 694 case ui::AX_ROLE_COMBO_BOX: | 694 case ui::AX_ROLE_COMBO_BOX: |
| 695 case ui::AX_ROLE_DISCLOSURE_TRIANGLE: | 695 case ui::AX_ROLE_DATE: |
| 696 case ui::AX_ROLE_DATE_TIME: | |
| 697 case ui::AX_ROLE_INPUT_TIME: | |
| 696 case ui::AX_ROLE_LIST_BOX: | 698 case ui::AX_ROLE_LIST_BOX: |
| 697 case ui::AX_ROLE_MENU_BAR: | |
| 698 case ui::AX_ROLE_MENU_BUTTON: | |
| 699 case ui::AX_ROLE_MENU_ITEM: | |
| 700 case ui::AX_ROLE_MENU_ITEM_CHECK_BOX: | |
| 701 case ui::AX_ROLE_MENU_ITEM_RADIO: | |
| 702 case ui::AX_ROLE_MENU: | |
| 703 case ui::AX_ROLE_POP_UP_BUTTON: | |
| 704 case ui::AX_ROLE_RADIO_BUTTON: | |
| 705 case ui::AX_ROLE_SCROLL_BAR: | 699 case ui::AX_ROLE_SCROLL_BAR: |
| 706 case ui::AX_ROLE_SEARCH_BOX: | 700 case ui::AX_ROLE_SEARCH_BOX: |
| 707 case ui::AX_ROLE_SLIDER: | 701 case ui::AX_ROLE_SLIDER: |
| 708 case ui::AX_ROLE_SPIN_BUTTON: | 702 case ui::AX_ROLE_SPIN_BUTTON: |
| 709 case ui::AX_ROLE_SWITCH: | |
| 710 case ui::AX_ROLE_TAB: | |
| 711 case ui::AX_ROLE_TEXT_FIELD: | 703 case ui::AX_ROLE_TEXT_FIELD: |
| 712 case ui::AX_ROLE_TOGGLE_BUTTON: | |
| 713 case ui::AX_ROLE_TREE: | |
| 714 return true; | 704 return true; |
| 715 default: | 705 default: |
| 716 return false; | 706 return false; |
| 717 } | 707 } |
| 718 } | 708 } |
| 719 | 709 |
| 720 int BrowserAccessibility::GetStaticTextLenRecursive() const { | 710 int BrowserAccessibility::GetStaticTextLenRecursive() const { |
| 721 if (GetRole() == ui::AX_ROLE_STATIC_TEXT || | 711 if (GetRole() == ui::AX_ROLE_STATIC_TEXT || |
| 722 GetRole() == ui::AX_ROLE_LINE_BREAK) { | 712 GetRole() == ui::AX_ROLE_LINE_BREAK) { |
| 723 return static_cast<int>(GetStringAttribute(ui::AX_ATTR_VALUE).size()); | 713 return static_cast<int>(GetStringAttribute(ui::AX_ATTR_VALUE).size()); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 789 } | 779 } |
| 790 need_to_offset_web_area = true; | 780 need_to_offset_web_area = true; |
| 791 } | 781 } |
| 792 parent = parent->GetParent(); | 782 parent = parent->GetParent(); |
| 793 } | 783 } |
| 794 | 784 |
| 795 return bounds; | 785 return bounds; |
| 796 } | 786 } |
| 797 | 787 |
| 798 } // namespace content | 788 } // namespace content |
| OLD | NEW |