xartigas pushed a commit to branch master.

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

commit ae29408b86eaf8f6f324baff0312b336d56b1efc
Author: Yeongjong Lee <[email protected]>
Date:   Fri Sep 6 09:29:09 2019 +0200

    efl_ui_table: respect col,row span in last_position calculation
    
    Summary:
    col,row spen is needed to get correct last_position.
    
    Thanks to segfaultxavi for refporting.
    
    ref T8182
    
    Test Plan:
    
https://git.enlightenment.org/tools/examples.git/tree/reference/c/ui/src/ui_container.c
    
    Check that long button and small button are not overlapped.
    
    Reviewers: segfaultxavi
    
    Reviewed By: segfaultxavi
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Maniphest Tasks: T8182
    
    Differential Revision: https://phab.enlightenment.org/D9854
---
 src/lib/elementary/efl_ui_table.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/lib/elementary/efl_ui_table.c 
b/src/lib/elementary/efl_ui_table.c
index 2c24c73fb1..865fc76577 100644
--- a/src/lib/elementary/efl_ui_table.c
+++ b/src/lib/elementary/efl_ui_table.c
@@ -88,6 +88,7 @@ _efl_ui_table_last_position_get(Eo * obj, Efl_Ui_Table_Data 
*pd, int *last_col,
    Table_Item *gi;
    int col = -1, row  = -1;
    int req_cols, req_rows;
+   int item_row, item_col;
 
    if (!pd->linear_recalc)
      {
@@ -102,17 +103,20 @@ _efl_ui_table_last_position_get(Eo * obj, 
Efl_Ui_Table_Data *pd, int *last_col,
      {
         EINA_INLIST_REVERSE_FOREACH(EINA_INLIST_GET(pd->items), gi)
           {
-             if ((gi->row < row) || (req_cols < gi->col) || (req_rows < 
gi->row))
+             item_row = gi->row + gi->row_span - 1;
+             item_col = gi->col + gi->col_span - 1;
+             if ((item_row < row) || (req_cols < item_col) ||
+                 (req_rows < item_row))
                continue;
 
-             if (gi->row > row)
+             if (item_row > row)
                {
-                  row = gi->row;
-                  col = gi->col;
+                  row = item_row;
+                  col = item_col;
                }
-             else if (gi->col > col)
+             else if (item_col > col)
                {
-                  col = gi->col;
+                  col = item_col;
                }
           }
      }
@@ -120,17 +124,20 @@ _efl_ui_table_last_position_get(Eo * obj, 
Efl_Ui_Table_Data *pd, int *last_col,
      {
         EINA_INLIST_REVERSE_FOREACH(EINA_INLIST_GET(pd->items), gi)
           {
-             if ((gi->col < col) || (req_cols < gi->col) || (req_rows < 
gi->row))
+             item_row = gi->row + gi->row_span - 1;
+             item_col = gi->col + gi->col_span - 1;
+             if ((item_col < col) || (req_cols < item_col) ||
+                 (req_rows < item_row))
                continue;
 
-             if (gi->col > col)
+             if (item_col > col)
                {
-                  col = gi->col;
-                  row = gi->row;
+                  col = item_col;
+                  row = item_row;
                }
-             else if (gi->row > row)
+             else if (item_row > row)
                {
-                  row = gi->row;
+                  row = item_row;
                }
           }
      }

-- 


Reply via email to