Commit 62eefcde authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Commit Bot

[a11y] Disable the function to enable AX mode through ATK calls

This CL disables the function to enable AX mode through ATK calls
since it seems to enable it even when it's not required. After
figuring out what API causes false positives, it will be enabled.

APIs on Linux and enabling AX mode is allowed with the command
line option, '--force-renderer-accessibility'.

Bug: 1086506
AX-Relnotes: It disables automatic enabling AX mode on using ATK
Change-Id: I6c0b865349d4f965700bf0ff0639f0508e712de5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2216135
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772255}
parent af12bc9f
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/memory/singleton.h" #include "base/memory/singleton.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "ui/accessibility/platform/atk_util_auralinux.h" #include "ui/accessibility/platform/atk_util_auralinux.h"
#include "ui/accessibility/platform/ax_platform_node.h"
#include "ui/accessibility/platform/ax_platform_node_auralinux.h" #include "ui/accessibility/platform/ax_platform_node_auralinux.h"
namespace { namespace {
...@@ -55,6 +56,10 @@ static KeySnoopFuncMap& GetActiveKeySnoopFunctions() { ...@@ -55,6 +56,10 @@ static KeySnoopFuncMap& GetActiveKeySnoopFunctions() {
static guint AtkUtilAuraLinuxAddKeyEventListener( static guint AtkUtilAuraLinuxAddKeyEventListener(
AtkKeySnoopFunc key_snoop_function, AtkKeySnoopFunc key_snoop_function,
gpointer data) { gpointer data) {
if (!ui::AXPlatformNode::GetAccessibilityMode().has_mode(
ui::AXMode::kNativeAPIs))
return 0;
static guint current_key_event_listener_id = 0; static guint current_key_event_listener_id = 0;
current_key_event_listener_id++; current_key_event_listener_id++;
......
...@@ -2028,7 +2028,7 @@ const gchar* GetName(AtkObject* atk_object) { ...@@ -2028,7 +2028,7 @@ const gchar* GetName(AtkObject* atk_object) {
} }
const gchar* AtkGetName(AtkObject* atk_object) { const gchar* AtkGetName(AtkObject* atk_object) {
AXPlatformNode::NotifyAddAXModeFlags(kAXModeComplete); AXPlatformNodeAuraLinux::EnableAXMode();
return GetName(atk_object); return GetName(atk_object);
} }
...@@ -2045,7 +2045,7 @@ const gchar* GetDescription(AtkObject* atk_object) { ...@@ -2045,7 +2045,7 @@ const gchar* GetDescription(AtkObject* atk_object) {
} }
const gchar* AtkGetDescription(AtkObject* atk_object) { const gchar* AtkGetDescription(AtkObject* atk_object) {
AXPlatformNode::NotifyAddAXModeFlags(kAXModeComplete); AXPlatformNodeAuraLinux::EnableAXMode();
return GetDescription(atk_object); return GetDescription(atk_object);
} }
...@@ -2061,7 +2061,7 @@ gint GetNChildren(AtkObject* atk_object) { ...@@ -2061,7 +2061,7 @@ gint GetNChildren(AtkObject* atk_object) {
} }
gint AtkGetNChildren(AtkObject* atk_object) { gint AtkGetNChildren(AtkObject* atk_object) {
AXPlatformNode::NotifyAddAXModeFlags(kAXModeComplete); AXPlatformNodeAuraLinux::EnableAXMode();
return GetNChildren(atk_object); return GetNChildren(atk_object);
} }
...@@ -2083,7 +2083,7 @@ AtkObject* RefChild(AtkObject* atk_object, gint index) { ...@@ -2083,7 +2083,7 @@ AtkObject* RefChild(AtkObject* atk_object, gint index) {
} }
AtkObject* AtkRefChild(AtkObject* atk_object, gint index) { AtkObject* AtkRefChild(AtkObject* atk_object, gint index) {
AXPlatformNode::NotifyAddAXModeFlags(kAXModeComplete); AXPlatformNodeAuraLinux::EnableAXMode();
return RefChild(atk_object, index); return RefChild(atk_object, index);
} }
...@@ -2099,7 +2099,7 @@ gint GetIndexInParent(AtkObject* atk_object) { ...@@ -2099,7 +2099,7 @@ gint GetIndexInParent(AtkObject* atk_object) {
} }
gint AtkGetIndexInParent(AtkObject* atk_object) { gint AtkGetIndexInParent(AtkObject* atk_object) {
AXPlatformNode::NotifyAddAXModeFlags(kAXModeComplete); AXPlatformNodeAuraLinux::EnableAXMode();
return GetIndexInParent(atk_object); return GetIndexInParent(atk_object);
} }
...@@ -2115,7 +2115,7 @@ AtkObject* GetParent(AtkObject* atk_object) { ...@@ -2115,7 +2115,7 @@ AtkObject* GetParent(AtkObject* atk_object) {
} }
AtkObject* AtkGetParent(AtkObject* atk_object) { AtkObject* AtkGetParent(AtkObject* atk_object) {
AXPlatformNode::NotifyAddAXModeFlags(kAXModeComplete); AXPlatformNodeAuraLinux::EnableAXMode();
return GetParent(atk_object); return GetParent(atk_object);
} }
...@@ -2130,7 +2130,7 @@ AtkRelationSet* RefRelationSet(AtkObject* atk_object) { ...@@ -2130,7 +2130,7 @@ AtkRelationSet* RefRelationSet(AtkObject* atk_object) {
} }
AtkRelationSet* AtkRefRelationSet(AtkObject* atk_object) { AtkRelationSet* AtkRefRelationSet(AtkObject* atk_object) {
AXPlatformNode::NotifyAddAXModeFlags(kAXModeComplete); AXPlatformNodeAuraLinux::EnableAXMode();
return RefRelationSet(atk_object); return RefRelationSet(atk_object);
} }
...@@ -2146,7 +2146,7 @@ AtkAttributeSet* GetAttributes(AtkObject* atk_object) { ...@@ -2146,7 +2146,7 @@ AtkAttributeSet* GetAttributes(AtkObject* atk_object) {
} }
AtkAttributeSet* AtkGetAttributes(AtkObject* atk_object) { AtkAttributeSet* AtkGetAttributes(AtkObject* atk_object) {
AXPlatformNode::NotifyAddAXModeFlags(kAXModeComplete); AXPlatformNodeAuraLinux::EnableAXMode();
return GetAttributes(atk_object); return GetAttributes(atk_object);
} }
...@@ -2161,7 +2161,7 @@ AtkRole GetRole(AtkObject* atk_object) { ...@@ -2161,7 +2161,7 @@ AtkRole GetRole(AtkObject* atk_object) {
} }
AtkRole AtkGetRole(AtkObject* atk_object) { AtkRole AtkGetRole(AtkObject* atk_object) {
AXPlatformNode::NotifyAddAXModeFlags(kAXModeComplete); AXPlatformNodeAuraLinux::EnableAXMode();
return GetRole(atk_object); return GetRole(atk_object);
} }
...@@ -2183,7 +2183,7 @@ AtkStateSet* RefStateSet(AtkObject* atk_object) { ...@@ -2183,7 +2183,7 @@ AtkStateSet* RefStateSet(AtkObject* atk_object) {
} }
AtkStateSet* AtkRefStateSet(AtkObject* atk_object) { AtkStateSet* AtkRefStateSet(AtkObject* atk_object) {
AXPlatformNode::NotifyAddAXModeFlags(kAXModeComplete); AXPlatformNodeAuraLinux::EnableAXMode();
return RefStateSet(atk_object); return RefStateSet(atk_object);
} }
...@@ -2549,6 +2549,14 @@ void AXPlatformNodeAuraLinux::StaticInitialize() { ...@@ -2549,6 +2549,14 @@ void AXPlatformNodeAuraLinux::StaticInitialize() {
AtkUtilAuraLinux::GetInstance()->InitializeAsync(); AtkUtilAuraLinux::GetInstance()->InitializeAsync();
} }
// static
void AXPlatformNodeAuraLinux::EnableAXMode() {
// TODO(https://crbug.com/1086506): After figuring out what API calls are
// giving us false positives, enable it again. For now, don't activate AX
// through ATK calls.
// AXPlatformNode::NotifyAddAXModeFlags(kAXModeComplete);
}
AtkRole AXPlatformNodeAuraLinux::GetAtkRole() const { AtkRole AXPlatformNodeAuraLinux::GetAtkRole() const {
switch (GetData().role) { switch (GetData().role) {
case ax::mojom::Role::kAlert: case ax::mojom::Role::kAlert:
......
...@@ -133,6 +133,10 @@ class AX_EXPORT AXPlatformNodeAuraLinux : public AXPlatformNodeBase { ...@@ -133,6 +133,10 @@ class AX_EXPORT AXPlatformNodeAuraLinux : public AXPlatformNodeBase {
// Do asynchronous static initialization. // Do asynchronous static initialization.
static void StaticInitialize(); static void StaticInitialize();
// Enables AXMode calling AXPlatformNode::NotifyAddAXModeFlags. It's used
// when ATK APIs are called.
static void EnableAXMode();
// EnsureAtkObjectIsValid will destroy and recreate |atk_object_| if the // EnsureAtkObjectIsValid will destroy and recreate |atk_object_| if the
// interface mask is different. This partially relies on looking at the tree's // interface mask is different. This partially relies on looking at the tree's
// structure. This must not be called when the tree is unstable e.g. in the // structure. This must not be called when the tree is unstable e.g. in the
......
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