Chromium Code Reviews| Index: ui/accessibility/platform/ax_platform_node_win.cc |
| diff --git a/ui/accessibility/platform/ax_platform_node_win.cc b/ui/accessibility/platform/ax_platform_node_win.cc |
| index 1d7d95df5c701963ab1d15427d5b890799965f19..cb94df0acdc23b5035f45d103f881004b352bf9d 100644 |
| --- a/ui/accessibility/platform/ax_platform_node_win.cc |
| +++ b/ui/accessibility/platform/ax_platform_node_win.cc |
| @@ -1189,6 +1189,13 @@ STDMETHODIMP AXPlatformNodeWin::QueryService( |
| // Private member functions. |
| // |
| int AXPlatformNodeWin::MSAARole() { |
| + // If this is a web area for a presentational iframe, give it a role of |
| + // something other than DOCUMENT so that the fact that it's a separate doc |
| + // is not exposed to AT. |
| + if (IsWebAreaForPresentationalIframe()) { |
| + return ROLE_SYSTEM_GROUPING; |
| + } |
| + |
| switch (GetData().role) { |
| case ui::AX_ROLE_ALERT: |
| return ROLE_SYSTEM_ALERT; |
| @@ -1367,6 +1374,9 @@ int AXPlatformNodeWin::MSAARole() { |
| case ui::AX_ROLE_MENU_LIST_OPTION: |
| return ROLE_SYSTEM_LISTITEM; |
| + case ui::AX_ROLE_METER: |
| + return ROLE_SYSTEM_PROGRESSBAR; |
| + |
| case ui::AX_ROLE_NAVIGATION: |
| return ROLE_SYSTEM_GROUPING; |
| @@ -1404,16 +1414,7 @@ int AXPlatformNodeWin::MSAARole() { |
| case ui::AX_ROLE_ROW: { |
| // Role changes depending on whether row is inside a treegrid |
| // https://www.w3.org/TR/core-aam-1.1/#role-map-row |
| - auto* container = FromNativeViewAccessible(GetParent()); |
| - if (container && container->GetData().role == ui::AX_ROLE_GROUP) { |
| - // If parent was a rowgroup, we need to look at the grandparent |
| - container = FromNativeViewAccessible(container->GetParent()); |
| - } |
| - |
| - if (!container) |
| - return ROLE_SYSTEM_ROW; |
| - |
| - return ROLE_SYSTEM_OUTLINEITEM; |
| + return IsInTreeGrid() ? ROLE_SYSTEM_OUTLINEITEM : ROLE_SYSTEM_ROW; |
| } |
| case ui::AX_ROLE_ROW_HEADER: |
| @@ -1513,11 +1514,38 @@ int AXPlatformNodeWin::MSAARole() { |
| case ui::AX_ROLE_WINDOW: |
| return ROLE_SYSTEM_WINDOW; |
| - // TODO(dmazzoni): figure out the proper MSAA role for roles not called out |
| - // here. |
| - default: |
| + // TODO(dmazzoni): figure out the proper MSAA role for roles listed below. |
| + case AX_ROLE_BLOCKQUOTE: |
| + case AX_ROLE_BUTTON_DROP_DOWN: |
| + case AX_ROLE_CARET: |
| + case AX_ROLE_CLIENT: |
| + case AX_ROLE_DEFINITION: |
| + case AX_ROLE_DESKTOP: |
| + case AX_ROLE_DIRECTORY: |
| + case AX_ROLE_FIGCAPTION: |
| + case AX_ROLE_FOOTER: |
| + case AX_ROLE_FORM: |
| + case AX_ROLE_IGNORED: |
| + case AX_ROLE_IMAGE_MAP: |
| + case AX_ROLE_INLINE_TEXT_BOX: |
| + case AX_ROLE_LOCATION_BAR: |
| + case AX_ROLE_LOG: |
| + case AX_ROLE_NONE: |
| + case AX_ROLE_PANE: |
| + case AX_ROLE_PARAGRAPH: |
| + case AX_ROLE_PRESENTATIONAL: |
| + case AX_ROLE_SEAMLESS_WEB_AREA: |
| + case AX_ROLE_SLIDER_THUMB: |
| + case AX_ROLE_SWITCH: |
| + case AX_ROLE_TAB_GROUP: |
| + case AX_ROLE_TITLE_BAR: |
| + case AX_ROLE_UNKNOWN: |
| + case AX_ROLE_WEB_VIEW: |
| return ROLE_SYSTEM_CLIENT; |
| } |
| + |
| + NOTREACHED(); |
| + return ROLE_SYSTEM_CLIENT; |
| } |
| std::string AXPlatformNodeWin::StringOverrideForMSAARole() { |
| @@ -1564,6 +1592,19 @@ std::string AXPlatformNodeWin::StringOverrideForMSAARole() { |
| return ""; |
| } |
| +bool AXPlatformNodeWin::IsWebAreaForPresentationalIframe() { |
| + if (GetData().role != ui::AX_ROLE_WEB_AREA && |
| + GetData().role != ui::AX_ROLE_ROOT_WEB_AREA) { |
| + return false; |
| + } |
| + |
| + auto* parent = FromNativeViewAccessible(GetParent()); |
| + if (!parent) |
| + return false; |
| + |
| + return parent->GetData().role == ui::AX_ROLE_IFRAME_PRESENTATIONAL; |
| +} |
| + |
| bool AXPlatformNodeWin::ShouldNodeHaveReadonlyState( |
| const AXNodeData& data) const { |
| if (data.GetBoolAttribute(ui::AX_ATTR_ARIA_READONLY)) |
| @@ -1891,4 +1932,19 @@ AXPlatformNodeWin* AXPlatformNodeWin::GetTargetFromChildID( |
| return static_cast<AXPlatformNodeWin*>(base); |
| } |
| +bool AXPlatformNodeWin::IsInTreeGrid() { |
| + auto* container = FromNativeViewAccessible(GetParent()); |
| + |
| + if (container && container->GetData().role == ui::AX_ROLE_GROUP) { |
| + // If parent was a rowgroup, we need to look at the grandparent |
|
dmazzoni
2017/07/06 22:48:28
nit: move comment above and get rid of {}
dougt
2017/07/11 17:37:44
Done.
|
| + container = FromNativeViewAccessible(container->GetParent()); |
| + } |
| + |
| + if (!container) { |
|
dmazzoni
2017/07/06 22:48:28
nit: remove {}
dougt
2017/07/11 17:37:44
Done.
|
| + return false; |
| + } |
| + |
| + return container->GetData().role == ui::AX_ROLE_TREE_GRID; |
| +} |
| + |
| } // namespace ui |