a11y atspi: Map GTK_ACCESSIBLE_PROPERTY_LEVEL to AT-SPI attr

Map GTK_ACCESSIBLE_PROPERTY_LEVEL to the corresponding
AT-SPI object attribute "level", as it is specified
e.g. in the Core Accessibility Mappings 1.2 for the
"aria-level" attribute, for both, headings [1] and
non-headings [2].

This e.g. makes reporting the header level via
AT-SPI work for the gtk4-based LibreOffice variant
when combined with the corresponding LibreOffice
change [3] to set the GTK_ACCESSIBLE_PROPERTY_LEVEL
property.

For a related discussion, see issue #6196.

[1] https://www.w3.org/TR/core-aam-1.2/#ariaLevelHeading
[2] https://www.w3.org/TR/core-aam-1.2/#ariaLevel
[3] https://gerrit.libreoffice.org/c/core/+/159216
This commit is contained in:
Michael Weghorn 2023-11-09 17:13:27 +01:00
parent a9e4993184
commit bcf78aeb39

View File

@ -528,6 +528,15 @@ handle_accessible_method (GDBusConnection *connection,
g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{ss}"));
g_variant_builder_add (&builder, "{ss}", "toolkit", "GTK");
if (gtk_at_context_has_accessible_property (GTK_AT_CONTEXT (self), GTK_ACCESSIBLE_PROPERTY_LEVEL))
{
GtkAccessibleValue *value = gtk_at_context_get_accessible_property (GTK_AT_CONTEXT (self),
GTK_ACCESSIBLE_PROPERTY_LEVEL);
char *level = g_strdup_printf ("%d", gtk_int_accessible_value_get (value));
g_variant_builder_add (&builder, "{ss}", "level", level);
g_free (level);
}
if (gtk_at_context_has_accessible_property (GTK_AT_CONTEXT (self), GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER))
{
GtkAccessibleValue *value;