From 8fa58c2e178e045769188d2fa55229d67b8d8e79 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 19 Nov 2020 14:27:30 +0000 Subject: [PATCH] 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. --- gtk/gtkaccessible.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c index 991bc02756..ed89fa9714 100644 --- a/gtk/gtkaccessible.c +++ b/gtk/gtkaccessible.c @@ -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);