| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 return PlatformIsLeaf() ? 0 : InternalChildCount(); | 74 return PlatformIsLeaf() ? 0 : InternalChildCount(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 bool BrowserAccessibility::IsNative() const { | 77 bool BrowserAccessibility::IsNative() const { |
| 78 return false; | 78 return false; |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool BrowserAccessibility::IsDescendantOf( | 81 bool BrowserAccessibility::IsDescendantOf( |
| 82 BrowserAccessibility* ancestor) { | 82 const BrowserAccessibility* ancestor) const { |
| 83 if (this == ancestor) { | 83 if (this == ancestor) { |
| 84 return true; | 84 return true; |
| 85 } else if (GetParent()) { | 85 } else if (GetParent()) { |
| 86 return GetParent()->IsDescendantOf(ancestor); | 86 return GetParent()->IsDescendantOf(ancestor); |
| 87 } | 87 } |
| 88 | 88 |
| 89 return false; | 89 return false; |
| 90 } | 90 } |
| 91 | 91 |
| 92 BrowserAccessibility* BrowserAccessibility::PlatformGetChild( | 92 BrowserAccessibility* BrowserAccessibility::PlatformGetChild( |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 | 614 |
| 615 bool BrowserAccessibility::IsEditableText() const { | 615 bool BrowserAccessibility::IsEditableText() const { |
| 616 // These roles don't have readonly set, but they're not editable text. | 616 // These roles don't have readonly set, but they're not editable text. |
| 617 if (GetRole() == ui::AX_ROLE_SCROLL_AREA || | 617 if (GetRole() == ui::AX_ROLE_SCROLL_AREA || |
| 618 GetRole() == ui::AX_ROLE_COLUMN || | 618 GetRole() == ui::AX_ROLE_COLUMN || |
| 619 GetRole() == ui::AX_ROLE_TABLE_HEADER_CONTAINER) { | 619 GetRole() == ui::AX_ROLE_TABLE_HEADER_CONTAINER) { |
| 620 return false; | 620 return false; |
| 621 } | 621 } |
| 622 | 622 |
| 623 // Note: WebAXStateReadonly being false means it's either a text control, | 623 // Note: WebAXStateReadonly being false means it's either a text control, |
| 624 // or contenteditable. We also check for editable text roles to cover | 624 // or contenteditable. We also check for the text field role to cover |
| 625 // another element that has role=textbox set on it. | 625 // elements that have role=textbox set on it. |
| 626 return (!HasState(ui::AX_STATE_READ_ONLY) || | 626 return (!HasState(ui::AX_STATE_READ_ONLY) || |
| 627 GetRole() == ui::AX_ROLE_TEXT_FIELD); | 627 GetRole() == ui::AX_ROLE_TEXT_FIELD); |
| 628 } | 628 } |
| 629 | 629 |
| 630 bool BrowserAccessibility::IsWebAreaForPresentationalIframe() const { | 630 bool BrowserAccessibility::IsWebAreaForPresentationalIframe() const { |
| 631 if (GetRole() != ui::AX_ROLE_WEB_AREA && | 631 if (GetRole() != ui::AX_ROLE_WEB_AREA && |
| 632 GetRole() != ui::AX_ROLE_ROOT_WEB_AREA) { | 632 GetRole() != ui::AX_ROLE_ROOT_WEB_AREA) { |
| 633 return false; | 633 return false; |
| 634 } | 634 } |
| 635 | 635 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 } | 748 } |
| 749 need_to_offset_web_area = true; | 749 need_to_offset_web_area = true; |
| 750 } | 750 } |
| 751 parent = parent->GetParent(); | 751 parent = parent->GetParent(); |
| 752 } | 752 } |
| 753 | 753 |
| 754 return bounds; | 754 return bounds; |
| 755 } | 755 } |
| 756 | 756 |
| 757 } // namespace content | 757 } // namespace content |
| OLD | NEW |