summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-09-30 23:29:54 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-09-30 23:31:48 +0900
commita4a285089f48c1c303aa389324f778eaefe9e3a8 (patch)
tree6906c4ea92cb6d4cdcb1e6bfefa2cd48d36d9568 /src
parentbaf0fc426846743faef4165786a7e589b9c90347 (diff)
evas - improve textblock logic to reduce num of layouts when used - faster
when using genlist and the edje item objects, there seem to be a lot of excess textblock layouts happening. i was seeing about 12 layouts per tb part in the edje before this patch. with this it's down to about 3.
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c235
1 files changed, 182 insertions, 53 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index 291ef8ee16..e0aff4d4ef 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -69,6 +69,9 @@
69 69
70EAPI Eo_Op EVAS_OBJ_TEXTBLOCK_BASE_ID = EO_NOOP; 70EAPI Eo_Op EVAS_OBJ_TEXTBLOCK_BASE_ID = EO_NOOP;
71 71
72//#define LYDBG(f, args...) printf(f, ##args)
73#define LYDBG(f, args...)
74
72#define MY_CLASS EVAS_OBJ_TEXTBLOCK_CLASS 75#define MY_CLASS EVAS_OBJ_TEXTBLOCK_CLASS
73 76
74#define MY_CLASS_NAME "Evas_Object_Textblock" 77#define MY_CLASS_NAME "Evas_Object_Textblock"
@@ -495,7 +498,7 @@ struct _Evas_Object_Textblock
495 const char *repch; 498 const char *repch;
496 const char *bidi_delimiters; 499 const char *bidi_delimiters;
497 struct { 500 struct {
498 int w, h; 501 int w, h, oneline_h;
499 Eina_Bool valid : 1; 502 Eina_Bool valid : 1;
500 } formatted, native; 503 } formatted, native;
501 Eina_Bool redraw : 1; 504 Eina_Bool redraw : 1;
@@ -532,11 +535,9 @@ static int evas_object_textblock_is_opaque(Evas_Object *eo_obj,
532static int evas_object_textblock_was_opaque(Evas_Object *eo_obj, 535static int evas_object_textblock_was_opaque(Evas_Object *eo_obj,
533 Evas_Object_Protected_Data *obj, 536 Evas_Object_Protected_Data *obj,
534 void *type_private_data); 537 void *type_private_data);
535
536static void evas_object_textblock_coords_recalc(Evas_Object *eo_obj, 538static void evas_object_textblock_coords_recalc(Evas_Object *eo_obj,
537 Evas_Object_Protected_Data *obj, 539 Evas_Object_Protected_Data *obj,
538 void *type_private_data); 540 void *type_private_data);
539
540static void evas_object_textblock_scale_update(Evas_Object *eo_obj, 541static void evas_object_textblock_scale_update(Evas_Object *eo_obj,
541 Evas_Object_Protected_Data *obj, 542 Evas_Object_Protected_Data *obj,
542 void *type_private_data); 543 void *type_private_data);
@@ -560,7 +561,7 @@ static const Evas_Object_Func object_func =
560 evas_object_textblock_was_opaque, 561 evas_object_textblock_was_opaque,
561 NULL, 562 NULL,
562 NULL, 563 NULL,
563 evas_object_textblock_coords_recalc, 564 NULL, /*evas_object_textblock_coords_recalc, <- disable - not useful. */
564 evas_object_textblock_scale_update, 565 evas_object_textblock_scale_update,
565 NULL, 566 NULL,
566 NULL, 567 NULL,
@@ -5104,6 +5105,7 @@ _layout(const Evas_Object *eo_obj, int w, int h, int *w_ret, int *h_ret)
5104 Ctxt ctxt, *c; 5105 Ctxt ctxt, *c;
5105 int style_pad_l = 0, style_pad_r = 0, style_pad_t = 0, style_pad_b = 0; 5106 int style_pad_l = 0, style_pad_r = 0, style_pad_t = 0, style_pad_b = 0;
5106 5107
5108 LYDBG("ZZ: layout %p %4ix%4i | w=%4i | last_w=%4i --- '%s'\n", eo_obj, w, h, obj->cur->geometry.w, o->last_w, o->markup_text);
5107 /* setup context */ 5109 /* setup context */
5108 c = &ctxt; 5110 c = &ctxt;
5109 c->obj = (Evas_Object *)eo_obj; 5111 c->obj = (Evas_Object *)eo_obj;
@@ -5269,6 +5271,7 @@ _layout(const Evas_Object *eo_obj, int w, int h, int *w_ret, int *h_ret)
5269 o->style_pad.t = style_pad_t; 5271 o->style_pad.t = style_pad_t;
5270 o->style_pad.b = style_pad_b; 5272 o->style_pad.b = style_pad_b;
5271 _paragraphs_clear(eo_obj, c->paragraphs); 5273 _paragraphs_clear(eo_obj, c->paragraphs);
5274 LYDBG("ZZ: ... layout #2\n");
5272 _layout(eo_obj, w, h, w_ret, h_ret); 5275 _layout(eo_obj, w, h, w_ret, h_ret);
5273 } 5276 }
5274} 5277}
@@ -5287,8 +5290,19 @@ _relayout(const Evas_Object *eo_obj)
5287 _layout(eo_obj, obj->cur->geometry.w, obj->cur->geometry.h, 5290 _layout(eo_obj, obj->cur->geometry.w, obj->cur->geometry.h,
5288 &o->formatted.w, &o->formatted.h); 5291 &o->formatted.w, &o->formatted.h);
5289 o->formatted.valid = 1; 5292 o->formatted.valid = 1;
5293 o->formatted.oneline_h = 0;
5290 o->last_w = obj->cur->geometry.w; 5294 o->last_w = obj->cur->geometry.w;
5295 LYDBG("ZZ: --------- layout %p @ %ix%i = %ix%i\n", eo_obj, obj->cur->geometry.w, obj->cur->geometry.h, o->formatted.w, o->formatted.h);
5291 o->last_h = obj->cur->geometry.h; 5296 o->last_h = obj->cur->geometry.h;
5297 if ((o->paragraphs) && (!EINA_INLIST_GET(o->paragraphs)->next) &&
5298 (o->paragraphs->lines) && (!EINA_INLIST_GET(o->paragraphs->lines)->next))
5299 {
5300 if (obj->cur->geometry.h < o->formatted.h)
5301 {
5302 LYDBG("ZZ: 1 line only... lasth == formatted h (%i)\n", o->formatted.h);
5303 o->formatted.oneline_h = o->formatted.h;
5304 }
5305 }
5292 o->changed = 0; 5306 o->changed = 0;
5293 o->content_changed = 0; 5307 o->content_changed = 0;
5294 o->format_changed = EINA_FALSE; 5308 o->format_changed = EINA_FALSE;
@@ -5312,8 +5326,14 @@ _find_layout_item_line_match(Evas_Object *eo_obj, Evas_Object_Textblock_Node_Tex
5312 Evas_Object_Textblock_Paragraph *found_par; 5326 Evas_Object_Textblock_Paragraph *found_par;
5313 Evas_Object_Textblock_Line *ln; 5327 Evas_Object_Textblock_Line *ln;
5314 Evas_Object_Textblock *o = eo_data_scope_get(eo_obj, MY_CLASS); 5328 Evas_Object_Textblock *o = eo_data_scope_get(eo_obj, MY_CLASS);
5329 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
5315 5330
5316 if (!o->formatted.valid) _relayout(eo_obj); 5331 evas_object_textblock_coords_recalc(eo_obj, obj, obj->private_data);
5332 if (!o->formatted.valid)
5333 {
5334 LYDBG("ZZ: relayout 1\n");
5335 _relayout(eo_obj);
5336 }
5317 5337
5318 found_par = n->par; 5338 found_par = n->par;
5319 if (found_par) 5339 if (found_par)
@@ -7423,7 +7443,14 @@ evas_textblock_cursor_line_char_first(Evas_Textblock_Cursor *cur)
7423 if (!cur) return; 7443 if (!cur) return;
7424 TB_NULL_CHECK(cur->node); 7444 TB_NULL_CHECK(cur->node);
7425 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS); 7445 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS);
7426 if (!o->formatted.valid) _relayout(cur->obj); 7446 Evas_Object_Protected_Data *obj = eo_data_scope_get(cur->obj, EVAS_OBJ_CLASS);
7447
7448 evas_object_textblock_coords_recalc(cur->obj, obj, obj->private_data);
7449 if (!o->formatted.valid)
7450 {
7451 LYDBG("ZZ: relayout 2\n");
7452 _relayout(cur->obj);
7453 }
7427 7454
7428 _find_layout_item_match(cur, &ln, &it); 7455 _find_layout_item_match(cur, &ln, &it);
7429 7456
@@ -7456,7 +7483,14 @@ evas_textblock_cursor_line_char_last(Evas_Textblock_Cursor *cur)
7456 if (!cur) return; 7483 if (!cur) return;
7457 TB_NULL_CHECK(cur->node); 7484 TB_NULL_CHECK(cur->node);
7458 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS); 7485 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS);
7459 if (!o->formatted.valid) _relayout(cur->obj); 7486 Evas_Object_Protected_Data *obj = eo_data_scope_get(cur->obj, EVAS_OBJ_CLASS);
7487
7488 evas_object_textblock_coords_recalc(cur->obj, obj, obj->private_data);
7489 if (!o->formatted.valid)
7490 {
7491 LYDBG("ZZ: relayout 3\n");
7492 _relayout(cur->obj);
7493 }
7460 7494
7461 _find_layout_item_match(cur, &ln, &it); 7495 _find_layout_item_match(cur, &ln, &it);
7462 7496
@@ -7992,8 +8026,16 @@ evas_textblock_cursor_line_set(Evas_Textblock_Cursor *cur, int line)
7992 Evas_Object_Textblock_Item *it; 8026 Evas_Object_Textblock_Item *it;
7993 8027
7994 if (!cur) return EINA_FALSE; 8028 if (!cur) return EINA_FALSE;
8029
7995 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS); 8030 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS);
7996 if (!o->formatted.valid) _relayout(cur->obj); 8031 Evas_Object_Protected_Data *obj = eo_data_scope_get(cur->obj, EVAS_OBJ_CLASS);
8032
8033 evas_object_textblock_coords_recalc(cur->obj, obj, obj->private_data);
8034 if (!o->formatted.valid)
8035 {
8036 LYDBG("ZZ: relayout 4\n");
8037 _relayout(cur->obj);
8038 }
7997 8039
7998 ln = _find_layout_line_num(cur->obj, line); 8040 ln = _find_layout_line_num(cur->obj, line);
7999 if (!ln) return EINA_FALSE; 8041 if (!ln) return EINA_FALSE;
@@ -8265,6 +8307,7 @@ static void
8265_evas_textblock_changed(Evas_Object_Textblock *o, Evas_Object *eo_obj) 8307_evas_textblock_changed(Evas_Object_Textblock *o, Evas_Object *eo_obj)
8266{ 8308{
8267 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS); 8309 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
8310 LYDBG("ZZ: invalidate 1 %p\n", eo_obj);
8268 o->formatted.valid = 0; 8311 o->formatted.valid = 0;
8269 o->native.valid = 0; 8312 o->native.valid = 0;
8270 o->content_changed = 1; 8313 o->content_changed = 1;
@@ -9244,7 +9287,14 @@ evas_textblock_cursor_geometry_bidi_get(const Evas_Textblock_Cursor *cur, Evas_C
9244{ 9287{
9245 if (!cur) return EINA_FALSE; 9288 if (!cur) return EINA_FALSE;
9246 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS); 9289 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS);
9247 if (!o->formatted.valid) _relayout(cur->obj); 9290 Evas_Object_Protected_Data *obj = eo_data_scope_get(cur->obj, EVAS_OBJ_CLASS);
9291
9292 evas_object_textblock_coords_recalc(cur->obj, obj, obj->private_data);
9293 if (!o->formatted.valid)
9294 {
9295 LYDBG("ZZ: relayout 5\n");
9296 _relayout(cur->obj);
9297 }
9248 9298
9249 if (ctype == EVAS_TEXTBLOCK_CURSOR_UNDER) 9299 if (ctype == EVAS_TEXTBLOCK_CURSOR_UNDER)
9250 { 9300 {
@@ -9425,7 +9475,14 @@ evas_textblock_cursor_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord
9425 int ret = -1; 9475 int ret = -1;
9426 if (!cur) return -1; 9476 if (!cur) return -1;
9427 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS); 9477 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS);
9428 if (!o->formatted.valid) _relayout(cur->obj); 9478 Evas_Object_Protected_Data *obj = eo_data_scope_get(cur->obj, EVAS_OBJ_CLASS);
9479
9480 evas_object_textblock_coords_recalc(cur->obj, obj, obj->private_data);
9481 if (!o->formatted.valid)
9482 {
9483 LYDBG("ZZ: relayout 6\n");
9484 _relayout(cur->obj);
9485 }
9429 9486
9430 if (ctype == EVAS_TEXTBLOCK_CURSOR_UNDER) 9487 if (ctype == EVAS_TEXTBLOCK_CURSOR_UNDER)
9431 { 9488 {
@@ -9492,7 +9549,14 @@ _evas_textblock_cursor_char_pen_geometry_common_get(int (*query_func) (void *dat
9492 9549
9493 if (!cur) return -1; 9550 if (!cur) return -1;
9494 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS); 9551 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS);
9495 if (!o->formatted.valid) _relayout(cur->obj); 9552 Evas_Object_Protected_Data *obj = eo_data_scope_get(cur->obj, EVAS_OBJ_CLASS);
9553
9554 evas_object_textblock_coords_recalc(cur->obj, obj, obj->private_data);
9555 if (!o->formatted.valid)
9556 {
9557 LYDBG("ZZ: relayout 7\n");
9558 _relayout(cur->obj);
9559 }
9496 9560
9497 if (!cur->node) 9561 if (!cur->node)
9498 { 9562 {
@@ -9621,7 +9685,14 @@ evas_textblock_cursor_line_geometry_get(const Evas_Textblock_Cursor *cur, Evas_C
9621 9685
9622 if (!cur) return -1; 9686 if (!cur) return -1;
9623 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS); 9687 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS);
9624 if (!o->formatted.valid) _relayout(cur->obj); 9688 Evas_Object_Protected_Data *obj = eo_data_scope_get(cur->obj, EVAS_OBJ_CLASS);
9689
9690 evas_object_textblock_coords_recalc(cur->obj, obj, obj->private_data);
9691 if (!o->formatted.valid)
9692 {
9693 LYDBG("ZZ: relayout 8\n");
9694 _relayout(cur->obj);
9695 }
9625 if (!cur->node) 9696 if (!cur->node)
9626 { 9697 {
9627 ln = o->paragraphs->lines; 9698 ln = o->paragraphs->lines;
@@ -9670,7 +9741,14 @@ evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord x, E
9670 9741
9671 if (!cur) return EINA_FALSE; 9742 if (!cur) return EINA_FALSE;
9672 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS); 9743 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS);
9673 if (!o->formatted.valid) _relayout(cur->obj); 9744 Evas_Object_Protected_Data *obj = eo_data_scope_get(cur->obj, EVAS_OBJ_CLASS);
9745
9746 evas_object_textblock_coords_recalc(cur->obj, obj, obj->private_data);
9747 if (!o->formatted.valid)
9748 {
9749 LYDBG("ZZ: relayout 9\n");
9750 _relayout(cur->obj);
9751 }
9674 x += o->style_pad.l; 9752 x += o->style_pad.l;
9675 y += o->style_pad.t; 9753 y += o->style_pad.t;
9676 9754
@@ -9777,7 +9855,14 @@ evas_textblock_cursor_line_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord y)
9777 9855
9778 if (!cur) return -1; 9856 if (!cur) return -1;
9779 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS); 9857 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS);
9780 if (!o->formatted.valid) _relayout(cur->obj); 9858 Evas_Object_Protected_Data *obj = eo_data_scope_get(cur->obj, EVAS_OBJ_CLASS);
9859
9860 evas_object_textblock_coords_recalc(cur->obj, obj, obj->private_data);
9861 if (!o->formatted.valid)
9862 {
9863 LYDBG("ZZ: relayout 10\n");
9864 _relayout(cur->obj);
9865 }
9781 y += o->style_pad.t; 9866 y += o->style_pad.t;
9782 9867
9783 found_par = _layout_find_paragraph_by_y(o, y); 9868 found_par = _layout_find_paragraph_by_y(o, y);
@@ -10165,7 +10250,14 @@ evas_textblock_cursor_range_geometry_get(const Evas_Textblock_Cursor *cur1, cons
10165 if (!cur2 || !cur2->node) return NULL; 10250 if (!cur2 || !cur2->node) return NULL;
10166 if (cur1->obj != cur2->obj) return NULL; 10251 if (cur1->obj != cur2->obj) return NULL;
10167 Evas_Object_Textblock *o = eo_data_scope_get(cur1->obj, MY_CLASS); 10252 Evas_Object_Textblock *o = eo_data_scope_get(cur1->obj, MY_CLASS);
10168 if (!o->formatted.valid) _relayout(cur1->obj); 10253 Evas_Object_Protected_Data *obj = eo_data_scope_get(cur1->obj, EVAS_OBJ_CLASS);
10254
10255 evas_object_textblock_coords_recalc(cur1->obj, obj, obj->private_data);
10256 if (!o->formatted.valid)
10257 {
10258 LYDBG("ZZ: relayout 11\n");
10259 _relayout(cur1->obj);
10260 }
10169 if (evas_textblock_cursor_compare(cur1, cur2) > 0) 10261 if (evas_textblock_cursor_compare(cur1, cur2) > 0)
10170 { 10262 {
10171 const Evas_Textblock_Cursor *tc; 10263 const Evas_Textblock_Cursor *tc;
@@ -10235,7 +10327,14 @@ evas_textblock_cursor_format_item_geometry_get(const Evas_Textblock_Cursor *cur,
10235 10327
10236 if (!cur || !evas_textblock_cursor_format_is_visible_get(cur)) return EINA_FALSE; 10328 if (!cur || !evas_textblock_cursor_format_is_visible_get(cur)) return EINA_FALSE;
10237 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS); 10329 Evas_Object_Textblock *o = eo_data_scope_get(cur->obj, MY_CLASS);
10238 if (!o->formatted.valid) _relayout(cur->obj); 10330 Evas_Object_Protected_Data *obj = eo_data_scope_get(cur->obj, EVAS_OBJ_CLASS);
10331
10332 evas_object_textblock_coords_recalc(cur->obj, obj, obj->private_data);
10333 if (!o->formatted.valid)
10334 {
10335 LYDBG("ZZ: relayout 12\n");
10336 _relayout(cur->obj);
10337 }
10239 if (!evas_textblock_cursor_format_is_visible_get(cur)) return EINA_FALSE; 10338 if (!evas_textblock_cursor_format_is_visible_get(cur)) return EINA_FALSE;
10240 _find_layout_item_line_match(cur->obj, cur->node, cur->pos, &ln, &it); 10339 _find_layout_item_line_match(cur->obj, cur->node, cur->pos, &ln, &it);
10241 fi = _ITEM_FORMAT(it); 10340 fi = _ITEM_FORMAT(it);
@@ -10358,7 +10457,14 @@ _textblock_size_formatted_get(Eo *eo_obj, void *_pd, va_list *list)
10358 const Evas_Object_Textblock *o = _pd; 10457 const Evas_Object_Textblock *o = _pd;
10359 Evas_Coord *w = va_arg(*list, Evas_Coord *); 10458 Evas_Coord *w = va_arg(*list, Evas_Coord *);
10360 Evas_Coord *h = va_arg(*list, Evas_Coord *); 10459 Evas_Coord *h = va_arg(*list, Evas_Coord *);
10361 if (!o->formatted.valid) _relayout(eo_obj); 10460 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
10461
10462 evas_object_textblock_coords_recalc(eo_obj, obj, obj->private_data);
10463 if (!o->formatted.valid)
10464 {
10465 LYDBG("ZZ: relayout 13\n");
10466 _relayout(eo_obj);
10467 }
10362 if (w) *w = o->formatted.w; 10468 if (w) *w = o->formatted.w;
10363 if (h) *h = o->formatted.h; 10469 if (h) *h = o->formatted.h;
10364} 10470}
@@ -10522,7 +10628,14 @@ _textblock_size_native_get(Eo *eo_obj, void *_pd, va_list *list)
10522 Textblock_Position position = TEXTBLOCK_POSITION_START; 10628 Textblock_Position position = TEXTBLOCK_POSITION_START;
10523 /* We just want the layout objects to update, should probably 10629 /* We just want the layout objects to update, should probably
10524 * split that. */ 10630 * split that. */
10525 if (!o->formatted.valid) _relayout(eo_obj); 10631 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
10632
10633 evas_object_textblock_coords_recalc(eo_obj, obj, obj->private_data);
10634 if (!o->formatted.valid)
10635 {
10636 LYDBG("ZZ: relayout 14\n");
10637 _relayout(eo_obj);
10638 }
10526 EINA_INLIST_FOREACH(o->paragraphs, par) 10639 EINA_INLIST_FOREACH(o->paragraphs, par)
10527 { 10640 {
10528 Evas_Coord tw, th; 10641 Evas_Coord tw, th;
@@ -10557,7 +10670,14 @@ _textblock_style_insets_get(Eo *eo_obj, void *_pd, va_list *list)
10557 Evas_Coord *r = va_arg(*list, Evas_Coord *); 10670 Evas_Coord *r = va_arg(*list, Evas_Coord *);
10558 Evas_Coord *t = va_arg(*list, Evas_Coord *); 10671 Evas_Coord *t = va_arg(*list, Evas_Coord *);
10559 Evas_Coord *b = va_arg(*list, Evas_Coord *); 10672 Evas_Coord *b = va_arg(*list, Evas_Coord *);
10560 if (!o->formatted.valid) _relayout(eo_obj); 10673 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
10674
10675 evas_object_textblock_coords_recalc(eo_obj, obj, obj->private_data);
10676 if (!o->formatted.valid)
10677 {
10678 LYDBG("ZZ: relayout 15\n");
10679 _relayout(eo_obj);
10680 }
10561 if (l) *l = o->style_pad.l; 10681 if (l) *l = o->style_pad.l;
10562 if (r) *r = o->style_pad.r; 10682 if (r) *r = o->style_pad.r;
10563 if (t) *t = o->style_pad.t; 10683 if (t) *t = o->style_pad.t;
@@ -10604,18 +10724,6 @@ _dbg_info_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
10604 } 10724 }
10605} 10725}
10606 10726
10607/** @internal
10608 * FIXME: DELETE ME! DELETE ME!
10609 * This is an ugly workaround to get around the fact that
10610 * evas_object_textblock_coords_recalc isn't really called when it's supposed
10611 * to. When that bug is fixed please remove this. */
10612static void
10613_workaround_object_coords_recalc(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *eo_obj, void *event_info EINA_UNUSED)
10614{
10615 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
10616 evas_object_textblock_coords_recalc(eo_obj, obj, obj->private_data);
10617}
10618
10619/* all nice and private */ 10727/* all nice and private */
10620static void 10728static void
10621evas_object_textblock_init(Evas_Object *eo_obj) 10729evas_object_textblock_init(Evas_Object *eo_obj)
@@ -10636,8 +10744,6 @@ evas_object_textblock_init(Evas_Object *eo_obj)
10636 evas_object_textblock_text_markup_set(eo_obj, ""); 10744 evas_object_textblock_text_markup_set(eo_obj, "");
10637 10745
10638 o->legacy_newline = EINA_TRUE; 10746 o->legacy_newline = EINA_TRUE;
10639 evas_object_event_callback_priority_add(eo_obj, EVAS_CALLBACK_RESIZE, -1000,
10640 _workaround_object_coords_recalc, NULL);
10641} 10747}
10642 10748
10643static void 10749static void
@@ -11076,6 +11182,38 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
11076} 11182}
11077 11183
11078static void 11184static void
11185evas_object_textblock_coords_recalc(Evas_Object *eo_obj EINA_UNUSED,
11186 Evas_Object_Protected_Data *obj,
11187 void *type_private_data)
11188{
11189 Evas_Object_Textblock *o = type_private_data;
11190
11191 if (
11192 // width changed thus we may have to re-wrap or change centering etc.
11193 (obj->cur->geometry.w != o->last_w) ||
11194 // if valign not top OR we have ellipsis, then if height changed we need to re-eval valign or ... spot
11195 (((o->valign != 0.0) || (o->have_ellipsis)) &&
11196 (
11197 ((o->formatted.oneline_h == 0) &&
11198 (obj->cur->geometry.h != o->last_h)) ||
11199 ((o->formatted.oneline_h != 0) &&
11200 (((obj->cur->geometry.h != o->last_h) &&
11201 (o->formatted.oneline_h < obj->cur->geometry.h))))
11202 )
11203 ) ||
11204 // obviously if content text changed we need to reformat it
11205 (o->content_changed) ||
11206 // if format changed (eg styles) we need to re-format/match tags etc.
11207 (o->format_changed)
11208 )
11209 {
11210 LYDBG("ZZ: invalidate 2 %p ## %i != %i || %3.3f || %i && %i != %i | %i %i\n", eo_obj, obj->cur->geometry.w, o->last_w, o->valign, o->have_ellipsis, obj->cur->geometry.h, o->last_h, o->content_changed, o->format_changed);
11211 o->formatted.valid = 0;
11212 o->changed = 1;
11213 }
11214}
11215
11216static void
11079evas_object_textblock_render_pre(Evas_Object *eo_obj, 11217evas_object_textblock_render_pre(Evas_Object *eo_obj,
11080 Evas_Object_Protected_Data *obj, 11218 Evas_Object_Protected_Data *obj,
11081 void *type_private_data) 11219 void *type_private_data)
@@ -11092,11 +11230,11 @@ evas_object_textblock_render_pre(Evas_Object *eo_obj,
11092 /* elsewhere, decoding video etc. */ 11230 /* elsewhere, decoding video etc. */
11093 /* then when this is done the object needs to figure if it changed and */ 11231 /* then when this is done the object needs to figure if it changed and */
11094 /* if so what and where and add the appropriate redraw textblocks */ 11232 /* if so what and where and add the appropriate redraw textblocks */
11095 if ((o->changed) || (o->content_changed) || (o->format_changed) || 11233
11096 ((obj->cur->geometry.w != o->last_w) || 11234 evas_object_textblock_coords_recalc(eo_obj, obj, obj->private_data);
11097 (((o->valign != 0.0) || (o->have_ellipsis)) && 11235 if (o->changed)
11098 (obj->cur->geometry.h != o->last_h))))
11099 { 11236 {
11237 LYDBG("ZZ: relayout 16\n");
11100 _relayout(eo_obj); 11238 _relayout(eo_obj);
11101 o->redraw = 0; 11239 o->redraw = 0;
11102 evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, 11240 evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes,
@@ -11239,21 +11377,6 @@ evas_object_textblock_was_opaque(Evas_Object *eo_obj EINA_UNUSED,
11239} 11377}
11240 11378
11241static void 11379static void
11242evas_object_textblock_coords_recalc(Evas_Object *eo_obj EINA_UNUSED,
11243 Evas_Object_Protected_Data *obj,
11244 void *type_private_data)
11245{
11246 Evas_Object_Textblock *o = type_private_data;
11247 if ((obj->cur->geometry.w != o->last_w) ||
11248 (((o->valign != 0.0) || (o->have_ellipsis)) &&
11249 (obj->cur->geometry.h != o->last_h)))
11250 {
11251 o->formatted.valid = 0;
11252 o->changed = 1;
11253 }
11254}
11255
11256static void
11257evas_object_textblock_scale_update(Evas_Object *eo_obj EINA_UNUSED, 11380evas_object_textblock_scale_update(Evas_Object *eo_obj EINA_UNUSED,
11258 Evas_Object_Protected_Data *obj EINA_UNUSED, 11381 Evas_Object_Protected_Data *obj EINA_UNUSED,
11259 void *type_private_data) 11382 void *type_private_data)
@@ -11313,8 +11436,14 @@ _evas_textblock_check_item_node_link(Evas_Object *eo_obj)
11313 Evas_Object_Textblock_Item *it; 11436 Evas_Object_Textblock_Item *it;
11314 11437
11315 if (!o) return EINA_FALSE; 11438 if (!o) return EINA_FALSE;
11439 Evas_Object_Protected_Data *obj = eo_data_scope_get(eo_obj, EVAS_OBJ_CLASS);
11316 11440
11317 if (!o->formatted.valid) _relayout(eo_obj); 11441 evas_object_textblock_coords_recalc(eo_obj, obj, obj->private_data);
11442 if (!o->formatted.valid)
11443 {
11444 LYDBG("ZZ: relayout 17\n");
11445 _relayout(eo_obj);
11446 }
11318 11447
11319 EINA_INLIST_FOREACH(o->paragraphs, par) 11448 EINA_INLIST_FOREACH(o->paragraphs, par)
11320 { 11449 {