diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2020-11-11 19:37:26 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2020-11-11 19:45:43 +0000 |
commit | 292576f3129a1bd73d3b5b4ad0e41d70df1c805e (patch) | |
tree | 870de4121f739f83f50aecc7abd550c028210ef9 | |
parent | 228538207470d41f0c6be6bd989b56307da4a749 (diff) | |
download | gtk+-292576f3129a1bd73d3b5b4ad0e41d70df1c805e.tar.gz |
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.
-rw-r--r-- | gtk/gtkaccessible.c | 10 | ||||
-rw-r--r-- | gtk/gtktestatcontext.c | 8 |
2 files changed, 8 insertions, 10 deletions
diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c index e9f8d7d663..991bc02756 100644 --- a/gtk/gtkaccessible.c +++ b/gtk/gtkaccessible.c @@ -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); + + g_object_get (G_OBJECT (self), "accessible-role", &role, NULL); - return gtk_at_context_get_accessible_role (context); + return role; } /** diff --git a/gtk/gtktestatcontext.c b/gtk/gtktestatcontext.c index c8bd222d1a..27ad90da67 100644 --- a/gtk/gtktestatcontext.c +++ b/gtk/gtktestatcontext.c @@ -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 |