a11y: Improve child index helpers

We need to use gtk_accessible_should_present() whenever we
calculate accessible tree positions, to avoid inconsistencies.

While we are at it, make these helpers usable for finding
the position of accesibles that are now ignored, by not
looking at should_present for the object itself. This will
be relevant when we calculate the position of objects whose
HIDDEN state changes.
This commit is contained in:
Matthias Clasen
2020-10-24 13:14:44 -04:00
parent e7b290debb
commit 89a8c89663

View File

@@ -347,12 +347,12 @@ get_index_in_parent (GtkWidget *widget)
child;
child = gtk_widget_get_next_sibling (child))
{
if (!gtk_accessible_should_present (GTK_ACCESSIBLE (child)))
continue;
if (child == widget)
return idx;
if (!gtk_accessible_should_present (GTK_ACCESSIBLE (child)))
continue;
idx++;
}
@@ -374,12 +374,12 @@ get_index_in_toplevels (GtkWidget *widget)
g_object_unref (window);
if (!gtk_widget_get_visible (window))
continue;
if (window == widget)
return idx;
if (!gtk_accessible_should_present (GTK_ACCESSIBLE (window)))
continue;
idx += 1;
}