[gtk/ebassi/for-master: 5/7] a11y: Skip atspi.Cache signals for hidden elements
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/ebassi/for-master: 5/7] a11y: Skip atspi.Cache signals for hidden elements
- Date: Thu, 19 Nov 2020 15:21:04 +0000 (UTC)
commit e600a0723780dcd8ddb3452a50405968241e007f
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Nov 19 14:46:01 2020 +0000
a11y: Skip atspi.Cache signals for hidden elements
If the accessible object is hidden, we can skip the emission of the
AddAccessible and RemoveAccessible signals on the cache, as those
objects won't be visible in the accessibility tree.
gtk/a11y/gtkatspicache.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
---
diff --git a/gtk/a11y/gtkatspicache.c b/gtk/a11y/gtkatspicache.c
index 81bfd030f2..10736341e5 100644
--- a/gtk/a11y/gtkatspicache.c
+++ b/gtk/a11y/gtkatspicache.c
@@ -176,6 +176,18 @@ static void
emit_add_accessible (GtkAtSpiCache *self,
GtkAtSpiContext *context)
{
+ GtkATContext *at_context = GTK_AT_CONTEXT (context);
+
+ /* If the context is hidden, we don't need to update the cache */
+ if (gtk_at_context_has_accessible_state (at_context, GTK_ACCESSIBLE_STATE_HIDDEN))
+ {
+ GtkAccessibleValue *is_hidden =
+ gtk_at_context_get_accessible_state (at_context, GTK_ACCESSIBLE_STATE_HIDDEN);
+
+ if (gtk_boolean_accessible_value_get (is_hidden))
+ return;
+ }
+
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("(" ITEM_SIGNATURE ")"));
collect_object (self, &builder, context);
@@ -194,6 +206,18 @@ static void
emit_remove_accessible (GtkAtSpiCache *self,
GtkAtSpiContext *context)
{
+ GtkATContext *at_context = GTK_AT_CONTEXT (context);
+
+ /* If the context is hidden, we don't need to update the cache */
+ if (gtk_at_context_has_accessible_state (at_context, GTK_ACCESSIBLE_STATE_HIDDEN))
+ {
+ GtkAccessibleValue *is_hidden =
+ gtk_at_context_get_accessible_state (at_context, GTK_ACCESSIBLE_STATE_HIDDEN);
+
+ if (gtk_boolean_accessible_value_get (is_hidden))
+ return;
+ }
+
GVariant *ref = gtk_at_spi_context_to_ref (context);
g_dbus_connection_emit_signal (self->connection,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]