diff options
-rw-r--r-- | atk/atktext.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/atk/atktext.c b/atk/atktext.c index c15ea78..52d7da1 100644 --- a/atk/atktext.c +++ b/atk/atktext.c @@ -1331,6 +1331,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; |