| 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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 return (GetState() >> state_enum) & 1; | 611 return (GetState() >> state_enum) & 1; |
| 612 } | 612 } |
| 613 | 613 |
| 614 bool BrowserAccessibility::IsCellOrTableHeaderRole() const { | 614 bool BrowserAccessibility::IsCellOrTableHeaderRole() const { |
| 615 return (GetRole() == ui::AX_ROLE_CELL || | 615 return (GetRole() == ui::AX_ROLE_CELL || |
| 616 GetRole() == ui::AX_ROLE_COLUMN_HEADER || | 616 GetRole() == ui::AX_ROLE_COLUMN_HEADER || |
| 617 GetRole() == ui::AX_ROLE_ROW_HEADER); | 617 GetRole() == ui::AX_ROLE_ROW_HEADER); |
| 618 } | 618 } |
| 619 | 619 |
| 620 bool BrowserAccessibility::IsEditableText() const { | 620 bool BrowserAccessibility::IsEditableText() const { |
| 621 // These roles don't have readonly set, but they're not editable text. | 621 return HasState(ui::AX_STATE_EDITABLE); |
| 622 if (GetRole() == ui::AX_ROLE_SCROLL_AREA || | |
| 623 GetRole() == ui::AX_ROLE_COLUMN || | |
| 624 GetRole() == ui::AX_ROLE_TABLE_HEADER_CONTAINER) { | |
| 625 return false; | |
| 626 } | |
| 627 | |
| 628 // Note: WebAXStateReadonly being false means it's either a text control, | |
| 629 // or contenteditable. We also check for the text field role to cover | |
| 630 // elements that have role=textbox set on it. | |
| 631 return (!HasState(ui::AX_STATE_READ_ONLY) || | |
| 632 GetRole() == ui::AX_ROLE_TEXT_FIELD); | |
| 633 } | 622 } |
| 634 | 623 |
| 635 bool BrowserAccessibility::IsWebAreaForPresentationalIframe() const { | 624 bool BrowserAccessibility::IsWebAreaForPresentationalIframe() const { |
| 636 if (GetRole() != ui::AX_ROLE_WEB_AREA && | 625 if (GetRole() != ui::AX_ROLE_WEB_AREA && |
| 637 GetRole() != ui::AX_ROLE_ROOT_WEB_AREA) { | 626 GetRole() != ui::AX_ROLE_ROOT_WEB_AREA) { |
| 638 return false; | 627 return false; |
| 639 } | 628 } |
| 640 | 629 |
| 641 BrowserAccessibility* parent = GetParent(); | 630 BrowserAccessibility* parent = GetParent(); |
| 642 if (!parent) | 631 if (!parent) |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 } | 742 } |
| 754 need_to_offset_web_area = true; | 743 need_to_offset_web_area = true; |
| 755 } | 744 } |
| 756 parent = parent->GetParent(); | 745 parent = parent->GetParent(); |
| 757 } | 746 } |
| 758 | 747 |
| 759 return bounds; | 748 return bounds; |
| 760 } | 749 } |
| 761 | 750 |
| 762 } // namespace content | 751 } // namespace content |
| OLD | NEW |