Commit 51332db4 authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Do not expose ROLE_SYSTEM_WINDOW for our root object

Do not return ROLE_SYSTEM_WINDOW ourselves as that is a special MSAA
system role used to indicate a real native window object. It is
automatically created by oleacc.dll as a parent of the root of our
hierarchy, matching the HWND.

For AX_ROLE_WINDOW, we should expose something similar to what Firefox
exposes, namely ROLE_SYSTEM_APPLICATION.

This helps NVDA not read superfluous text when the user navigates
to the toolbar or location bar.

Bug: 794931
Change-Id: I123f07cb477304da1f016d65ea8c2b23b7a92ef4
Reviewed-on: https://chromium-review.googlesource.com/826866Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524102}
parent 6e4b9bd4
...@@ -2914,7 +2914,11 @@ int AXPlatformNodeWin::MSAARole() { ...@@ -2914,7 +2914,11 @@ int AXPlatformNodeWin::MSAARole() {
return ROLE_SYSTEM_GROUPING; return ROLE_SYSTEM_GROUPING;
case AX_ROLE_WINDOW: case AX_ROLE_WINDOW:
return ROLE_SYSTEM_WINDOW; // Do not return ROLE_SYSTEM_WINDOW as that is a special MSAA system role
// used to indicate a real native window object. It is automatically
// created by oleacc.dll as a parent of the root of our hierarchy,
// matching the HWND.
return ROLE_SYSTEM_APPLICATION;
// TODO(dmazzoni): figure out the proper MSAA role for roles listed below. // TODO(dmazzoni): figure out the proper MSAA role for roles listed below.
case AX_ROLE_BLOCKQUOTE: case AX_ROLE_BLOCKQUOTE:
......
...@@ -280,5 +280,22 @@ TEST_F(NativeViewAccessibilityWinTest, GetAllOwnedWidgetsCrash) { ...@@ -280,5 +280,22 @@ TEST_F(NativeViewAccessibilityWinTest, GetAllOwnedWidgetsCrash) {
EXPECT_EQ(1L, child_count); EXPECT_EQ(1L, child_count);
} }
TEST_F(NativeViewAccessibilityWinTest, WindowHasRoleApplication) {
// We expect that our internal window object does not expose
// ROLE_SYSTEM_WINDOW, but ROLE_SYSTEM_APPLICATION instead.
Widget widget;
Widget::InitParams init_params =
CreateParams(Widget::InitParams::TYPE_WINDOW);
init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
widget.Init(init_params);
ComPtr<IAccessible> accessible(
widget.GetRootView()->GetNativeViewAccessible());
ScopedVariant childid_self(CHILDID_SELF);
ScopedVariant role;
EXPECT_EQ(S_OK, accessible->get_accRole(childid_self, role.Receive()));
EXPECT_EQ(role.type(), VT_I4);
EXPECT_EQ(V_I4(role.ptr()), ROLE_SYSTEM_APPLICATION);
}
} // namespace test } // namespace test
} // namespace views } // namespace views
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment