a11y: Defer to the GtkAccessible's implementation

Since GtkATContexts are now lazily realized, we need to go through the
GtkAccessible's implementation to access the :accessible-role property,
in case there are fallbacks.
This commit is contained in:
Emmanuele Bassi 2020-11-11 19:37:26 +00:00
parent 2285382074
commit 292576f312
2 changed files with 8 additions and 10 deletions

View File

@ -104,13 +104,17 @@ gtk_accessible_get_at_context (GtkAccessible *self)
GtkAccessibleRole
gtk_accessible_get_accessible_role (GtkAccessible *self)
{
GtkAccessibleRole role;
g_return_val_if_fail (GTK_IS_ACCESSIBLE (self), GTK_ACCESSIBLE_ROLE_NONE);
GtkATContext *context = gtk_accessible_get_at_context (self);
if (context == NULL)
return GTK_ACCESSIBLE_ROLE_NONE;
if (context != NULL && gtk_at_context_is_realized (context))
return gtk_at_context_get_accessible_role (context);
return gtk_at_context_get_accessible_role (context);
g_object_get (G_OBJECT (self), "accessible-role", &role, NULL);
return role;
}
/**

View File

@ -118,15 +118,9 @@ gboolean
gtk_test_accessible_has_role (GtkAccessible *accessible,
GtkAccessibleRole role)
{
GtkATContext *context;
g_return_val_if_fail (GTK_IS_ACCESSIBLE (accessible), FALSE);
context = gtk_accessible_get_at_context (accessible);
if (context == NULL)
return FALSE;
return gtk_at_context_get_accessible_role (context) == role;
return gtk_accessible_get_accessible_role (accessible) == role;
}
gboolean