evas_textblock: remove style padding from native width and formatted height
authorYoungbok Shin <youngb.shin@samsung.com>
Tue, 1 Sep 2020 10:39:13 +0000 (19:39 +0900)
committerJongmin Lee <jm105.lee@samsung.com>
Tue, 1 Sep 2020 21:23:02 +0000 (06:23 +0900)
commit8ab79d973cfa1ce9fde58a72c3fbb4290a2eb3fd
tree0b3b5212ccb28793199f0f2f4d453f52e30eb723
parent575f0c8ac7027eb1d3f16632291413da18d6b283
evas_textblock: remove style padding from native width and formatted height

Summary:
The style padding was included in native width(not in native height)
and formatted height(not in formatted width).
This is so weired. In addition, there is no enough document about
the relation between formatted size, native size and the style padding.
This issue is caused by a confusing code which is about how to handle
the style padding on item's width and height.("x_adjustment"!)

When Evas calculates "c->wmax" in line finalization stage, it explicitly subtract
style padding from line width. So, I assumed the formatted size has not to include
style padding. It is same for the native size.

The style padding will not be included in formatted size and native size by this commit.
@fix

Test Plan:
A test case is included in this commit.

Evas_Object *tb = evas_object_textblock_add(evas);

newst = evas_textblock_style_new();
evas_textblock_style_set(newst, "DEFAULT='font=Sans font_size=50 color=#000 text_class=entry'");
evas_object_textblock_style_set(tb, newst);

evas_object_textblock_text_markup_set(tb, "<style=far_soft_shadow>Test</>");
evas_object_textblock_style_insets_get(tb, &l, &r, &t, &b);
fail_if((l != 0) || (r != 4) || (t != 0) || (b != 4));

/* Size with style padding */
evas_object_textblock_size_formatted_get(tb, &w, &h);
evas_object_textblock_size_native_get(tb, &nw, &nh);

/* It is non-sense if the following condition is true. */
fail_if((w + l + r == nw) && (h == nh + t + b));

Reviewers: raster, ali.alzyod, woohyun, bowonryu

Reviewed By: ali.alzyod

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12110
src/lib/evas/canvas/efl_canvas_textblock.eo
src/lib/evas/canvas/evas_object_textblock.c
src/tests/evas/evas_test_textblock.c