tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit fe705f5d1467ed63cc38170af8f3fa173b868c41
parent 76065bbb6c97a3fc5a3ede758e429e74540514ca
Author: Eitan Isaacson <eitan@monotonous.org>
Date:   Thu, 30 Oct 2025 23:56:43 +0000

Bug 1997241 - Mirror ATK action description into localized name. r=Jamie

This puts us in line with our IA2 implementation.

Differential Revision: https://phabricator.services.mozilla.com/D270763

Diffstat:
Maccessible/atk/nsMaiInterfaceAction.cpp | 34++++------------------------------
Maccessible/tests/browser/atk/browser_action.js | 6+++---
2 files changed, 7 insertions(+), 33 deletions(-)

diff --git a/accessible/atk/nsMaiInterfaceAction.cpp b/accessible/atk/nsMaiInterfaceAction.cpp @@ -88,7 +88,8 @@ static const gchar* getActionDescriptionCB(AtkAction* aAction, if (target->HasPrimaryAction()) { MOZ_ASSERT(target->ActionCount() > 0); if (actionIndex == aActionIndex) { - target->ActionDescriptionAt(0, description); + // Use target's name as action description. + target->Name(description); break; } actionIndex++; @@ -144,35 +145,8 @@ static const gchar* getActionNameCB(AtkAction* aAction, gint aActionIndex) { static const gchar* getActionLocalizedNameCB(AtkAction* aAction, gint aActionIndex) { - AtkObject* atkObject = ATK_OBJECT(aAction); - nsAutoString name; - Accessible* acc = GetInternalObj(atkObject); - if (!acc) { - // If we don't have an Accessible, we can't have any actions. - return 0; - } - - if (aActionIndex >= acc->ActionCount()) { - // Check for custom actions. - Relation customActions(acc->RelationByType(RelationType::ACTION)); - gint actionIndex = acc->ActionCount(); - while (Accessible* target = customActions.Next()) { - if (target->HasPrimaryAction()) { - MOZ_ASSERT(target->ActionCount() > 0); - if (actionIndex == aActionIndex) { - target->Name(name); - break; - } - actionIndex++; - } - } - } - - if (!name.IsEmpty()) { - return AccessibleWrap::ReturnString(name); - } - - return nullptr; + // Mirror action description into localized name. + return getActionDescriptionCB(aAction, aActionIndex); } static const gchar* getKeyBindingCB(AtkAction* aAction, gint aActionIndex) { diff --git a/accessible/tests/browser/atk/browser_action.js b/accessible/tests/browser/atk/browser_action.js @@ -19,7 +19,7 @@ addAccessibleTask( btn = findByDomId(doc, "btn").queryAction() return str([[btn.getName(i), btn.getLocalizedName(i), btn.getDescription(i)] for i in range(btn.get_nActions())]) `); - is(actions, "[['press', '', 'Press']]", "btn has correct actions"); + is(actions, "[['press', 'Press', 'Press']]", "btn has correct actions"); const nameChanged = waitForEvent(EVENT_NAME_CHANGE, "btn"); await runPython(` @@ -58,7 +58,7 @@ addAccessibleTask( `); is( actions, - "[['custom_btn1', 'Close', 'Press']]", + "[['custom_btn1', 'Close', 'Close']]", "dlg1 has correct actions" ); @@ -77,7 +77,7 @@ addAccessibleTask( `); is( actions, - "[['click', '', 'Click'], ['custom_btn2', 'Close', 'Press']]", + "[['click', 'Click', 'Click'], ['custom_btn2', 'Close', 'Close']]", "dlg2 has correct actions" );