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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 return (GetState() >> state_enum) & 1; | 634 return (GetState() >> state_enum) & 1; |
635 } | 635 } |
636 | 636 |
637 bool BrowserAccessibility::IsCellOrTableHeaderRole() const { | 637 bool BrowserAccessibility::IsCellOrTableHeaderRole() const { |
638 return (GetRole() == ui::AX_ROLE_CELL || | 638 return (GetRole() == ui::AX_ROLE_CELL || |
639 GetRole() == ui::AX_ROLE_COLUMN_HEADER || | 639 GetRole() == ui::AX_ROLE_COLUMN_HEADER || |
640 GetRole() == ui::AX_ROLE_ROW_HEADER); | 640 GetRole() == ui::AX_ROLE_ROW_HEADER); |
641 } | 641 } |
642 | 642 |
643 bool BrowserAccessibility::IsEditableText() const { | 643 bool BrowserAccessibility::IsEditableText() const { |
644 // These roles don't have readonly set, but they're not editable text. | 644 return HasState(ui::AX_STATE_EDITABLE); |
645 if (GetRole() == ui::AX_ROLE_SCROLL_AREA || | |
646 GetRole() == ui::AX_ROLE_COLUMN || | |
647 GetRole() == ui::AX_ROLE_TABLE_HEADER_CONTAINER) { | |
648 return false; | |
649 } | |
650 | |
651 // Note: WebAXStateReadonly being false means it's either a text control, | |
652 // or contenteditable. We also check for the text field role to cover | |
653 // elements that have role=textbox set on it. | |
654 return (!HasState(ui::AX_STATE_READ_ONLY) || | |
655 GetRole() == ui::AX_ROLE_TEXT_FIELD); | |
656 } | 645 } |
657 | 646 |
658 bool BrowserAccessibility::IsWebAreaForPresentationalIframe() const { | 647 bool BrowserAccessibility::IsWebAreaForPresentationalIframe() const { |
659 if (GetRole() != ui::AX_ROLE_WEB_AREA && | 648 if (GetRole() != ui::AX_ROLE_WEB_AREA && |
660 GetRole() != ui::AX_ROLE_ROOT_WEB_AREA) { | 649 GetRole() != ui::AX_ROLE_ROOT_WEB_AREA) { |
661 return false; | 650 return false; |
662 } | 651 } |
663 | 652 |
664 BrowserAccessibility* parent = GetParent(); | 653 BrowserAccessibility* parent = GetParent(); |
665 if (!parent) | 654 if (!parent) |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 } | 765 } |
777 need_to_offset_web_area = true; | 766 need_to_offset_web_area = true; |
778 } | 767 } |
779 parent = parent->GetParent(); | 768 parent = parent->GetParent(); |
780 } | 769 } |
781 | 770 |
782 return bounds; | 771 return bounds; |
783 } | 772 } |
784 | 773 |
785 } // namespace content | 774 } // namespace content |
OLD | NEW |