[atk: 1/2] Make atk_text_rectangle_union ignore undefined rectangles
- From: Samuel Thibault <sthibaul src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [atk: 1/2] Make atk_text_rectangle_union ignore undefined rectangles
- Date: Mon, 9 Sep 2019 16:22:25 +0000 (UTC)
commit c997214620d80adc0b1794b42a9e79ce856d9df2
Author: Samuel Thibault <samuel thibault ens-lyon org>
Date: Mon Aug 19 15:53:18 2019 +0200
Make atk_text_rectangle_union ignore undefined rectangles
atk_text_get_character_extents might return "-1" rectangles for character
positions without support for getting an extent. In that case we have to
ignore them instead of using -1 values in computations.
atk/atktext.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
---
diff --git a/atk/atktext.c b/atk/atktext.c
index 8f2e498..fbe05ab 100644
--- a/atk/atktext.c
+++ b/atk/atktext.c
@@ -1328,6 +1328,23 @@ atk_text_rectangle_union (AtkTextRectangle *src1,
{
gint dest_x, dest_y;
+ /*
+ * Some invocations of e.g. atk_text_get_character_extents
+ * may return "-1" rectangles for character positions without support for
+ * getting an extent. In that case we have to ignore them instead of using -1
+ * values in computations.
+ */
+ if (src1->width == -1)
+ {
+ *dest = *src2;
+ return;
+ }
+ if (src2->width == -1)
+ {
+ *dest = *src1;
+ return;
+ }
+
dest_x = MIN (src1->x, src2->x);
dest_y = MIN (src1->y, src2->y);
dest->width = MAX (src1->x + src1->width, src2->x + src2->width) - dest_x;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]