edje: Fix issue with width calculation and padding 27/67827/1
authorMinwoo, Lee <minwoo47.lee@samsung.com>
Thu, 28 Apr 2016 11:16:07 +0000 (20:16 +0900)
committerMinwoo, Lee <minwoo47.lee@samsung.com>
Thu, 28 Apr 2016 11:33:55 +0000 (20:33 +0900)
This patch is from opensource (acab227544b7903ed6c267f022ebc389246e9ccc)

    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();

Signed-off-by: Minwoo, Lee <minwoo47.lee@samsung.com>
Change-Id: I5ca56206064233698ca9802c761bf94320381dfb

src/lib/edje/edje_util.c

index 2190e38..5bba628 100644 (file)
@@ -3393,6 +3393,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;
 
@@ -3411,6 +3412,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;