a11y: Get the accessible role once

Simplify getting the accessible role when checking if an accessible
implementation should present itself; this avoids going through
GtkAccessible twice to get the same data.
This commit is contained in:
Emmanuele Bassi 2020-11-19 14:27:30 +00:00
parent d436c2e839
commit 8fa58c2e17

View File

@ -756,14 +756,16 @@ gtk_accessible_bounds_changed (GtkAccessible *self)
gboolean
gtk_accessible_should_present (GtkAccessible *self)
{
GtkAccessibleRole role;
GtkATContext *context;
if (GTK_IS_WIDGET (self) &&
!gtk_widget_get_visible (GTK_WIDGET (self)))
return FALSE;
if (gtk_accessible_get_accessible_role (self) == GTK_ACCESSIBLE_ROLE_NONE ||
gtk_accessible_get_accessible_role (self) == GTK_ACCESSIBLE_ROLE_PRESENTATION)
role = gtk_accessible_get_accessible_role (self);
if (role == GTK_ACCESSIBLE_ROLE_NONE ||
role == GTK_ACCESSIBLE_ROLE_PRESENTATION)
return FALSE;
context = gtk_accessible_get_at_context (self);