Commit 92246cf9 authored by Joanmarie Diggs's avatar Joanmarie Diggs Committed by Commit Bot

Fire ATK text-attribute-changed when alignment or indentation change

Text alignment and indentation are being exposed as object attributes to
support IA2 and minimize work needed to calculate attributes which can
only apply to an entire object. However, ATK treats alignment as a text
attribute and platform ATs expect text-attribute-changed events (there
is no object-attribute-changed event in ATK). Therefore, fire an AtkText
text-attribute-changed event to notify ATs when either of these text
properties change. It is up to platform ATs to check object attributes
for these properties.

Bug: 1108872

AX-Relnotes: Orca now includes alignment and indentation when its font-
announcement command is used in Chrome/Chromium. It will be possible for
Orca to add support for presentation of changes to these properties.

Change-Id: I971777ba4a5f672bf129a4687ff2c54c250c41f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2343267
Commit-Queue: Joanmarie Diggs <jdiggs@igalia.com>
Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801815}
parent 6ced321b
...@@ -231,6 +231,7 @@ void BrowserAccessibilityManagerAndroid::FireGeneratedEvent( ...@@ -231,6 +231,7 @@ void BrowserAccessibilityManagerAndroid::FireGeneratedEvent(
break; break;
case ui::AXEventGenerator::Event::ACCESS_KEY_CHANGED: case ui::AXEventGenerator::Event::ACCESS_KEY_CHANGED:
case ui::AXEventGenerator::Event::ACTIVE_DESCENDANT_CHANGED: case ui::AXEventGenerator::Event::ACTIVE_DESCENDANT_CHANGED:
case ui::AXEventGenerator::Event::ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED:
case ui::AXEventGenerator::Event::ATOMIC_CHANGED: case ui::AXEventGenerator::Event::ATOMIC_CHANGED:
case ui::AXEventGenerator::Event::BUSY_CHANGED: case ui::AXEventGenerator::Event::BUSY_CHANGED:
case ui::AXEventGenerator::Event::AUTO_COMPLETE_CHANGED: case ui::AXEventGenerator::Event::AUTO_COMPLETE_CHANGED:
......
...@@ -203,9 +203,7 @@ void BrowserAccessibilityManagerAuraLinux::FireGeneratedEvent( ...@@ -203,9 +203,7 @@ void BrowserAccessibilityManagerAuraLinux::FireGeneratedEvent(
case ui::AXEventGenerator::Event::INVALID_STATUS_CHANGED: case ui::AXEventGenerator::Event::INVALID_STATUS_CHANGED:
FireEvent(node, ax::mojom::Event::kInvalidStatusChanged); FireEvent(node, ax::mojom::Event::kInvalidStatusChanged);
break; break;
case ui::AXEventGenerator::Event::OBJECT_ATTRIBUTE_CHANGED: case ui::AXEventGenerator::Event::ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED:
// TODO(1108872): Fire event.
break;
case ui::AXEventGenerator::Event::TEXT_ATTRIBUTE_CHANGED: case ui::AXEventGenerator::Event::TEXT_ATTRIBUTE_CHANGED:
FireTextAttributesChangedEvent(node); FireTextAttributesChangedEvent(node);
break; break;
...@@ -238,6 +236,7 @@ void BrowserAccessibilityManagerAuraLinux::FireGeneratedEvent( ...@@ -238,6 +236,7 @@ void BrowserAccessibilityManagerAuraLinux::FireGeneratedEvent(
case ui::AXEventGenerator::Event::LIVE_STATUS_CHANGED: case ui::AXEventGenerator::Event::LIVE_STATUS_CHANGED:
case ui::AXEventGenerator::Event::MULTILINE_STATE_CHANGED: case ui::AXEventGenerator::Event::MULTILINE_STATE_CHANGED:
case ui::AXEventGenerator::Event::MULTISELECTABLE_STATE_CHANGED: case ui::AXEventGenerator::Event::MULTISELECTABLE_STATE_CHANGED:
case ui::AXEventGenerator::Event::OBJECT_ATTRIBUTE_CHANGED:
case ui::AXEventGenerator::Event::OTHER_ATTRIBUTE_CHANGED: case ui::AXEventGenerator::Event::OTHER_ATTRIBUTE_CHANGED:
case ui::AXEventGenerator::Event::PLACEHOLDER_CHANGED: case ui::AXEventGenerator::Event::PLACEHOLDER_CHANGED:
case ui::AXEventGenerator::Event::PORTAL_ACTIVATED: case ui::AXEventGenerator::Event::PORTAL_ACTIVATED:
......
...@@ -406,6 +406,7 @@ void BrowserAccessibilityManagerMac::FireGeneratedEvent( ...@@ -406,6 +406,7 @@ void BrowserAccessibilityManagerMac::FireGeneratedEvent(
mac_notification = NSAccessibilityMenuItemSelectedNotification; mac_notification = NSAccessibilityMenuItemSelectedNotification;
break; break;
case ui::AXEventGenerator::Event::ACCESS_KEY_CHANGED: case ui::AXEventGenerator::Event::ACCESS_KEY_CHANGED:
case ui::AXEventGenerator::Event::ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED:
case ui::AXEventGenerator::Event::ATOMIC_CHANGED: case ui::AXEventGenerator::Event::ATOMIC_CHANGED:
case ui::AXEventGenerator::Event::AUTO_COMPLETE_CHANGED: case ui::AXEventGenerator::Event::AUTO_COMPLETE_CHANGED:
case ui::AXEventGenerator::Event::BUSY_CHANGED: case ui::AXEventGenerator::Event::BUSY_CHANGED:
......
...@@ -399,6 +399,7 @@ void BrowserAccessibilityManagerWin::FireGeneratedEvent( ...@@ -399,6 +399,7 @@ void BrowserAccessibilityManagerWin::FireGeneratedEvent(
case ui::AXEventGenerator::Event::WIN_IACCESSIBLE_STATE_CHANGED: case ui::AXEventGenerator::Event::WIN_IACCESSIBLE_STATE_CHANGED:
FireWinAccessibilityEvent(EVENT_OBJECT_STATECHANGE, node); FireWinAccessibilityEvent(EVENT_OBJECT_STATECHANGE, node);
break; break;
case ui::AXEventGenerator::Event::ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED:
case ui::AXEventGenerator::Event::AUTO_COMPLETE_CHANGED: case ui::AXEventGenerator::Event::AUTO_COMPLETE_CHANGED:
case ui::AXEventGenerator::Event::DOCUMENT_TITLE_CHANGED: case ui::AXEventGenerator::Event::DOCUMENT_TITLE_CHANGED:
case ui::AXEventGenerator::Event::FOCUS_CHANGED: case ui::AXEventGenerator::Event::FOCUS_CHANGED:
......
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
TEXT-ATTRIBUTES-CHANGED role=ROLE_SECTION name='(null)' ENABLED,SENSITIVE,SHOWING,VISIBLE
...@@ -198,6 +198,7 @@ api::automation::EventType ToAutomationEvent( ...@@ -198,6 +198,7 @@ api::automation::EventType ToAutomationEvent(
return api::automation::EVENT_TYPE_ARIAATTRIBUTECHANGED; return api::automation::EVENT_TYPE_ARIAATTRIBUTECHANGED;
case ui::AXEventGenerator::Event::ACCESS_KEY_CHANGED: case ui::AXEventGenerator::Event::ACCESS_KEY_CHANGED:
case ui::AXEventGenerator::Event::ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED:
case ui::AXEventGenerator::Event::ATOMIC_CHANGED: case ui::AXEventGenerator::Event::ATOMIC_CHANGED:
case ui::AXEventGenerator::Event::BUSY_CHANGED: case ui::AXEventGenerator::Event::BUSY_CHANGED:
case ui::AXEventGenerator::Event::CONTROLS_CHANGED: case ui::AXEventGenerator::Event::CONTROLS_CHANGED:
...@@ -357,6 +358,7 @@ api::automation::GeneratedEventType ToAutomationGeneratedEvent( ...@@ -357,6 +358,7 @@ api::automation::GeneratedEventType ToAutomationGeneratedEvent(
// relevant. // relevant.
case ui::AXEventGenerator::Event::ACTIVE_DESCENDANT_CHANGED: case ui::AXEventGenerator::Event::ACTIVE_DESCENDANT_CHANGED:
case ui::AXEventGenerator::Event::ALERT: case ui::AXEventGenerator::Event::ALERT:
case ui::AXEventGenerator::Event::ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED:
case ui::AXEventGenerator::Event::CHECKED_STATE_CHANGED: case ui::AXEventGenerator::Event::CHECKED_STATE_CHANGED:
case ui::AXEventGenerator::Event::CHILDREN_CHANGED: case ui::AXEventGenerator::Event::CHILDREN_CHANGED:
case ui::AXEventGenerator::Event::CONTROLS_CHANGED: case ui::AXEventGenerator::Event::CONTROLS_CHANGED:
......
...@@ -51,9 +51,12 @@ void RemoveEvent(std::set<AXEventGenerator::EventParams>* node_events, ...@@ -51,9 +51,12 @@ void RemoveEvent(std::set<AXEventGenerator::EventParams>* node_events,
// platforms likely will do that in response to ignored-changed. // platforms likely will do that in response to ignored-changed.
// Suppress name- and description-changed because those can be emitted as a side // Suppress name- and description-changed because those can be emitted as a side
// effect of calculating alternative text values for a newly-displayed object. // effect of calculating alternative text values for a newly-displayed object.
// Ditto for text attributes such as foreground and background colors. // Ditto for text attributes such as foreground and background colors, or
// display changing from "none" to "block."
void RemoveEventsDueToIgnoredChanged( void RemoveEventsDueToIgnoredChanged(
std::set<AXEventGenerator::EventParams>* node_events) { std::set<AXEventGenerator::EventParams>* node_events) {
RemoveEvent(node_events,
AXEventGenerator::Event::ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED);
RemoveEvent(node_events, AXEventGenerator::Event::CHILDREN_CHANGED); RemoveEvent(node_events, AXEventGenerator::Event::CHILDREN_CHANGED);
RemoveEvent(node_events, AXEventGenerator::Event::DESCRIPTION_CHANGED); RemoveEvent(node_events, AXEventGenerator::Event::DESCRIPTION_CHANGED);
RemoveEvent(node_events, AXEventGenerator::Event::NAME_CHANGED); RemoveEvent(node_events, AXEventGenerator::Event::NAME_CHANGED);
...@@ -392,6 +395,11 @@ void AXEventGenerator::OnIntAttributeChanged(AXTree* tree, ...@@ -392,6 +395,11 @@ void AXEventGenerator::OnIntAttributeChanged(AXTree* tree,
AddEvent(node, Event::TEXT_ATTRIBUTE_CHANGED); AddEvent(node, Event::TEXT_ATTRIBUTE_CHANGED);
break; break;
case ax::mojom::IntAttribute::kTextAlign: case ax::mojom::IntAttribute::kTextAlign:
// Alignment is exposed as an object attribute because it cannot apply to
// a substring. However, for some platforms (e.g. ATK), alignment is a
// text attribute. Therefore fire both events to ensure platforms get the
// expected notifications.
AddEvent(node, Event::ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED);
AddEvent(node, Event::OBJECT_ATTRIBUTE_CHANGED); AddEvent(node, Event::OBJECT_ATTRIBUTE_CHANGED);
break; break;
default: default:
...@@ -425,6 +433,11 @@ void AXEventGenerator::OnFloatAttributeChanged(AXTree* tree, ...@@ -425,6 +433,11 @@ void AXEventGenerator::OnFloatAttributeChanged(AXTree* tree,
AddEvent(node, Event::TEXT_ATTRIBUTE_CHANGED); AddEvent(node, Event::TEXT_ATTRIBUTE_CHANGED);
break; break;
case ax::mojom::FloatAttribute::kTextIndent: case ax::mojom::FloatAttribute::kTextIndent:
// Indentation is exposed as an object attribute because it cannot apply
// to a substring. However, for some platforms (e.g. ATK), alignment is a
// text attribute. Therefore fire both events to ensure platforms get the
// expected notifications.
AddEvent(node, Event::ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED);
AddEvent(node, Event::OBJECT_ATTRIBUTE_CHANGED); AddEvent(node, Event::OBJECT_ATTRIBUTE_CHANGED);
break; break;
default: default:
...@@ -834,6 +847,8 @@ const char* ToString(AXEventGenerator::Event event) { ...@@ -834,6 +847,8 @@ const char* ToString(AXEventGenerator::Event event) {
return "ACTIVE_DESCENDANT_CHANGED"; return "ACTIVE_DESCENDANT_CHANGED";
case AXEventGenerator::Event::ALERT: case AXEventGenerator::Event::ALERT:
return "ALERT"; return "ALERT";
case AXEventGenerator::Event::ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED:
return "ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED";
case AXEventGenerator::Event::BUSY_CHANGED: case AXEventGenerator::Event::BUSY_CHANGED:
return "BUSY_CHANGED"; return "BUSY_CHANGED";
case AXEventGenerator::Event::CHECKED_STATE_CHANGED: case AXEventGenerator::Event::CHECKED_STATE_CHANGED:
......
...@@ -28,6 +28,10 @@ class AX_EXPORT AXEventGenerator : public AXTreeObserver { ...@@ -28,6 +28,10 @@ class AX_EXPORT AXEventGenerator : public AXTreeObserver {
ACCESS_KEY_CHANGED, ACCESS_KEY_CHANGED,
ACTIVE_DESCENDANT_CHANGED, ACTIVE_DESCENDANT_CHANGED,
ALERT, ALERT,
// ATK treats alignment, indentation, and other format-related attributes as
// text attributes even when they are only applicable to the entire object.
// And it lacks an event for object attributes changing.
ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED,
ATOMIC_CHANGED, ATOMIC_CHANGED,
AUTO_COMPLETE_CHANGED, AUTO_COMPLETE_CHANGED,
BUSY_CHANGED, BUSY_CHANGED,
......
...@@ -806,6 +806,10 @@ TEST(AXEventGeneratorTest, ObjectAttributeChanged) { ...@@ -806,6 +806,10 @@ TEST(AXEventGeneratorTest, ObjectAttributeChanged) {
EXPECT_THAT( EXPECT_THAT(
event_generator, event_generator,
UnorderedElementsAre( UnorderedElementsAre(
HasEventAtNode(
AXEventGenerator::Event::ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED, 2),
HasEventAtNode(
AXEventGenerator::Event::ATK_TEXT_OBJECT_ATTRIBUTE_CHANGED, 3),
HasEventAtNode(AXEventGenerator::Event::OBJECT_ATTRIBUTE_CHANGED, 2), HasEventAtNode(AXEventGenerator::Event::OBJECT_ATTRIBUTE_CHANGED, 2),
HasEventAtNode(AXEventGenerator::Event::OBJECT_ATTRIBUTE_CHANGED, HasEventAtNode(AXEventGenerator::Event::OBJECT_ATTRIBUTE_CHANGED,
3))); 3)));
......
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