This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efl.
View the commit online.
commit 4243e82b2cc1fbda299986214939ba599daf18d9
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 15 20:35:11 2026 -0600
elementary: position_manager_list: ask again for rows left unfilled
The cache read the buffer for every row of a batch of a hundred,
whatever the provider said it filled, so the rows it did not fill were
placed by what the buffer held from before (or nothing at all the first
time). Both the full build and the incremental updates now take as many
as were filled and ask again from the first that was not; a provider
that fills none gives no cache, rather than one that is half built.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/elementary/efl_ui_position_manager_list.c | 30 ++++++++----
src/tests/elementary/efl_ui_test_collection_view.c | 53 +++++++++++++++++++++-
2 files changed, 73 insertions(+), 10 deletions(-)
diff --git a/src/lib/elementary/efl_ui_position_manager_list.c b/src/lib/elementary/efl_ui_position_manager_list.c
index 76b7daac34..9d97636a53 100644
--- a/src/lib/elementary/efl_ui_position_manager_list.c
+++ b/src/lib/elementary/efl_ui_position_manager_list.c
@@ -68,6 +68,7 @@ cache_require(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd)
const unsigned int len = 100;
Efl_Ui_Position_Manager_Size_Batch_Entity size_buffer[len];
Efl_Ui_Position_Manager_Size_Batch_Result size_result;
+ unsigned int batch_start = 0, filled = 0;
if (pd->size_cache)
{
@@ -96,13 +97,22 @@ cache_require(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd)
Eina_Size2D size;
int step;
int min;
- int buffer_id = i % len;
- if (buffer_id == 0)
+ // A provider may fill fewer than it was asked for: what it did not is asked again
+ if (i >= batch_start + filled)
{
- BATCH_ACCESS_SIZE(pd->callbacks, i, pd->size, MIN(len, pd->size - i), EINA_TRUE, size_buffer);
+ size_result = _batch_request_size(pd->callbacks, i, pd->size, MIN(len, pd->size - i),
+ EINA_TRUE, size_buffer);
+ filled = MIN(size_result.filled_items, len);
+ batch_start = i;
+ if (!filled)
+ {
+ // Not a cache of what is not known
+ cache_invalidate(obj, pd);
+ return;
+ }
}
- size = size_buffer[buffer_id].size;
+ size = size_buffer[i - batch_start].size;
if (pd->dir == EFL_UI_LAYOUT_ORIENTATION_VERTICAL)
{
@@ -156,21 +166,23 @@ _cache_range_ask(Efl_Ui_Position_Manager_List_Data *pd, unsigned int start, unsi
{
Efl_Ui_Position_Manager_Size_Batch_Entity size_buffer[100];
Efl_Ui_Position_Manager_Size_Batch_Result size_result;
- unsigned int i;
+ unsigned int i, batch_start = start, filled = 0;
for (i = start; i < end; i++)
{
- unsigned int buffer_id = (i - start) % 100;
Eina_Size2D size;
int min, step;
- if (buffer_id == 0)
+ // A provider may fill fewer than it was asked for: what it did not is asked again
+ if (i >= batch_start + filled)
{
size_result = _batch_request_size(pd->callbacks, i, end, MIN(100, end - i),
EINA_TRUE, size_buffer);
- if (size_result.filled_items == 0) return EINA_FALSE;
+ filled = MIN(size_result.filled_items, 100);
+ batch_start = i;
+ if (filled == 0) return EINA_FALSE;
}
- size = size_buffer[buffer_id].size;
+ size = size_buffer[i - batch_start].size;
if (pd->dir == EFL_UI_LAYOUT_ORIENTATION_VERTICAL)
{
step = size.h;
diff --git a/src/tests/elementary/efl_ui_test_collection_view.c b/src/tests/elementary/efl_ui_test_collection_view.c
index 6523585556..96e32149f6 100644
--- a/src/tests/elementary/efl_ui_test_collection_view.c
+++ b/src/tests/elementary/efl_ui_test_collection_view.c
@@ -1046,6 +1046,8 @@ EFL_END_TEST
#define CACHE_MAX_ROWS 400
static int _cache_sizes[CACHE_MAX_ROWS];
static unsigned int _cache_count = 0;
+// The most rows the provider fills in a call
+static unsigned int _cache_fill_cap = 0xffffffff;
static Efl_Ui_Position_Manager_Size_Batch_Result
_cache_size_cb(void *data EINA_UNUSED, Efl_Ui_Position_Manager_Size_Call_Config conf,
@@ -1055,7 +1057,9 @@ _cache_size_cb(void *data EINA_UNUSED, Efl_Ui_Position_Manager_Size_Call_Config
Efl_Ui_Position_Manager_Size_Batch_Result result = { 0 };
unsigned int i, limit = conf.range.end_id - conf.range.start_id;
- for (i = 0; (i < limit) && conf.range.start_id + i < _cache_count; i++)
+ for (i = 0;
+ (i < limit) && (i < _cache_fill_cap) && ((conf.range.start_id + i) < _cache_count);
+ i++)
{
sizes[i].size = EINA_SIZE2D(20, _cache_sizes[conf.range.start_id + i]);
sizes[i].element_depth = 0;
@@ -1197,6 +1201,52 @@ EFL_START_TEST(test_efl_ui_position_manager_list_cache_follows)
}
EFL_END_TEST
+/* A provider may fill fewer rows than it was asked for: those it did not fill
+ are asked for again, and none is placed by what the buffer held before. */
+EFL_START_TEST(test_efl_ui_position_manager_list_partial_fill)
+{
+ Efl_Ui_Win *win;
+ Efl_Ui_Position_Manager_Entity *manager;
+ unsigned int i;
+
+ win = win_add(NULL, "win", EFL_UI_WIN_TYPE_BASIC);
+ _cache_dummy = efl_add(EFL_UI_BUTTON_CLASS, win);
+ manager = efl_add(EFL_UI_POSITION_MANAGER_LIST_CLASS, win,
+ efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL));
+ efl_event_callback_add(manager, EFL_UI_POSITION_MANAGER_ENTITY_EVENT_CONTENT_SIZE_CHANGED,
+ _cache_content_size, NULL);
+ _cache_content_h = -1;
+ _cache_count = 250;
+ for (i = 0; i < _cache_count; i++)
+ {
+ _cache_sizes[i] = 10 + (i * 13) % 50;
+ }
+ _cache_fill_cap = 7;
+ efl_ui_position_manager_data_access_v1_data_access_set(manager, win, NULL, _cache_object_cb, NULL,
+ NULL, _cache_size_cb, NULL, _cache_count);
+ efl_ui_position_manager_entity_viewport_set(manager, EINA_RECT(0, 0, 100, 1));
+ _cache_places_check(manager);
+
+ // The changes asked for are filled by as few as well
+ _cache_sizes[20] = 77;
+ _cache_sizes[21] = 78;
+ _cache_sizes[22] = 79;
+ efl_ui_position_manager_entity_item_size_changed(manager, 20, 22);
+ _cache_places_check(manager);
+ for (i = 0; i < 30; i++)
+ {
+ memmove(_cache_sizes + 5, _cache_sizes + 4, (_cache_count - 4) * sizeof (int));
+ _cache_sizes[5] = 30 + i;
+ _cache_count++;
+ efl_ui_position_manager_entity_item_added(manager, 5, NULL);
+ }
+ _cache_places_check(manager);
+
+ _cache_fill_cap = 0xffffffff;
+ efl_del(manager);
+}
+EFL_END_TEST
+
/* A provider that gives one size to the rows nobody measured (the size of
the view, then the shared size of a Homogeneous_Model once there is one)
changes the size of rows it was not told about when one of them is
@@ -1613,6 +1663,7 @@ void efl_ui_test_collection_view(TCase *tc)
tcase_add_test(tc, test_efl_ui_position_manager_list_cache_follows);
tcase_add_test(tc, test_efl_ui_collection_view_many_single_adds);
tcase_add_test(tc, test_efl_ui_position_manager_list_cache_shared_size);
+ tcase_add_test(tc, test_efl_ui_position_manager_list_partial_fill);
tcase_add_test(tc, test_efl_ui_position_manager_grid_groups_follow);
tcase_add_test(tc, test_efl_ui_collection_view_many_single_adds_idle);
tcase_add_test(tc, test_efl_ui_collection_view_many_single_adds_grid);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.