Commit 84dd920d authored by Martin Robinson's avatar Martin Robinson Committed by Commit Bot

Convert Window role to ATK_ROLE_FRAME for Aura Linux

Instead of using ATK_ROLE_WINDOW by default for the internal Window
accessibility role, use ATK_ROLE_FRAME. ATK_ROLE_FRAME is used for
windows that have titlebars and buttons, while ATK_ROLE_WINDOW is
reserved for those that don't. Since most windows have buttons and a
titlebar in Chromium, ATK_ROLE_FRAME is probably a better default.

TEST=accessibility_unittests --gtest_filter=AXPlatformNodeAuraLinuxTest.*

Bug: 867006
Change-Id: Ia0366f7088465f123f00e250c4cc6f7393c0c64e
Reviewed-on: https://chromium-review.googlesource.com/1148445
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578665}
parent 6e378c90
...@@ -352,7 +352,7 @@ static gfx::Point FindAtkObjectParentCoords(AtkObject* atk_object) { ...@@ -352,7 +352,7 @@ static gfx::Point FindAtkObjectParentCoords(AtkObject* atk_object) {
if (!atk_object) if (!atk_object)
return gfx::Point(0, 0); return gfx::Point(0, 0);
if (atk_object_get_role(atk_object) == ATK_ROLE_WINDOW) { if (atk_object_get_role(atk_object) == ATK_ROLE_FRAME) {
int x, y; int x, y;
atk_component_get_extents(ATK_COMPONENT(atk_object), atk_component_get_extents(ATK_COMPONENT(atk_object),
&x, &y, nullptr, nullptr, ATK_XY_WINDOW); &x, &y, nullptr, nullptr, ATK_XY_WINDOW);
...@@ -1294,7 +1294,10 @@ AtkRole AXPlatformNodeAuraLinux::GetAtkRole() { ...@@ -1294,7 +1294,10 @@ AtkRole AXPlatformNodeAuraLinux::GetAtkRole() {
case ax::mojom::Role::kWebView: case ax::mojom::Role::kWebView:
return ATK_ROLE_DOCUMENT_WEB; return ATK_ROLE_DOCUMENT_WEB;
case ax::mojom::Role::kWindow: case ax::mojom::Role::kWindow:
return ATK_ROLE_WINDOW; // In ATK elements with ATK_ROLE_FRAME are windows with titles and
// buttons, while those with ATK_ROLE_WINDOW are windows without those
// elements.
return ATK_ROLE_FRAME;
case ax::mojom::Role::kClient: case ax::mojom::Role::kClient:
case ax::mojom::Role::kDesktop: case ax::mojom::Role::kDesktop:
case ax::mojom::Role::kFigcaption: case ax::mojom::Role::kFigcaption:
......
...@@ -188,6 +188,14 @@ TEST_F(AXPlatformNodeAuraLinuxTest, TestAtkObjectRole) { ...@@ -188,6 +188,14 @@ TEST_F(AXPlatformNodeAuraLinuxTest, TestAtkObjectRole) {
g_object_ref(child_obj); g_object_ref(child_obj);
EXPECT_EQ(ATK_ROLE_EMBEDDED, atk_object_get_role(child_obj)); EXPECT_EQ(ATK_ROLE_EMBEDDED, atk_object_get_role(child_obj));
g_object_unref(child_obj); g_object_unref(child_obj);
child.role = ax::mojom::Role::kWindow;
child_node->SetData(child);
child_obj = AtkObjectFromNode(child_node);
ASSERT_TRUE(ATK_IS_OBJECT(child_obj));
g_object_ref(child_obj);
EXPECT_EQ(ATK_ROLE_FRAME, atk_object_get_role(child_obj));
g_object_unref(child_obj);
} }
TEST_F(AXPlatformNodeAuraLinuxTest, TestAtkObjectState) { TEST_F(AXPlatformNodeAuraLinuxTest, TestAtkObjectState) {
......
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