Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <atlbase.h> | 5 #include <atlbase.h> |
| 6 #include <atlcom.h> | 6 #include <atlcom.h> |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <oleacc.h> | 8 #include <oleacc.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 740 // | 740 // |
| 741 | 741 |
| 742 STDMETHODIMP AXPlatformNodeWin::role(LONG* role) { | 742 STDMETHODIMP AXPlatformNodeWin::role(LONG* role) { |
| 743 COM_OBJECT_VALIDATE_1_ARG(role); | 743 COM_OBJECT_VALIDATE_1_ARG(role); |
| 744 *role = MSAARole(); | 744 *role = MSAARole(); |
| 745 return S_OK; | 745 return S_OK; |
| 746 } | 746 } |
| 747 | 747 |
| 748 STDMETHODIMP AXPlatformNodeWin::get_states(AccessibleStates* states) { | 748 STDMETHODIMP AXPlatformNodeWin::get_states(AccessibleStates* states) { |
| 749 COM_OBJECT_VALIDATE_1_ARG(states); | 749 COM_OBJECT_VALIDATE_1_ARG(states); |
| 750 // There are only a couple of states we need to support | 750 *states = MSAA_IA2State(); |
| 751 // in IAccessible2. If any more are added, we may want to | |
| 752 // add a helper function like MSAAState. | |
| 753 *states = IA2_STATE_OPAQUE; | |
| 754 if (GetData().state & (1 << ui::AX_STATE_EDITABLE)) | |
| 755 *states |= IA2_STATE_EDITABLE; | |
| 756 if (GetData().state & (1 << ui::AX_STATE_VERTICAL)) | |
| 757 *states |= IA2_STATE_VERTICAL; | |
| 758 | |
| 759 return S_OK; | 751 return S_OK; |
| 760 } | 752 } |
| 761 | 753 |
| 762 STDMETHODIMP AXPlatformNodeWin::get_uniqueID(LONG* unique_id) { | 754 STDMETHODIMP AXPlatformNodeWin::get_uniqueID(LONG* unique_id) { |
| 763 COM_OBJECT_VALIDATE_1_ARG(unique_id); | 755 COM_OBJECT_VALIDATE_1_ARG(unique_id); |
| 764 *unique_id = -unique_id_; | 756 *unique_id = -unique_id_; |
| 765 return S_OK; | 757 return S_OK; |
| 766 } | 758 } |
| 767 | 759 |
| 768 STDMETHODIMP AXPlatformNodeWin::get_windowHandle(HWND* window_handle) { | 760 STDMETHODIMP AXPlatformNodeWin::get_windowHandle(HWND* window_handle) { |
| (...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1598 return false; | 1590 return false; |
| 1599 } | 1591 } |
| 1600 | 1592 |
| 1601 auto* parent = FromNativeViewAccessible(GetParent()); | 1593 auto* parent = FromNativeViewAccessible(GetParent()); |
| 1602 if (!parent) | 1594 if (!parent) |
| 1603 return false; | 1595 return false; |
| 1604 | 1596 |
| 1605 return parent->GetData().role == ui::AX_ROLE_IFRAME_PRESENTATIONAL; | 1597 return parent->GetData().role == ui::AX_ROLE_IFRAME_PRESENTATIONAL; |
| 1606 } | 1598 } |
| 1607 | 1599 |
| 1600 int32_t AXPlatformNodeWin::MSAA_IA2State() { | |
| 1601 const AXNodeData& data = GetData(); | |
|
dmazzoni
2017/07/06 22:54:57
Not sure how significant this is, but we're callin
dougt
2017/07/11 20:59:27
Acknowledged. Do you think we should measure the
| |
| 1602 | |
| 1603 int32_t ia2_state = IA2_STATE_OPAQUE; | |
| 1604 | |
| 1605 const auto checked_state = static_cast<ui::AXCheckedState>( | |
| 1606 GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); | |
| 1607 if (checked_state) { | |
| 1608 ia2_state |= IA2_STATE_CHECKABLE; | |
| 1609 } | |
| 1610 | |
| 1611 if (HasIntAttribute(ui::AX_ATTR_INVALID_STATE) && | |
| 1612 GetIntAttribute(ui::AX_ATTR_INVALID_STATE) != ui::AX_INVALID_STATE_FALSE) | |
| 1613 ia2_state |= IA2_STATE_INVALID_ENTRY; | |
| 1614 if (data.HasState(ui::AX_STATE_REQUIRED)) | |
| 1615 ia2_state |= IA2_STATE_REQUIRED; | |
| 1616 if (data.HasState(ui::AX_STATE_VERTICAL)) | |
| 1617 ia2_state |= IA2_STATE_VERTICAL; | |
| 1618 if (data.HasState(ui::AX_STATE_HORIZONTAL)) | |
| 1619 ia2_state |= IA2_STATE_HORIZONTAL; | |
| 1620 if (data.HasState(ui::AX_STATE_EDITABLE)) | |
| 1621 ia2_state |= IA2_STATE_EDITABLE; | |
| 1622 | |
| 1623 if (!GetStringAttribute(ui::AX_ATTR_AUTO_COMPLETE).empty()) | |
| 1624 ia2_state |= IA2_STATE_SUPPORTS_AUTOCOMPLETION; | |
| 1625 | |
| 1626 if (GetBoolAttribute(ui::AX_ATTR_MODAL)) | |
| 1627 ia2_state |= IA2_STATE_MODAL; | |
| 1628 | |
| 1629 switch (data.role) { | |
| 1630 case ui::AX_ROLE_MENU_LIST_POPUP: | |
| 1631 ia2_state &= ~(IA2_STATE_EDITABLE); | |
| 1632 break; | |
| 1633 case ui::AX_ROLE_MENU_LIST_OPTION: | |
| 1634 ia2_state &= ~(IA2_STATE_EDITABLE); | |
| 1635 break; | |
| 1636 case ui::AX_ROLE_SCROLL_AREA: | |
| 1637 ia2_state &= ~(IA2_STATE_EDITABLE); | |
| 1638 break; | |
| 1639 case ui::AX_ROLE_TEXT_FIELD: | |
| 1640 case ui::AX_ROLE_SEARCH_BOX: | |
| 1641 if (data.HasState(ui::AX_STATE_MULTILINE)) { | |
| 1642 ia2_state |= IA2_STATE_MULTI_LINE; | |
| 1643 } else { | |
| 1644 ia2_state |= IA2_STATE_SINGLE_LINE; | |
| 1645 } | |
| 1646 ia2_state |= IA2_STATE_SELECTABLE_TEXT; | |
| 1647 break; | |
| 1648 default: | |
| 1649 break; | |
| 1650 } | |
| 1651 return ia2_state; | |
| 1652 } | |
| 1653 | |
| 1608 bool AXPlatformNodeWin::ShouldNodeHaveReadonlyState( | 1654 bool AXPlatformNodeWin::ShouldNodeHaveReadonlyState( |
| 1609 const AXNodeData& data) const { | 1655 const AXNodeData& data) const { |
| 1610 if (data.GetBoolAttribute(ui::AX_ATTR_ARIA_READONLY)) | 1656 if (data.GetBoolAttribute(ui::AX_ATTR_ARIA_READONLY)) |
| 1611 return true; | 1657 return true; |
| 1612 | 1658 |
| 1613 if (!data.HasState(ui::AX_STATE_READ_ONLY)) | 1659 if (!data.HasState(ui::AX_STATE_READ_ONLY)) |
| 1614 return false; | 1660 return false; |
| 1615 | 1661 |
| 1616 switch (data.role) { | 1662 switch (data.role) { |
| 1617 case ui::AX_ROLE_ARTICLE: | 1663 case ui::AX_ROLE_ARTICLE: |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1941 } | 1987 } |
| 1942 | 1988 |
| 1943 if (!container) { | 1989 if (!container) { |
| 1944 return false; | 1990 return false; |
| 1945 } | 1991 } |
| 1946 | 1992 |
| 1947 return container->GetData().role == ui::AX_ROLE_TREE_GRID; | 1993 return container->GetData().role == ui::AX_ROLE_TREE_GRID; |
| 1948 } | 1994 } |
| 1949 | 1995 |
| 1950 } // namespace ui | 1996 } // namespace ui |
| OLD | NEW |