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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 if (InternalChildCount() == 0) | 45 if (InternalChildCount() == 0) |
46 return true; | 46 return true; |
47 | 47 |
48 // All of these roles may have children that we use as internal | 48 // All of these roles may have children that we use as internal |
49 // implementation details, but we want to expose them as leaves | 49 // implementation details, but we want to expose them as leaves |
50 // to platform accessibility APIs. | 50 // to platform accessibility APIs. |
51 switch (GetRole()) { | 51 switch (GetRole()) { |
52 case ui::AX_ROLE_LINE_BREAK: | 52 case ui::AX_ROLE_LINE_BREAK: |
53 case ui::AX_ROLE_SLIDER: | 53 case ui::AX_ROLE_SLIDER: |
54 case ui::AX_ROLE_STATIC_TEXT: | 54 case ui::AX_ROLE_STATIC_TEXT: |
55 case ui::AX_ROLE_TEXT_AREA: | |
56 case ui::AX_ROLE_TEXT_FIELD: | 55 case ui::AX_ROLE_TEXT_FIELD: |
57 return true; | 56 return true; |
58 default: | 57 default: |
59 return false; | 58 return false; |
60 } | 59 } |
61 } | 60 } |
62 | 61 |
63 uint32 BrowserAccessibility::PlatformChildCount() const { | 62 uint32 BrowserAccessibility::PlatformChildCount() const { |
64 return PlatformIsLeaf() ? 0 : InternalChildCount(); | 63 return PlatformIsLeaf() ? 0 : InternalChildCount(); |
65 } | 64 } |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 if (GetRole() == ui::AX_ROLE_SCROLL_AREA || | 694 if (GetRole() == ui::AX_ROLE_SCROLL_AREA || |
696 GetRole() == ui::AX_ROLE_COLUMN || | 695 GetRole() == ui::AX_ROLE_COLUMN || |
697 GetRole() == ui::AX_ROLE_TABLE_HEADER_CONTAINER) { | 696 GetRole() == ui::AX_ROLE_TABLE_HEADER_CONTAINER) { |
698 return false; | 697 return false; |
699 } | 698 } |
700 | 699 |
701 // Note: WebAXStateReadonly being false means it's either a text control, | 700 // Note: WebAXStateReadonly being false means it's either a text control, |
702 // or contenteditable. We also check for editable text roles to cover | 701 // or contenteditable. We also check for editable text roles to cover |
703 // another element that has role=textbox set on it. | 702 // another element that has role=textbox set on it. |
704 return (!HasState(ui::AX_STATE_READ_ONLY) || | 703 return (!HasState(ui::AX_STATE_READ_ONLY) || |
705 GetRole() == ui::AX_ROLE_TEXT_FIELD || | 704 GetRole() == ui::AX_ROLE_TEXT_FIELD); |
706 GetRole() == ui::AX_ROLE_TEXT_AREA); | |
707 } | 705 } |
708 | 706 |
709 bool BrowserAccessibility::IsWebAreaForPresentationalIframe() const { | 707 bool BrowserAccessibility::IsWebAreaForPresentationalIframe() const { |
710 if (GetRole() != ui::AX_ROLE_WEB_AREA && | 708 if (GetRole() != ui::AX_ROLE_WEB_AREA && |
711 GetRole() != ui::AX_ROLE_ROOT_WEB_AREA) { | 709 GetRole() != ui::AX_ROLE_ROOT_WEB_AREA) { |
712 return false; | 710 return false; |
713 } | 711 } |
714 | 712 |
715 BrowserAccessibility* parent = GetParent(); | 713 BrowserAccessibility* parent = GetParent(); |
716 if (!parent) | 714 if (!parent) |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 } | 779 } |
782 need_to_offset_web_area = true; | 780 need_to_offset_web_area = true; |
783 } | 781 } |
784 parent = parent->GetParentForBoundsCalculation(); | 782 parent = parent->GetParentForBoundsCalculation(); |
785 } | 783 } |
786 | 784 |
787 return bounds; | 785 return bounds; |
788 } | 786 } |
789 | 787 |
790 } // namespace content | 788 } // namespace content |
OLD | NEW |