Edje entry: Fix issue with width calculation and padding
authorJaeyong Hwang <j_yong.hwang@samsung.com>
Thu, 17 Dec 2015 12:44:29 +0000 (12:44 +0000)
committerTom Hacohen <tom@stosb.com>
Thu, 17 Dec 2015 12:44:36 +0000 (12:44 +0000)
Summary:
The size of the style pad isn't considered when the min value of the
textblock is calculated.  In case of putting the lable that there is an
outline in the box, the letter is cut.  So, I revised so that
evas_object_textblock_style_insets_get could be called after a
evas_object_textblock_size_formatted_get in
_edje_object_size_min_restricted_calc function.  And then the style pad was
considered in the result value of the edje_object_size_min_calc.

@fix

Test Plan:

EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *box, *label;
   Evas_Object *win;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add("Font", "FONT");
   elm_win_autodel_set(win, EINA_TRUE);

   box = elm_box_add(win);
   elm_box_padding_set(box, 10, 0);
   elm_box_align_set(box, 1, 0.5);
   evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_win_resize_object_add(win, box);
   evas_object_show(box);

   label = elm_label_add(box);
   elm_object_text_set(label, "<font=default align=rignt color=#ffffff font_size=200 style=soft_outline outline_color=#ff0000ff>label");
   elm_box_pack_end(box, label);
   evas_object_show(label);

   evas_object_resize(win, 500, 300);
   evas_object_show(win);
   elm_run();

   return 0;
}
ELM_MAIN();

Reviewers: herdsman, tasn

Reviewed By: tasn

Subscribers: id213sin, cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D3426

src/lib/edje/edje_util.c

index a8e7b81..5bbc42d 100644 (file)
@@ -3808,6 +3808,7 @@ again:
         for (i = 0; i < ed->table_parts_size; i++)
           {
              Edje_Real_Part *ep = ed->table_parts[i];
+             Evas_Coord ins_l, ins_r;
 
              if (!ep->chosen_description) continue;
 
@@ -3826,6 +3827,8 @@ again:
                        Evas_Coord tb_mw;
                        evas_object_textblock_size_formatted_get(ep->object,
                                                                 &tb_mw, NULL);
+                       evas_object_textblock_style_insets_get(ep->object, &ins_l, &ins_r, NULL, NULL);
+                       tb_mw = ins_l + tb_mw + ins_r;
                        tb_mw -= ep->req.w;
                        if (tb_mw > over_w) over_w = tb_mw;
                        has_fixed_tb = EINA_FALSE;