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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 if (EqualsASCII(value, "mixed")) | 656 if (EqualsASCII(value, "mixed")) |
657 *is_mixed = true; | 657 *is_mixed = true; |
658 | 658 |
659 return false; // Not set | 659 return false; // Not set |
660 } | 660 } |
661 | 661 |
662 bool BrowserAccessibility::HasState(ui::AXState state_enum) const { | 662 bool BrowserAccessibility::HasState(ui::AXState state_enum) const { |
663 return (GetState() >> state_enum) & 1; | 663 return (GetState() >> state_enum) & 1; |
664 } | 664 } |
665 | 665 |
| 666 bool BrowserAccessibility::IsCellOrTableHeaderRole() const { |
| 667 return (GetRole() == ui::AX_ROLE_CELL || |
| 668 GetRole() == ui::AX_ROLE_COLUMN_HEADER || |
| 669 GetRole() == ui::AX_ROLE_ROW_HEADER); |
| 670 } |
| 671 |
666 bool BrowserAccessibility::IsEditableText() const { | 672 bool BrowserAccessibility::IsEditableText() const { |
667 // These roles don't have readonly set, but they're not editable text. | 673 // These roles don't have readonly set, but they're not editable text. |
668 if (GetRole() == ui::AX_ROLE_SCROLL_AREA || | 674 if (GetRole() == ui::AX_ROLE_SCROLL_AREA || |
669 GetRole() == ui::AX_ROLE_COLUMN || | 675 GetRole() == ui::AX_ROLE_COLUMN || |
670 GetRole() == ui::AX_ROLE_TABLE_HEADER_CONTAINER) { | 676 GetRole() == ui::AX_ROLE_TABLE_HEADER_CONTAINER) { |
671 return false; | 677 return false; |
672 } | 678 } |
673 | 679 |
674 // Note: WebAXStateReadonly being false means it's either a text control, | 680 // Note: WebAXStateReadonly being false means it's either a text control, |
675 // or contenteditable. We also check for editable text roles to cover | 681 // or contenteditable. We also check for editable text roles to cover |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 if (GetRole() == ui::AX_ROLE_STATIC_TEXT) | 717 if (GetRole() == ui::AX_ROLE_STATIC_TEXT) |
712 return static_cast<int>(GetStringAttribute(ui::AX_ATTR_VALUE).size()); | 718 return static_cast<int>(GetStringAttribute(ui::AX_ATTR_VALUE).size()); |
713 | 719 |
714 int len = 0; | 720 int len = 0; |
715 for (size_t i = 0; i < InternalChildCount(); ++i) | 721 for (size_t i = 0; i < InternalChildCount(); ++i) |
716 len += InternalGetChild(i)->GetStaticTextLenRecursive(); | 722 len += InternalGetChild(i)->GetStaticTextLenRecursive(); |
717 return len; | 723 return len; |
718 } | 724 } |
719 | 725 |
720 } // namespace content | 726 } // namespace content |
OLD | NEW |