jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=85d04a74d43a6ec2aa5e595284d5d0fdefeb8f77

commit 85d04a74d43a6ec2aa5e595284d5d0fdefeb8f77
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Mon Aug 21 18:25:39 2017 +0900

    elm_box: Fix support of aspect hints
    
    Test scenario: ephoto without a recent patch (47fe2b9ab03c151b0f4).
    Before any further explanation, ephoto was definitely misusing the
    aspect API here. A label most definitely shouldn't be sized based on an
    aspect ratio, that's just crazy (you really want to make it as tall as
    it's wide?)
    
    If a box has an aspected item, it needs to run its min calc loop twice:
     1. Once to determine the "true" min size in the direction of the box
        (ie.  in X in case of a horizontal box), and
     2. Once more in order to apply the aspect ratio to aspected items and
        augment the perpendicular min size (ie. Y for horizontal).
    
    After that, it can go and layout the items based on the available size.
    
    As we may guess from the above description (1) determines min W and
    (2) determines min H (in horizontal mode).
    
    BUT, there were two problems:
     - The wrong item min size was used inside the 2nd loop (the code was
       not symmetrical between horizontal and vertical modes). These are the
       changes in _smart_extents_non_homogeneous_calc.
     - The box min length was based on the actual size of aspected items,
       rather than their min size. This goes against the observation. These
       are the changes in _smart_extents_calculate.
    
    Ref T5888
    
    @fix
---
 src/lib/elementary/els_box.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/lib/elementary/els_box.c b/src/lib/elementary/els_box.c
index 199b739cf0..2be92907e2 100644
--- a/src/lib/elementary/els_box.c
+++ b/src/lib/elementary/els_box.c
@@ -184,7 +184,7 @@ _smart_extents_non_homogeneous_calc(Evas_Object_Box_Data 
*priv, int w, int h, in
              if (horizontal)
                {
                   /* use min size to start */
-                  ww = *rw;
+                  ww = mnw;
                   if ((expand > 0) && (wx > 0.0))
                     {
                        /* add remaining container value after applying weight 
hint */
@@ -195,7 +195,7 @@ _smart_extents_non_homogeneous_calc(Evas_Object_Box_Data 
*priv, int w, int h, in
                }
              else
                {
-                  hh = *rh;
+                  hh = mnh;
                   if ((expand > 0) && (wy > 0.0))
                     {
                        oh = ((h - cminh) * wy) / expand;
@@ -334,8 +334,12 @@ _smart_extents_calculate(Evas_Object *box, 
Evas_Object_Box_Data *priv, int w, in
              /* aspect can only be accurately calculated after the full 
(non-aspected) min size of the box has
               * been calculated due to the use of this min size during aspect 
calculations
               */
+             int aminw = minw;
+             int aminh = minh;
              _smart_extents_padding_calc(priv, &minw, &minh, &maxw, &maxh, 
horizontal);
-             _smart_extents_non_homogeneous_calc(priv, w, h, &minw, &minh, 
&maxw, &maxh, expand, horizontal, 1);
+             _smart_extents_non_homogeneous_calc(priv, w, h, &aminw, &aminh, 
&maxw, &maxh, expand, horizontal, 1);
+             if (horizontal) minh = aminh;
+             else minw = aminw;
           }
      }
    _smart_extents_padding_calc(priv, &minw, &minh, &maxw, &maxh, horizontal);

-- 


Reply via email to