Commit 08c6d4dd authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Commit Bot

a11y: Return if AXPlatformNodeAuraLinux doesn't have AtkObject

This CL fixes the assertion 'G_IS_OBJECT (object)' with an early
return if AXPlatformNodeAuraLinux doesn't have AtkObject as
GetOrCreateAtkObject() could return nullptr if AX mode is not
enabled.

It also updates |accessibility_mode_| from
BrowserAccessibilityStateImpl using AddAccessibilityModeFlags
instead of direct assigning since it should call
NotifyAddAXModeFlags() together when the mode is updated to sync
it with the mode from AXPlatformNodeAuraLinux.

Bug: 1061429
Change-Id: I0b4fa09d8d788608a403383c9e2c6123c618ccc9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2103997Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#751904}
parent deed183e
...@@ -125,7 +125,7 @@ void BrowserAccessibilityStateImpl::ResetAccessibilityModeValue() { ...@@ -125,7 +125,7 @@ void BrowserAccessibilityStateImpl::ResetAccessibilityModeValue() {
accessibility_mode_ = ui::AXMode(); accessibility_mode_ = ui::AXMode();
if (base::CommandLine::ForCurrentProcess()->HasSwitch( if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kForceRendererAccessibility)) { switches::kForceRendererAccessibility)) {
accessibility_mode_ = ui::kAXModeComplete; AddAccessibilityModeFlags(ui::kAXModeComplete);
} }
} }
......
...@@ -307,6 +307,8 @@ class AX_EXPORT AXPlatformNodeAuraLinux : public AXPlatformNodeBase { ...@@ -307,6 +307,8 @@ class AX_EXPORT AXPlatformNodeAuraLinux : public AXPlatformNodeBase {
GType GetAccessibilityGType(); GType GetAccessibilityGType();
AtkObject* CreateAtkObject(); AtkObject* CreateAtkObject();
// Get or Create AtkObject. Note that it could return nullptr except
// ax::mojom::Role::kApplication when the mode is not enabled.
gfx::NativeViewAccessible GetOrCreateAtkObject(); gfx::NativeViewAccessible GetOrCreateAtkObject();
void DestroyAtkObjects(); void DestroyAtkObjects();
void AddRelationToSet(AtkRelationSet*, void AddRelationToSet(AtkRelationSet*,
......
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