a11y: Simplify GtkWidget's GtkAccessible.get_bounds implementation

We can use the result from gtk_widget_get_bounds for the coordinates as well.
This commit is contained in:
Lukáš Tyrychtr 2024-04-10 15:32:16 +02:00
parent 6bfc995097
commit 17f2443350

View File

@ -8641,26 +8641,24 @@ gtk_widget_accessible_get_bounds (GtkAccessible *self,
parent = gtk_widget_get_parent (widget);
if (parent != NULL)
{
graphene_point_t p;
if (!gtk_widget_compute_point (widget, parent, &GRAPHENE_POINT_INIT (0, 0), &p))
graphene_point_init (&p, 0, 0);
*x = floorf (p.x);
*y = floorf (p.y);
bounds_relative_to = parent;
}
else
{
*x = *y = 0;
bounds_relative_to = widget;
}
if (!gtk_widget_compute_bounds (widget, bounds_relative_to, &bounds))
{
*x = 0;
*y = 0;
*width = 0;
*height = 0;
}
else
{
*x = floorf (graphene_rect_get_x (&bounds));
*y = floorf (graphene_rect_get_y (&bounds));
*width = ceilf (graphene_rect_get_width (&bounds));
*height = ceilf (graphene_rect_get_height (&bounds));
}