evas_box: fix children size and position calculation when padding is used for horizon...
authorSubodh Kumar <s7158.kumar@samsung.com>
Sun, 4 Oct 2015 13:23:49 +0000 (15:23 +0200)
committerCedric BAIL <cedric@osg.samsung.com>
Sun, 4 Oct 2015 14:22:49 +0000 (16:22 +0200)
Summary:
Fix children size and position calculation when padding is used

For each child size calculation padding is adjusted
but box height should include  padding.
Secondly, x and y position of children should not  include
the vertical and horizonatal padding as child size has already
included the given paddings.

@fix

Test Plan:
Please modify test_box.c file in
function test_box_vert2 as follows:

   bx = elm_box_add(win);
   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, bx);
   elm_box_padding_set(bx, 50, 50);
   elm_box_layout_set(bx, evas_object_box_layout_flow_horizontal, NULL, NULL);
   evas_object_show(bx);

Now,
1. open elementary_test
2. box
3. Box vert 2 (observe box is broken)
4. Try resizing the window (observe)

Reviewers: raster, cedric

Reviewed By: cedric

Subscribers: cedric

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

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
src/lib/evas/canvas/evas_object_box.c

index a33a9e4..3510fb0 100644 (file)
@@ -1333,7 +1333,7 @@ _evas_box_layout_flow_horizontal(Eo *o, Evas_Object_Box_Data *priv, Evas_Object_
      (priv, w, &row_count, row_max_h, row_break, row_width, &offset_y, &min_w, &max_h);
 
    inc_y = 0;
-   remain_y = h - (offset_y + max_h);
+   remain_y = h - (priv->pad.v * row_count -1) - (offset_y + max_h);
 
    if (remain_y > 0)
      {
@@ -1353,7 +1353,7 @@ _evas_box_layout_flow_horizontal(Eo *o, Evas_Object_Box_Data *priv, Evas_Object_
         int row_size, remain_x;
 
         row_size = row_break[r] - i;
-        remain_x = (w - row_width[r]);
+        remain_x = (w - (row_width[r] - priv->pad.h));
 
         if (priv->align.h < 0.0)
           {
@@ -1403,6 +1403,9 @@ _evas_box_layout_flow_horizontal(Eo *o, Evas_Object_Box_Data *priv, Evas_Object_
         evas_object_geometry_get(o, &x, NULL, NULL, NULL);
         min_h += row_max_h[r];
         y += row_max_h[r] + inc_y;
+
+        if (r > 0)
+          min_h += priv->pad.v;
      }
 
    evas_object_size_hint_min_set(o, min_w, min_h);