[gtk/ebassi/for-master: 6/9] a11y: Get the accessible role once




commit cd8d9127672678f2bc60269f2fd9418b0e0a814a
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Nov 19 14:27:30 2020 +0000

    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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]