summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2018-11-14 09:19:30 +0200
committerDaniel Hirt <hirt.danny@gmail.com>2018-11-14 10:48:54 +0200
commit09da85807a6447d6e9c04fc72fdb485a78192d82 (patch)
tree30c1f012b952aac22c2d3a7d63ae6febb45aba8b
parentb89b221b97897a29d009fc5910274c545d33e06f (diff)
downloadefl-09da85807a6447d6e9c04fc72fdb485a78192d82.tar.gz
evas textblock: remove white space after line-break by a next item
Summary: In some cases, white space at end of line is remained after line-break. This issue is happened when Textblock do word wrap at the next item. Without spliting a previous text item. Then, Textblock just skipped calling _layout_item_text_split_strip_white() function. This patch also fixed a wrong test case based on wrong logic. The range rectangles shouldn't be overlapped. Because of remained white space, a meaningless rectangle was added. And it overlapped by next rectangle. @fix Test Plan: Fixed an exising test case for range renctangles. Run test case. Reviewers: herdsman, woohyun, raster, cedric, subodh, subodh6129 Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D7204
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c10
-rw-r--r--src/tests/evas/evas_test_textblock.c15
2 files changed, 18 insertions, 7 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index a194899d48..3da95a97a0 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -5564,7 +5564,7 @@ _layout_item_obstacle_get(Ctxt *c, Evas_Object_Textblock_Item *it);
static int
_layout_par(Ctxt *c)
{
- Evas_Object_Textblock_Item *it;
+ Evas_Object_Textblock_Item *it, *prev_it;
Eina_List *i;
int ret = 0;
int wrap = -1;
@@ -5673,6 +5673,7 @@ _layout_par(Ctxt *c)
Eina_Bool item_preadv = EINA_FALSE;
Evas_Textblock_Obstacle *obs = NULL;
c->par->last_fw = 0;
+ it = NULL;
for (i = c->par->logical_items ; i ; )
{
Evas_Coord prevdescent = 0, prevascent = 0;
@@ -5681,6 +5682,7 @@ _layout_par(Ctxt *c)
Evas_Textblock_Obstacle_Info *obs_info = NULL;
Evas_Coord itw;
+ prev_it = it;
it = _ITEM(eina_list_data_get(i));
/* Skip visually deleted items */
if (it->visually_deleted ||
@@ -5959,6 +5961,12 @@ _layout_par(Ctxt *c)
else if (wrap == 0)
{
/* Should wrap before the item */
+ if (prev_it && (prev_it->type == EVAS_TEXTBLOCK_ITEM_TEXT))
+ {
+ _layout_item_text_split_strip_white(c,
+ _ITEM_TEXT(prev_it), eina_list_prev(i),
+ _ITEM_TEXT(prev_it)->text_props.text_len);
+ }
/* We didn't end up using the item, so revert the ascent
* and descent changes. */
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index 9246f77a52..29ab7110f7 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -2717,23 +2717,26 @@ EFL_START_TEST(evas_textblock_geometries)
fail_if(!it);
rects = eina_iterator_container_get(it);
fail_if(!rects);
- ck_assert_int_eq(eina_list_count(rects), 3);
+ ck_assert_int_eq(eina_list_count(rects), 2);
{
- Evas_Coord y1, y2;
+ Evas_Coord x1, y1, x2, y2;
void *tmp = tr;
- /* We have 3 rectangles */
+ /* We have 2 rectangles */
Eina_Iterator *itr = it;
fail_if (!eina_iterator_next(itr, &tmp));
tr = tmp;
+ x1 = tr->x;
y1 = tr->y;
fail_if (!eina_iterator_next(itr, &tmp));
tr = tmp;
+ x2 = tr->x;
y2 = tr->y;
- /* Basically it means that the "extending" rectangle should not somehow
- * reach the second line in this example. */
- ck_assert_int_eq(y1, y2);
+ /* These rectangles must be placed without overlapping.
+ * In this test case, we expect to see a rect for each line. */
+ fail_if((x1 == x2) && (y1 == y2));
+ ck_assert_int_ne(y1, y2);
eina_iterator_free(it);
}