summaryrefslogtreecommitdiff
path: root/src/lib/edje
diff options
context:
space:
mode:
authorSohyun Kim <anna1014.kim@samsung.com>2015-02-24 18:26:18 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-02-24 18:26:18 +0100
commit78ddad3dafea60c13c00c8565acc896f913e0a70 (patch)
treead684d6d8d5f167a81ffe4ced2303f70fe8531e3 /src/lib/edje
parentc029a8db5208f502d6d258eb924685e4954bbf90 (diff)
edje: Add edje to text_class_member_hash properly.
Summary: When textblock styles have text_classes, all edjes in the files were added to text_class_member_hash even if the edjes didn't use the textblock styles. It makes time long to update text_class. This will add the edje using the textblock style which has a text_class to text_class_member_hash. Reviewers: cedric, raster Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2035
Diffstat (limited to 'src/lib/edje')
-rw-r--r--src/lib/edje/edje_load.c4
-rw-r--r--src/lib/edje/edje_private.h4
-rw-r--r--src/lib/edje/edje_text.c3
-rw-r--r--src/lib/edje/edje_textblock_styles.c134
4 files changed, 115 insertions, 30 deletions
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index b411fb8412..22eed37232 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -382,7 +382,6 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
382 edje_module_load(ed->file->external_dir->entries[i].entry); 382 edje_module_load(ed->file->external_dir->entries[i].entry);
383 } 383 }
384 384
385 _edje_textblock_styles_add(ed);
386 _edje_textblock_style_all_update(ed); 385 _edje_textblock_style_all_update(ed);
387 386
388 ed->has_entries = EINA_FALSE; 387 ed->has_entries = EINA_FALSE;
@@ -571,6 +570,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
571 _edje_callbacks_focus_add(rp->object, ed, rp); 570 _edje_callbacks_focus_add(rp->object, ed, rp);
572 break; 571 break;
573 case EDJE_PART_TYPE_TEXTBLOCK: 572 case EDJE_PART_TYPE_TEXTBLOCK:
573 _edje_textblock_styles_add(ed, rp);
574 textblocks = eina_list_append(textblocks, rp); 574 textblocks = eina_list_append(textblocks, rp);
575 rp->object = evas_object_textblock_add(ed->base->evas); 575 rp->object = evas_object_textblock_add(ed->base->evas);
576 break; 576 break;
@@ -1407,11 +1407,11 @@ _edje_file_del(Edje *ed)
1407 Edje_Part *ep; 1407 Edje_Part *ep;
1408 unsigned int i; 1408 unsigned int i;
1409 1409
1410 _edje_textblock_styles_del(ed);
1411 for (i = 0; i < ed->collection->parts_count; ++i) 1410 for (i = 0; i < ed->collection->parts_count; ++i)
1412 { 1411 {
1413 ep = ed->collection->parts[i]; 1412 ep = ed->collection->parts[i];
1414 1413
1414 _edje_textblock_styles_del(ed, ep);
1415 _edje_text_part_on_del(ed, ep); 1415 _edje_text_part_on_del(ed, ep);
1416 _edje_color_class_on_del(ed, ep); 1416 _edje_color_class_on_del(ed, ep);
1417 } 1417 }
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index f2d9f6c71b..476e196069 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -2362,8 +2362,8 @@ void _edje_message_queue_process (void);
2362void _edje_message_queue_clear (void); 2362void _edje_message_queue_clear (void);
2363void _edje_message_del (Edje *ed); 2363void _edje_message_del (Edje *ed);
2364 2364
2365void _edje_textblock_styles_add(Edje *ed); 2365void _edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep);
2366void _edje_textblock_styles_del(Edje *ed); 2366void _edje_textblock_styles_del(Edje *ed, Edje_Part *pt);
2367void _edje_textblock_styles_cache_free(Edje *ed, const char *text_class); 2367void _edje_textblock_styles_cache_free(Edje *ed, const char *text_class);
2368void _edje_textblock_style_all_update(Edje *ed); 2368void _edje_textblock_style_all_update(Edje *ed);
2369void _edje_textblock_style_parse_and_fix(Edje_File *edf); 2369void _edje_textblock_style_parse_and_fix(Edje_File *edf);
diff --git a/src/lib/edje/edje_text.c b/src/lib/edje/edje_text.c
index 05c2a6805f..c180122eeb 100644
--- a/src/lib/edje/edje_text.c
+++ b/src/lib/edje/edje_text.c
@@ -61,8 +61,7 @@ _edje_text_part_on_del(Edje *ed, Edje_Part *pt)
61 unsigned int i; 61 unsigned int i;
62 62
63 if (!pt) return; 63 if (!pt) return;
64 if (pt->type != EDJE_PART_TYPE_TEXT 64 if (pt->type != EDJE_PART_TYPE_TEXT)
65 && pt->type != EDJE_PART_TYPE_TEXTBLOCK)
66 return; 65 return;
67 66
68 desc = (Edje_Part_Description_Text *) pt->default_desc; 67 desc = (Edje_Part_Description_Text *) pt->default_desc;
diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c
index 5d423f74cf..0819b5e550 100644
--- a/src/lib/edje/edje_textblock_styles.c
+++ b/src/lib/edje/edje_textblock_styles.c
@@ -268,44 +268,130 @@ _edje_textblock_style_all_update(Edje *ed)
268} 268}
269 269
270void 270void
271_edje_textblock_styles_add(Edje *ed) 271_edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep)
272{ 272{
273 Eina_List *l, *ll; 273 Edje_Part *pt = ep->part;
274 Edje_Style *stl; 274 Edje_Part_Description_Text *desc;
275 Edje_Style *stl = NULL;
276 const char *style;
277 unsigned int i;
278
279 if (pt->type != EDJE_PART_TYPE_TEXTBLOCK) return;
280
281 /* if text class exists in the textblock styles for this part,
282 add the edje to the tc member list */
283 desc = (Edje_Part_Description_Text *)pt->default_desc;
284 style = edje_string_get(&desc->text.style);
285 if (style)
286 {
287 Eina_List *l;
275 288
276 if (!ed->file) return; 289 EINA_LIST_FOREACH(ed->file->styles, l, stl)
290 {
291 if ((stl->name) && (!strcmp(stl->name, style))) break;
292 stl = NULL;
293 }
294 }
295 if (stl)
296 {
297 Edje_Style_Tag *tag;
298 Eina_List *l;
277 299
278 EINA_LIST_FOREACH(ed->file->styles, l, stl) 300 EINA_LIST_FOREACH(stl->tags, l, tag)
301 {
302 if (tag->text_class)
303 _edje_text_class_member_add(ed, tag->text_class);
304 }
305 }
306
307 /* If any other classes exist add them */
308 for (i = 0; i < pt->other.desc_count; ++i)
279 { 309 {
280 Edje_Style_Tag *tag; 310 desc = (Edje_Part_Description_Text *)pt->other.desc[i];
311 style = edje_string_get(&desc->text.style);
312 if (style)
313 {
314 Eina_List *l;
281 315
282 /* Make sure the style contains the text_class */ 316 EINA_LIST_FOREACH(ed->file->styles, l, stl)
283 EINA_LIST_FOREACH(stl->tags, ll, tag) 317 {
284 { 318 if ((stl->name) && (!strcmp(stl->name, style))) break;
285 if (!tag->text_class) continue; 319 stl = NULL;
286 _edje_text_class_member_add(ed, tag->text_class); 320 }
287 } 321 }
322 if (stl)
323 {
324 Edje_Style_Tag *tag;
325 Eina_List *l;
326
327 EINA_LIST_FOREACH(stl->tags, l, tag)
328 {
329 if (tag->text_class)
330 _edje_text_class_member_add(ed, tag->text_class);
331 }
332 }
288 } 333 }
289} 334}
290 335
291void 336void
292_edje_textblock_styles_del(Edje *ed) 337_edje_textblock_styles_del(Edje *ed, Edje_Part *pt)
293{ 338{
294 Eina_List *l, *ll; 339 Edje_Part_Description_Text *desc;
295 Edje_Style *stl; 340 Edje_Style *stl = NULL;
341 const char *style;
342 unsigned int i;
296 343
297 if (!ed->file) return; 344 if (pt->type != EDJE_PART_TYPE_TEXTBLOCK) return;
298 345
299 EINA_LIST_FOREACH(ed->file->styles, l, stl) 346 desc = (Edje_Part_Description_Text *)pt->default_desc;
347 style = edje_string_get(&desc->text.style);
348 if (style)
300 { 349 {
301 Edje_Style_Tag *tag; 350 Eina_List *l;
302 351
303 /* Make sure the style contains the text_class */ 352 EINA_LIST_FOREACH(ed->file->styles, l, stl)
304 EINA_LIST_FOREACH(stl->tags, ll, tag) 353 {
305 { 354 if ((stl->name) && (!strcmp(stl->name, style))) break;
306 if (!tag->text_class) continue; 355 stl = NULL;
307 _edje_text_class_member_del(ed, tag->text_class); 356 }
308 } 357 }
358 if (stl)
359 {
360 Edje_Style_Tag *tag;
361 Eina_List *l;
362
363 EINA_LIST_FOREACH(stl->tags, l, tag)
364 {
365 if (tag->text_class)
366 _edje_text_class_member_del(ed, tag->text_class);
367 }
368 }
369
370 for (i = 0; i < pt->other.desc_count; ++i)
371 {
372 desc = (Edje_Part_Description_Text *)pt->other.desc[i];
373 style = edje_string_get(&desc->text.style);
374 if (style)
375 {
376 Eina_List *l;
377
378 EINA_LIST_FOREACH(ed->file->styles, l, stl)
379 {
380 if ((stl->name) && (!strcmp(stl->name, style))) break;
381 stl = NULL;
382 }
383 }
384 if (stl)
385 {
386 Edje_Style_Tag *tag;
387 Eina_List *l;
388
389 EINA_LIST_FOREACH(stl->tags, l, tag)
390 {
391 if (tag->text_class)
392 _edje_text_class_member_del(ed, tag->text_class);
393 }
394 }
309 } 395 }
310} 396}
311 397