Skip to content

Commit

Permalink
Revert "evas_textblock: content fit feature"
Browse files Browse the repository at this point in the history
This reverts commit 2f676a6.

This causes segv's in edje_cc - i suspect the eet changes (or in combo
to how they are used in edje):

AddressSanitizer:DEADLYSIGNAL
=================================================================
==8991==ERROR: AddressSanitizer: SEGV on unknown address 0x000001010000 (pc 0xffff9f002604 bp 0xfffffa747700 sp 0xfffffa747700 T0)
==8991==The signal is caused by a READ memory access.
    #0 0xffff9f002600 in _eet_hash_gen ../src/lib/eet/eet_utils.c:25
    Enlightenment#1 0xffff9efdd024 in eet_dictionary_string_add ../src/lib/eet/eet_dictionary.c:103
    Enlightenment#2 0xffff9efbe324 in eet_data_put_string ../src/lib/eet/eet_data.c:849
    Enlightenment#3 0xffff9efc1c4c in eet_data_put_type ../src/lib/eet/eet_data.c:1427
    Enlightenment#4 0xffff9efd9128 in eet_data_put_unknown ../src/lib/eet/eet_data.c:4730
    Enlightenment#5 0xffff9efdb320 in _eet_data_descriptor_encode ../src/lib/eet/eet_data.c:5108
    Enlightenment#6 0xffff9efd5958 in eet_data_put_variant ../src/lib/eet/eet_data.c:4309
    Enlightenment#7 0xffff9efdb320 in _eet_data_descriptor_encode ../src/lib/eet/eet_data.c:5108
    Enlightenment#8 0xffff9efd9270 in eet_data_put_unknown ../src/lib/eet/eet_data.c:4739
    Enlightenment#9 0xffff9efdb320 in _eet_data_descriptor_encode ../src/lib/eet/eet_data.c:5108
    Enlightenment#10 0xffff9efd8ca0 in eet_data_put_array ../src/lib/eet/eet_data.c:4692
    Enlightenment#11 0xffff9efdb320 in _eet_data_descriptor_encode ../src/lib/eet/eet_data.c:5108
    Enlightenment#12 0xffff9efc7768 in eet_data_write_cipher ../src/lib/eet/eet_data.c:2403
    Enlightenment#13 0xffff9efc78a4 in eet_data_write ../src/lib/eet/eet_data.c:2420
    Enlightenment#14 0xaaaabb151dcc in data_thread_group ../src/bin/edje/edje_cc_out.c:2045
    Enlightenment#15 0xaaaabb152130 in data_write_groups ../src/bin/edje/edje_cc_out.c:2086
    Enlightenment#16 0xaaaabb157734 in data_write ../src/bin/edje/edje_cc_out.c:2866
    Enlightenment#17 0xaaaabb14122c in main ../src/bin/edje/edje_cc.c:456
    Enlightenment#18 0xffff9dbd92a0 in __libc_start_main (/usr/lib/aarch64-linux-gnu/libc.so.6+0x242a0)
    Enlightenment#19 0xaaaabb13ea00  (/home/raster/C/git/efl/build/src/bin/edje/edje_cc+0x38a00)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ../src/lib/eet/eet_utils.c:25 in _eet_hash_gen
==8991==ABORTING
Aborted (core dumped)

When compiling breaks... it's certainly time to revert ASAP :(
  • Loading branch information
rastermann committed Nov 7, 2019
1 parent e4e7ff3 commit 39240fa
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 983 deletions.
81 changes: 0 additions & 81 deletions src/bin/edje/edje_cc_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,6 @@ static void st_collections_group_parts_part_description_text_repch(void);
static void st_collections_group_parts_part_description_text_size(void);
static void st_collections_group_parts_part_description_text_size_range(void);
static void st_collections_group_parts_part_description_text_fit(void);
static void st_collections_group_parts_part_description_text_fit_step(void);
static void st_collections_group_parts_part_description_text_fit_size_array(void);
static void st_collections_group_parts_part_description_text_min(void);
static void st_collections_group_parts_part_description_text_max(void);
static void st_collections_group_parts_part_description_text_align(void);
Expand Down Expand Up @@ -954,8 +952,6 @@ New_Statement_Handler statement_handlers[] =
{"collections.group.parts.part.description.text.size", st_collections_group_parts_part_description_text_size},
{"collections.group.parts.part.description.text.size_range", st_collections_group_parts_part_description_text_size_range},
{"collections.group.parts.part.description.text.fit", st_collections_group_parts_part_description_text_fit},
{"collections.group.parts.part.description.text.fit_step", st_collections_group_parts_part_description_text_fit_step},
{"collections.group.parts.part.description.text.fit_size_array", st_collections_group_parts_part_description_text_fit_size_array},
{"collections.group.parts.part.description.text.min", st_collections_group_parts_part_description_text_min},
{"collections.group.parts.part.description.text.max", st_collections_group_parts_part_description_text_max},
{"collections.group.parts.part.description.text.align", st_collections_group_parts_part_description_text_align},
Expand Down Expand Up @@ -11658,83 +11654,6 @@ st_collections_group_parts_part_description_text_fit(void)
ed->text.fit_y = parse_bool(1);
}


/**
@page edcref
@property
fit_step
@parameters
[font step size in points (pt)]
@effect
Sets the font step size for the text part. when fitting text
Defaults: 1
@since 1.24.0
@endproperty
*/
static void
st_collections_group_parts_part_description_text_fit_step(void)
{
Edje_Part_Description_Text *ed;

check_arg_count(1);

if (current_part->type != EDJE_PART_TYPE_TEXTBLOCK)
{
ERR("parse error %s:%i. text attributes in non-TEXTBLOCK part.",
file_in, line - 1);
exit(-1);
}

ed = (Edje_Part_Description_Text *)current_desc;

ed->text.fit_step = parse_int(0);

if (ed->text.fit_step < 1)
{
ERR("parse error %s:%i. fit step less than 1.",
file_in, line - 1);
exit(-1);
}
}

/**
@page edcref
@property
fit
@parameters
[Array of font sizes in points]
@effect
Sets the allowed font sizes array for the text part.
@since 1.24.0
@endproperty
*/
static void
st_collections_group_parts_part_description_text_fit_size_array(void)
{
int n, argc;
Edje_Part_Description_Text *ed;

if (current_part->type != EDJE_PART_TYPE_TEXTBLOCK)
{
ERR("parse error %s:%i. text attributes in non-TEXTBLOCK part.",
file_in, line - 1);
exit(-1);
}

ed = (Edje_Part_Description_Text *)current_desc;
check_min_arg_count(1);

for (n = 0, argc = get_arg_count(); n < argc; n++)
{
unsigned int *value = malloc(sizeof(unsigned int));
*value = (unsigned int) parse_int(n);
ed->text.fit_size_array = eina_list_append(ed->text.fit_size_array, value);
}
}

/**
@page edcref
Expand Down
2 changes: 0 additions & 2 deletions src/bin/elementary/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ void test_flip_page_eo(void *data, Evas_Object *obj, void *event_info);
void test_label(void *data, Evas_Object *obj, void *event_info);
void test_label_slide(void *data, Evas_Object *obj, void *event_info);
void test_label_wrap(void *data, Evas_Object *obj, void *event_info);
void test_textblock_fit(void *data, Evas_Object *obj, void *event_info);
void test_label_ellipsis(void *data, Evas_Object *obj, void *event_info);
void test_label_colors(void *data, Evas_Object *obj, void *event_info);
void test_label_emoji(void *data, Evas_Object *obj, void *event_info);
Expand Down Expand Up @@ -1208,7 +1207,6 @@ my_win_main(const char *autorun, Eina_Bool test_win_only)
ADD_TEST(NULL, "Text", "Label", test_label);
ADD_TEST(NULL, "Text", "Label Slide", test_label_slide);
ADD_TEST(NULL, "Text", "Label Wrap", test_label_wrap);
ADD_TEST(NULL, "Text", "Textblock Fit", test_textblock_fit);
ADD_TEST(NULL, "Text", "Label Ellipsis", test_label_ellipsis);
ADD_TEST(NULL, "Text", "Label Colors", test_label_colors);
ADD_TEST(NULL, "Text", "Label Emoji", test_label_emoji);
Expand Down
232 changes: 0 additions & 232 deletions src/bin/elementary/test_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,238 +309,6 @@ test_label_slide(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
evas_object_show(win);
}



/*** FIT TEXT **************************************************************/
enum BUTTON{
BUTTON_MODE = 0,
BUTTON_MAX = 1,
BUTTON_MIN = 2,
BUTTON_STEP = 3,
BUTTON_ARRAY = 4,
BUTTON_CONTENT = 5,
BUTTON_STYLE = 6,
BUTTON_ALL = BUTTON_STYLE+1,
};

char* BUTTON_STR[BUTTON_ALL] ={
"MODE",
"MAX",
"MIN",
"STEP",
"ARRAY",
"CONTENT",
"STYLE",
};

char *contents[] = {
"Hello World",
"This is Line<br>THis is other Line",
"This text contains <font_size=20 color=#F00>SPECIFIC SIZE</font_size>that does not effected by fit mode"
};

char *styles[] = {
"DEFAULT='font=sans font_size=30 color=#000 wrap=mixed ellipsis=1.0'",
"DEFAULT='font=sans font_size=30 color=#000 wrap=mixed'",
"DEFAULT='font=sans font_size=30 color=#000 ellipsis=1.0'",
"DEFAULT='font=sans font_size=30 color=#000'",
};

char *styles_names[] = {
"wrap=<color=#F00>mixed</color> ellipsis=<color=#F00>1.0</color>",
"wrap=<color=#F00>mixed</color> ellipsis=<color=#F00>NONE</color>",
"wrap=<color=#F00>NONE</color> ellipsis=<color=#F00>1.0</color>",
"wrap=<color=#F00>NONE</color> ellipsis=<color=#F00>NONE</color>",
};

typedef struct _APP
{
Evas_Object *win, *box, *txtblock,*bg, *boxHor, *boxHor2;
Eo *btn[BUTTON_ALL];
Eo *lbl_status;
char * str;
unsigned int i_contnet, i_style;
} APP;
APP *app;

char * get_fit_status(Eo * textblock);

static void _btn_clicked(void *data EINA_UNUSED, Eo *obj, void *eventInfo EINA_UNUSED){
if (obj == app->btn[BUTTON_MODE])
{
unsigned int options;
evas_textblock_fit_options_get(app->txtblock, &options);
if (options == TEXTBLOCK_FIT_MODE_NONE)
evas_textblock_fit_options_set(app->txtblock, TEXTBLOCK_FIT_MODE_HEIGHT);
else if (options == TEXTBLOCK_FIT_MODE_HEIGHT)
evas_textblock_fit_options_set(app->txtblock, TEXTBLOCK_FIT_MODE_WIDTH);
else if (options == TEXTBLOCK_FIT_MODE_WIDTH)
evas_textblock_fit_options_set(app->txtblock, TEXTBLOCK_FIT_MODE_ALL);
else if (options == TEXTBLOCK_FIT_MODE_ALL)
evas_textblock_fit_options_set(app->txtblock, TEXTBLOCK_FIT_MODE_NONE);
}
else if (obj == app->btn[BUTTON_MAX])
{
unsigned int min, max;
evas_textblock_fit_size_range_get(app->txtblock, &min, &max);
max -= 5;
evas_textblock_fit_size_range_set(app->txtblock, min, max);
}
else if (obj == app->btn[BUTTON_MIN])
{
unsigned int min, max;
evas_textblock_fit_size_range_get(app->txtblock, &min, &max);
min += 5;
evas_textblock_fit_size_range_set(app->txtblock, min, max);
}
else if (obj == app->btn[BUTTON_STEP])
{
unsigned int step;
evas_textblock_fit_step_size_get(app->txtblock, &step);
step++;
evas_textblock_fit_step_size_set(app->txtblock, step);
}
else if (obj == app->btn[BUTTON_ARRAY])
{
unsigned int font_size[] = {10, 50, 100 ,150};
evas_textblock_fit_size_array_set(app->txtblock,font_size,4);
}
else if (obj == app->btn[BUTTON_CONTENT])
{
app->i_contnet++;
if(app->i_contnet>=sizeof(contents)/sizeof(char*))
app->i_contnet=0;
evas_object_textblock_text_markup_set(app->txtblock,contents[app->i_contnet]);
}
else if (obj == app->btn[BUTTON_STYLE])
{
app->i_style++;
if(app->i_style>=sizeof(styles)/sizeof(char*))
app->i_style=0;

Evas_Textblock_Style *style = evas_object_textblock_style_get(app->txtblock);
evas_textblock_style_set(style,styles[app->i_style]);
}

elm_object_text_set(app->lbl_status, get_fit_status(app->txtblock));
}

char * get_fit_status(Eo * textblock)
{
static char status[0xFFF];
unsigned int options,min,max,step,size_array[256];
size_t size_array_len;
evas_textblock_fit_options_get(textblock,&options);
evas_textblock_fit_size_range_get(textblock,&min,&max);
evas_textblock_fit_step_size_get(textblock,&step);
evas_textblock_fit_size_array_get(textblock,NULL,&size_array_len,0);
if (size_array_len>255)
size_array_len = 255;
evas_textblock_fit_size_array_get(textblock,size_array,NULL,size_array_len);

strcpy(status,"Mode : ");
if (options == TEXTBLOCK_FIT_MODE_NONE)
strcat(status,"MODE_NONE");
else if (options == TEXTBLOCK_FIT_MODE_HEIGHT)
strcat(status,"MODE_HEIGHT");
else if (options == TEXTBLOCK_FIT_MODE_WIDTH)
strcat(status,"MODE_WIDTH");
else if (options == TEXTBLOCK_FIT_MODE_ALL)
strcat(status,"MODE_ALL");

strcat(status,"<br>");
sprintf(status + strlen(status),"Max : %d<br>",max);
sprintf(status + strlen(status),"Min : %d<br>",min);
sprintf(status + strlen(status),"Step : %d<br>",step);
sprintf(status + strlen(status),"Array : [ ");
for (size_t i = 0 ; i < 10 ; i++)
{
if(i<size_array_len)
sprintf(status + strlen(status)," %d,",size_array[i]);
}

if(10<size_array_len)
sprintf(status + strlen(status)," ... ");
sprintf(status + strlen(status)," ]");

sprintf(status + strlen(status),"<br>");
sprintf(status + strlen(status),"%s",styles_names[app->i_style]);



return status;
}

void
test_textblock_fit(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
app = calloc(sizeof(APP), 1);

elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

app->win = elm_win_util_standard_add("Main", "App");
elm_win_autodel_set(app->win, EINA_TRUE);

app->box = elm_box_add(app->win);
app->boxHor = elm_box_add(app->box);
app->boxHor2 = elm_box_add(app->box);
app->txtblock = evas_object_textblock_add(app->box);
app->bg = elm_bg_add(app->box);
elm_bg_color_set(app->bg,255,255,255);

Evas_Textblock_Style *style = evas_textblock_style_new();
evas_textblock_style_set(style,styles[0]);
evas_object_textblock_style_set(app->txtblock,style);
evas_object_textblock_text_markup_set(app->txtblock,contents[0]);

elm_box_horizontal_set(app->boxHor, EINA_TRUE);
elm_box_horizontal_set(app->boxHor2, EINA_TRUE);

evas_object_size_hint_weight_set(app->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(app->box, EVAS_HINT_FILL, EVAS_HINT_FILL);


evas_object_size_hint_weight_set(app->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(app->box, EVAS_HINT_FILL, EVAS_HINT_FILL);

evas_object_show(app->txtblock);
evas_object_show(app->bg);
evas_object_show(app->box);
evas_object_show(app->boxHor);
evas_object_show(app->boxHor2);

elm_box_pack_end(app->box, app->bg);
elm_box_pack_end(app->box, app->boxHor);
elm_box_pack_end(app->box, app->boxHor2);

elm_object_content_set(app->bg,app->txtblock);

elm_win_resize_object_add(app->win, app->box);
evas_object_resize(app->win, 320, 480);

for(int i = 0 ; i < BUTTON_ALL ; i++)
{
app->btn[i] = elm_button_add(app->boxHor);
evas_object_smart_callback_add(app->btn[i], "clicked", _btn_clicked, NULL);
elm_object_text_set(app->btn[i], BUTTON_STR[i]);
elm_box_pack_end(app->boxHor, app->btn[i]);
evas_object_show(app->btn[i]);
}

app->lbl_status = elm_label_add(app->boxHor2);
elm_object_text_set(app->lbl_status, get_fit_status(app->txtblock));
elm_box_pack_end(app->boxHor2, app->lbl_status);
evas_object_show(app->lbl_status);

evas_object_size_hint_weight_set(app->txtblock, EVAS_HINT_EXPAND,EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(app->txtblock, EVAS_HINT_FILL, EVAS_HINT_FILL);

evas_object_size_hint_weight_set(app->bg, EVAS_HINT_EXPAND,EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(app->bg, EVAS_HINT_FILL, EVAS_HINT_FILL);

evas_object_show(app->win);
}

/*** Label Wrap **************************************************************/
void
test_label_wrap(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
Expand Down
2 changes: 0 additions & 2 deletions src/lib/edje/edje_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -1188,8 +1188,6 @@ _edje_edd_init(void)
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.size_range_max", text.size_range_max, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.fit_x", text.fit_x, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.fit_y", text.fit_y, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.fit_step", text.fit_step, EET_T_UINT);
EET_DATA_DESCRIPTOR_ADD_LIST_UINT(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.fit_size_array", text.fit_size_array);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.min_x", text.min_x, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.min_y", text.min_y, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.max_x", text.max_x, EET_T_UCHAR);
Expand Down
3 changes: 0 additions & 3 deletions src/lib/edje/edje_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -1460,9 +1460,6 @@ struct _Edje_Part_Description_Spec_Text
int id_text_source; /* -1 if none */
int size_range_min;
int size_range_max; /* -1 means, no bound. */
unsigned int fit_step;
/*FIXME THIS SHOULD BE EINA_LIST*/
Eina_List *fit_size_array;

unsigned char fit_x; /* resize font size down to fit in x dir */
unsigned char fit_y; /* resize font size down to fit in y dir */
Expand Down
Loading

0 comments on commit 39240fa

Please sign in to comment.