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 20488edb02d171e52a8f0273a71d5051a4ec0bf1
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Oct 25 18:49:55 2026 -0600

    elementary: collection view stand-in size stays put until a recache
    
    Until an item has been measured, a collection view says every item is as
    big as the view itself, so that the position manager asks for one item
    to measure. The position manager adds those sizes up once into a cache
    and asks again for each item it places, and logs "Reported sizes changed
    during caching and placement" when the two answers differ.
    
    The stand-in was read from the view's size on every request. The window
    resizes the view while the first item is still being built, here from
    10x10 to 1x0, and a resize does not rebuild the cache, so placement was
    told 0 where the cache held 10. Every list view logged this once at
    startup, including the ones in EFL's own tests.
    
    The view's size is now read only when the cache is built, and placement
    gets that same size until something is measured. A later cache build
    picks up the new size.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/elementary/efl_ui_collection_view.c        | 12 +++++-
 src/tests/elementary/efl_ui_test_collection_view.c | 44 ++++++++++++++++++++++
 2 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c
index ef08902cd8..9b48f0273e 100644
--- a/src/lib/elementary/efl_ui_collection_view.c
+++ b/src/lib/elementary/efl_ui_collection_view.c
@@ -91,6 +91,7 @@ struct _Efl_Ui_Collection_View_Data
    unsigned int end_id;
 
    Eina_Size2D content_min_size;
+   Eina_Size2D size_stand_in; /* said for every item until one is measured */
 
    Efl_Ui_Layout_Orientation direction;
    Efl_Ui_Select_Mode mode;
@@ -1049,9 +1050,16 @@ _batch_size_cb(void *data, Efl_Ui_Position_Manager_Size_Call_Config conf, Eina_R
 
       Said the same way to both of the answers below, because the position
       manager compares what it cached against what it is placing and says so
-      when the two disagree. */
+      when the two disagree. The view's size is only read when the cache is
+      built: the window resizing the view before anything was measured would
+      otherwise change the answer under the cache, which is not rebuilt for a
+      resize. */
    if (!item_base.w && !item_base.h)
-     item_base = efl_gfx_entity_size_get(data);
+     {
+        if (conf.cache_request)
+          pd->size_stand_in = efl_gfx_entity_size_get(data);
+        item_base = pd->size_stand_in;
+     }
 
    // Look in the temporary cache now for the beginning of the buffer
 #ifdef VIEWPORT_ENABLE
diff --git a/src/tests/elementary/efl_ui_test_collection_view.c b/src/tests/elementary/efl_ui_test_collection_view.c
index c19f58d89f..1944e4e7c4 100644
--- a/src/tests/elementary/efl_ui_test_collection_view.c
+++ b/src/tests/elementary/efl_ui_test_collection_view.c
@@ -149,8 +149,52 @@ EFL_START_TEST(test_efl_ui_collection_view_select)
 }
 EFL_END_TEST
 
+static void
+_count_size_disagreements(const Eina_Log_Domain *d, Eina_Log_Level level,
+                          const char *file, const char *fnc, int line,
+                          const char *fmt, void *data, va_list args)
+{
+   int *disagreements = data;
+
+   if (eina_str_has_prefix(fmt, "Reported sizes changed"))
+     (*disagreements)++;
+   eina_log_print_cb_stderr(d, level, file, fnc, line, fmt, NULL, args);
+}
+
+/* The sizes the position manager caches and the sizes it places must agree
+   while the window resizes the view. */
+EFL_START_TEST(test_efl_ui_collection_view_sizes_agree)
+{
+   Efl_Ui_Win *win;
+   Efl_Model *model;
+   Efl_Ui_List_View *lv;
+   Efl_Ui_Factory *fl;
+   int disagreements = 0;
+
+   win = win_add(NULL, "win", EFL_UI_WIN_TYPE_BASIC);
+   efl_gfx_entity_size_set(win, EINA_SIZE2D(100, 100));
+
+   eina_log_print_cb_set(_count_size_disagreements, &disagreements);
+
+   model = _make_model(win);
+   fl = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win,
+                efl_ui_property_bind(efl_added, "text", "title"),
+                efl_ui_widget_factory_item_class_set(efl_added, EFL_UI_LIST_DEFAULT_ITEM_CLASS));
+   lv = efl_add(EFL_UI_LIST_VIEW_CLASS, win,
+                efl_ui_collection_view_factory_set(efl_added, fl),
+                efl_ui_view_model_set(efl_added, model));
+   efl_content_set(win, lv);
+
+   get_me_to_those_events(lv);
+
+   eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);
+   ck_assert_int_eq(disagreements, 0);
+}
+EFL_END_TEST
+
 void efl_ui_test_collection_view(TCase *tc)
 {
    tcase_add_test(tc, test_efl_ui_collection_view_basic);
    tcase_add_test(tc, test_efl_ui_collection_view_select);
+   tcase_add_test(tc, test_efl_ui_collection_view_sizes_agree);
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to