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
This commit is contained in:
Yeongjong Lee 2019-09-06 09:29:09 +02:00 committed by Xavi Artigas
parent 0c801b0d12
commit ae29408b86
1 changed files with 19 additions and 12 deletions

View File

@ -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;
}
}
}